Skip to content

fix: image upload on RN 0.83+ New Architecture - #1

Open
Enixma wants to merge 1 commit into
topAmity:mainfrom
Enixma:fix/rn-new-arch-image-upload
Open

fix: image upload on RN 0.83+ New Architecture#1
Enixma wants to merge 1 commit into
topAmity:mainfrom
Enixma:fix/rn-new-arch-image-upload

Conversation

@Enixma

@Enixma Enixma commented Jun 26, 2026

Copy link
Copy Markdown

What

Makes FormData image upload work on React Native 0.83+ New Architecture (Android + iOS). Two independent fixes are needed:

  1. SDK / axios (Bug 2) — axios can't recognize React Native's FormData (no Symbol.toStringTag) and re-serializes the body as application/x-www-form-urlencoded instead of multipart/form-data; the upload server rejects it (multipart != application/x-www-form-urlencoded). Consumed here via patch-package on @amityco/ts-sdk-react-native@7.22.1-f15e84ea.0 until the fix ships in an SDK release. See AmityCo/AmityTypescriptSDK#1446.
  2. React Native native (Bug 1) — RN 0.83.0's getBodyPreview() drained the one-shot multipart stream before send ("Stream Closed"). Fixed upstream in 0.83.1 (Fix binary FormData uploads on Android react/react-native#54917). Bump react-native (and @react-native/*) 0.83.0 → 0.83.1.

Files

  • patches/@amityco+ts-sdk-react-native+7.22.1-f15e84ea.0.patch — the SDK fix (applied via the existing postinstall: patch-package).
  • package.json / package-lock.json — RN 0.83.0 → 0.83.1.

Verification

FileRepository.uploadImage returns a real fileId; on-wire Content-Type is multipart/form-data (was urlencoded):

Platform RN
Android 0.82.0, 0.83.1, 0.85.3, 0.86.0
iOS (simulator) 0.83.1

🤖 Generated with Claude Code

Two independent fixes are required for FormData image upload to work on the
New Architecture (Android + iOS):

1. SDK (axios): axios fails to recognize React Native's FormData (no
   Symbol.toStringTag) and re-serializes the body as
   application/x-www-form-urlencoded instead of multipart/form-data. Consumed
   here via patch-package on @amityco/ts-sdk-react-native until the fix ships
   in an SDK release.

2. React Native (native): RN 0.83.0's getBodyPreview() drained the one-shot
   multipart stream before send. Fixed upstream in 0.83.1 — bump react-native
   (and @react-native/*) 0.83.0 -> 0.83.1.

Verified: FileRepository.uploadImage returns a fileId on Android
(0.82.0/0.83.1/0.85.3/0.86.0) and iOS (simulator).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant