Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/jsActions/mobile-resources-native/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Fixed

- We fixed an issue where the TakePicture and TakePictureAdvanced actions could fail to upload images by not passing the native file payload metadata required by the upload flow.

## [11.3.7] Native Mobile Resources - 2026-3-14

## [1.1.1] Switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ import { getLocales } from "react-native-localize";
import { ImagePickerV2Options, ImagePickerV2Response, PictureQuality, PictureSource } from "../../typings/Camera";

// BEGIN EXTRA CODE

type NativePayload = {
uri: string;
name: string;
type: string;
};

type BlobWithNativePayload = Blob & {
nativePayload?: NativePayload;
};

// END EXTRA CODE

/**
Expand Down Expand Up @@ -124,12 +135,19 @@ export async function TakePicture(
// eslint-disable-next-line no-useless-escape
const filename = /[^\/]*$/.exec(uri)![0];
const filePathWithoutFileScheme = uri.replace("file://", "");
const blobWithNativePayload = blob as BlobWithNativePayload;

blobWithNativePayload.nativePayload = {
uri,
name: filename,
type: blob.type
};

mx.data.saveDocument(
imageObject.getGuid(),
filename,
{},
blob,
blobWithNativePayload,
async () => {
await NativeModules.MendixNative.fsRemove(filePathWithoutFileScheme);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ import { getLocales } from "react-native-localize";
import { ImagePickerV2Options, ImagePickerV2Response, PictureQuality, PictureSource } from "../../typings/Camera";

// BEGIN EXTRA CODE
type NativePayload = {
uri: string;
name: string;
type: string;
};

type BlobWithNativePayload = Blob & {
nativePayload?: NativePayload;
};
// END EXTRA CODE

/**
Expand Down Expand Up @@ -177,12 +186,19 @@ export async function TakePictureAdvanced(
// eslint-disable-next-line no-useless-escape
const filename = /[^\/]*$/.exec(uri)![0];
const filePathWithoutFileScheme = uri.replace("file://", "");
const blobWithNativePayload = blob as BlobWithNativePayload;

blobWithNativePayload.nativePayload = {
uri,
name: filename,
type: blob.type
};

mx.data.saveDocument(
imageObject.getGuid(),
filename,
{},
blob,
blobWithNativePayload,
async () => {
await NativeModules.MendixNative.fsRemove(filePathWithoutFileScheme);

Expand Down
Loading