mirror of
https://github.com/react/react-native.git
synced 2026-09-28 13:23:09 +08:00
Summary: Pull Request resolved: https://github.com/react/react-native/pull/58063 Codegen's `EventEmitter<T>` support for TurboModules diverged between platforms in two ways: - The explicit number types `Double`, `Float` and `Int32` worked as emitter payloads on Android and C++, but iOS rejected them at codegen time (plain `number` worked). iOS now maps all of them to `NSNumber *_Nonnull`, matching how plain `number` is already emitted. - `ArrayBuffer` was rejected on Android and iOS, but the C++ generator silently accepted it and produced a `jsi::ArrayBuffer` emitter. `ArrayBuffer` is not emittable on any platform — Android emitters always carry a `folly::dynamic` payload, which cannot hold raw bytes — and the schema type `NativeModuleEventEmitterBaseTypeAnnotation` already excluded it. It is now rejected everywhere. `ArrayBuffer` payloads are rejected in the shared parser, so Flow and TypeScript specs produce the same error, and the three generators keep an equivalent guard so schemas that are constructed without going through the parser fail the same way. `ArrayBuffer` remains supported as a method argument and as a synchronous return value. Changelog: [iOS][Added] - Support `Double`, `Float` and `Int32` payloads for TurboModule `EventEmitter`s [General][Breaking] - Reject `ArrayBuffer` as a TurboModule `EventEmitter` payload on all platforms Reviewed By: GijsWeterings Differential Revision: D116952150 fbshipit-source-id: e148a394c4916b3ebfbd3f559b190a5910b29de1