Support Promise<ArrayBuffer> in Java and ObjC TurboModules - #57937
Open
paradowstack wants to merge 1 commit into
Open
Support Promise<ArrayBuffer> in Java and ObjC TurboModules#57937paradowstack wants to merge 1 commit into
Promise<ArrayBuffer> in Java and ObjC TurboModules#57937paradowstack wants to merge 1 commit into
Conversation
paradowstack
force-pushed
the
feat/promise-array-buffer-support
branch
from
August 13, 2026 13:15
3b4953a to
a1325b9
Compare
paradowstack
force-pushed
the
feat/promise-array-buffer-support
branch
from
August 13, 2026 13:47
a1325b9 to
5c55393
Compare
Promise<ArrayBuffer> in Java and ObjC TurboModules
paradowstack
marked this pull request as ready for review
August 13, 2026 14:19
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.
Summary:
Promise<ArrayBuffer>was left out of the initial ArrayBuffer TurboModule landing because Android's promise-resolve path serializes throughfolly::dynamic, which cannot carry raw bytes. Codegen rejected the type on both iOS and Android so a spec that built on one platform could not silently diverge on the other.This removes that guard and wires up
Promise<ArrayBuffer>/Promise<?ArrayBuffer>on both platforms. On Android, codegen sets a per-methodpromiseResolveSupportsArrayBufferflag on the JNI host function; when true, the resolve callback is a dedicatedJCxxArrayBufferCallbackImpl/CxxArrayBufferCallbackImplthat hands aByteBuffer(ornull) straight to JSI as anArrayBufferwithout going throughfolly::dynamic. On iOS the resolve path already convertedNSMutableDatato a zero-copyjsi::ArrayBuffer- only the codegen rejection needed to come out.Rebase note: This PR is based on
mainand still uses the landed buffer types (NSMutableDataon iOS,ByteBufferon Android). After the zero-copy follow-ups land (#57879, #57897), this branch should rebase and switch the use those types (RCTArrayBuffer *instead ofNSMutableData *,ArrayBufferinstead ofByteBuffer).Changelog:
[GENERAL] [ADDED] - Add
Promise<ArrayBuffer>support for iOS (ObjC) and Android (Java/Kotlin) TurboModulesTest Plan:
.mmsnapshot tests updated forpromiseArrayBuffer/promiseNullableArrayBuffer.RCTTurboModuleArrayBufferTests—testPromiseResolvesArrayBuffercovers the iOS resolve path end to end.RCTSampleTurboModule/SampleTurboModuleaddgetAsyncBuffer, which resolves aPromisewith a native-allocated buffer;SampleTurboModuleExampleexercises it from JS.