fix: image upload on RN 0.83+ New Architecture - #1
Open
Enixma wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes FormData image upload work on React Native 0.83+ New Architecture (Android + iOS). Two independent fixes are needed:
FormData(noSymbol.toStringTag) and re-serializes the body asapplication/x-www-form-urlencodedinstead ofmultipart/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.0until the fix ships in an SDK release. See AmityCo/AmityTypescriptSDK#1446.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). Bumpreact-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 existingpostinstall: patch-package).package.json/package-lock.json— RN0.83.0 → 0.83.1.Verification
FileRepository.uploadImagereturns a realfileId; on-wireContent-Typeismultipart/form-data(was urlencoded):🤖 Generated with Claude Code