Skip to content

Commit 3f86d2f

Browse files
fix: resolve photo capture issues in TakePicture and TakePictureAdvanced actions on Android
1 parent 4cbf608 commit 3f86d2f

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

packages/jsActions/mobile-resources-native/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
99
- We switched to a new sound library for the Play sound action to support react-native 0.84+.
1010
- The Play sound action now plays audio files from online (network) documents on Android by downloading them to a version-based cache before playback.
1111
- We have fixed the biometric authentication issue where it was not working on Android and crashing on iOS.
12+
- Fixed an issue where the `TakePicture` and `TakePictureAdvanced` actions failed to capture photos on Android.
1213

1314
## [12.1.0] Native Mobile Resources - 2026-6-10
1415

packages/jsActions/mobile-resources-native/src/camera/TakePicture.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ export async function TakePicture(
118118

119119
function storeFile(imageObject: mendix.lib.MxObject, uri: string): Promise<boolean> {
120120
return new Promise((resolve, reject) => {
121-
fetch(uri)
122-
.then(response => response.blob())
123-
.then(blob => {
121+
NativeModules.MxFileSystem.read(uri.replace("file://", ""))
122+
.then((nativeBlob: unknown) => {
123+
const blob = new Blob();
124+
Object.assign(blob, { data: nativeBlob });
124125
// eslint-disable-next-line no-useless-escape
125126
const filename = /[^\/]*$/.exec(uri)![0];
126127
const filePathWithoutFileScheme = uri.replace("file://", "");

packages/jsActions/mobile-resources-native/src/camera/TakePictureAdvanced.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,10 @@ export async function TakePictureAdvanced(
171171

172172
function storeFile(imageObject: mendix.lib.MxObject, uri: string): Promise<boolean> {
173173
return new Promise((resolve, reject) => {
174-
fetch(uri)
175-
.then(response => response.blob())
176-
.then(blob => {
174+
NativeModules.MxFileSystem.read(uri.replace("file://", ""))
175+
.then((nativeBlob: unknown) => {
176+
const blob = new Blob();
177+
Object.assign(blob, { data: nativeBlob });
177178
// eslint-disable-next-line no-useless-escape
178179
const filename = /[^\/]*$/.exec(uri)![0];
179180
const filePathWithoutFileScheme = uri.replace("file://", "");

0 commit comments

Comments
 (0)