Skip to content

[0.88] Make RCTArrayBuffer bridge backward compatible - #58420

Draft
cipolleschi wants to merge 1 commit into
0.88-stablefrom
fix-ios-arraybuffer-backward-compat-0.88
Draft

[0.88] Make RCTArrayBuffer bridge backward compatible#58420
cipolleschi wants to merge 1 commit into
0.88-stablefrom
fix-ios-arraybuffer-backward-compat-0.88

Conversation

@cipolleschi

@cipolleschi cipolleschi commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary:

Makes the Objective-C ArrayBuffer TurboModule change from 11f9a7f backward compatible for React Native 0.88.

  • Keeps the pre-existing Objective-C selectors and exact NSData parameter / NSMutableData return signatures as required protocol methods.
  • Adds optional RCTArrayBuffer entry points with a WithRCTArrayBuffer selector suffix.
  • Makes generated dispatch prefer the new entry point when implemented and fall back to the legacy entry point for existing modules.
  • Updates the sample module so legacy implementations wrap/unwrap NSData and NSMutableData and delegate to the new RCTArrayBuffer methods, where the actual logic lives.
  • Restores the previous public C++ conversion, invocation, and setInvocationArg overloads alongside the newer overloads.
  • Preserves the zero-copy synchronous path for the new entry points while retaining the legacy owning-copy behavior.

Changelog:

[IOS] [FIXED] - Preserve the legacy Objective-C TurboModule ArrayBuffer API alongside the RCTArrayBuffer API.

Test Plan:

  • yarn test packages/react-native-codegen/src/generators/modules/tests/GenerateModuleHObjCpp-test.js --runInBand — passed, 15 tests and 13 snapshots.
  • yarn test packages/react-native-codegen/src/generators/modules/tests/GenerateModuleMm-test.js --runInBand — passed, 13 tests and 13 snapshots.
  • yarn test packages/react-native-codegen/e2e/deep_imports/tests/modules/GenerateModuleObjCpp-test.js --runInBand — passed, 3 tests and 3 snapshots.
  • yarn --cwd packages/react-native-codegen build — passed.
  • yarn clang-format on the changed native sources, Prettier 3.9.4, and git diff --check — passed.
  • Apple C++ API view regenerated with the CI Doxygen version 1.16.1; the ArrayBuffer entries match the committed snapshots.
  • Focused RCTTurboModuleArrayBufferTests via xcodebuild could not run locally because the existing Pods project is stale and fails before this target on missing Yoga/cxxstable headers. The added legacy fallback, wrapper, zero-copy, ownership, and async lifetime cases are left for CI.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 9, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Sep 9, 2026
@cipolleschi
cipolleschi force-pushed the fix-ios-arraybuffer-backward-compat-0.88 branch from 24142b7 to a4db049 Compare September 9, 2026 10:43
- (void)voidNullableArrayBuffer:(RCTArrayBuffer * _Nullable)arg;
- (NSMutableData *)getArrayBuffer;
@optional
- (RCTArrayBuffer *)getArrayBufferWithRCTArrayBuffer;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- (RCTArrayBuffer *)getArrayBufferWithRCTArrayBuffer;
- (RCTArrayBuffer *)getArrayBufferAsRCTArrayBuffer;

@required
- (void)voidArrayBuffer:(NSData *)arg;
@optional
- (void)voidArrayBufferWithRCTArrayBuffer:(RCTArrayBuffer *)arg;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- (void)voidArrayBufferWithRCTArrayBuffer:(RCTArrayBuffer *)arg;
- (void)voidArrayBufferFromRCTArrayBuffer:(RCTArrayBuffer *)arg;

@required
- (void)voidNullableArrayBuffer:(NSData * _Nullable)arg;
@optional
- (void)voidNullableArrayBufferWithRCTArrayBuffer:(RCTArrayBuffer * _Nullable)arg;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- (void)voidNullableArrayBufferWithRCTArrayBuffer:(RCTArrayBuffer * _Nullable)arg;
- (void)voidNullableArrayBufferFromRCTArrayBuffer:(RCTArrayBuffer * _Nullable)arg;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner Pick Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant