mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
112
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66358cfaaa | ||
|
|
2c749a814a | ||
|
|
5ffff0153c | ||
|
|
6d7a93f2b1 | ||
|
|
0fd24c75a1 | ||
|
|
c629019080 | ||
|
|
69dc655005 | ||
|
|
b44d4b4292 | ||
|
|
2ea9fd6c86 | ||
|
|
7a86ee0aef | ||
|
|
d45523639d | ||
|
|
87d6043788 | ||
|
|
c827474b58 | ||
|
|
f4e93df55e | ||
|
|
6f482708b5 | ||
|
|
2fe008b902 | ||
|
|
a1575d04ce | ||
|
|
f0725f7802 | ||
|
|
53464e8483 | ||
|
|
487844e533 | ||
|
|
5f5a77c342 | ||
|
|
118a6621f5 | ||
|
|
30999b868c | ||
|
|
e926ad0428 | ||
|
|
78bdf584e2 | ||
|
|
8d245e9f61 | ||
|
|
d2eca58996 | ||
|
|
e8988e9460 | ||
|
|
7787d2fbb5 | ||
|
|
e5e8e637db | ||
|
|
e4da3437d9 | ||
|
|
1e1af623b1 | ||
|
|
5abda9c7da | ||
|
|
8cc9bbc892 | ||
|
|
e3a5af6a99 | ||
|
|
24d0d4414f | ||
|
|
5c7cbebfee | ||
|
|
81d652543b | ||
|
|
aa685408a2 | ||
|
|
a4be9b236f | ||
|
|
d932f28209 | ||
|
|
9afd6bb2f4 | ||
|
|
0e8065cfee | ||
|
|
0dcb939247 | ||
|
|
197783be1e | ||
|
|
52b2c466c5 | ||
|
|
5b9873ff35 | ||
|
|
b31a2fb4b8 | ||
|
|
e32307e054 | ||
|
|
31bff4e093 | ||
|
|
2bbea50991 | ||
|
|
aa85da33a5 | ||
|
|
aa492fadab | ||
|
|
4740f211ae | ||
|
|
9e98c72ad3 | ||
|
|
4a88282a9c | ||
|
|
38f52a5bc8 | ||
|
|
58afeeff1d | ||
|
|
44725b88be | ||
|
|
83fbb0b536 | ||
|
|
c24e67fb53 | ||
|
|
8542682754 | ||
|
|
8ed0e1eba5 | ||
|
|
064fd59602 | ||
|
|
3f7f9d8fb8 | ||
|
|
b9baddfd5d | ||
|
|
068ec39aea | ||
|
|
5027375851 | ||
|
|
07f40ec6b4 | ||
|
|
12850c2962 | ||
|
|
0a71b43fbc | ||
|
|
f0f8b95719 | ||
|
|
36e1c0afed | ||
|
|
b3341d3541 | ||
|
|
fc60030a34 | ||
|
|
c0e381db1c | ||
|
|
6db4a0171e | ||
|
|
88cf30a675 | ||
|
|
d9d3b3e08b | ||
|
|
c53541f3a1 | ||
|
|
e88962bb1a | ||
|
|
26502c6319 | ||
|
|
aab0d3397c | ||
|
|
36a9b7eda7 | ||
|
|
041b4c3dd0 | ||
|
|
481df76c24 | ||
|
|
8c90f81aab | ||
|
|
6e8fab96fa | ||
|
|
6c874f25e2 | ||
|
|
53dc68a31d | ||
|
|
84947fb0de | ||
|
|
89f0a37800 | ||
|
|
880b7e2c3a | ||
|
|
bcf974838e | ||
|
|
fd95f824d0 | ||
|
|
47d1d2b256 | ||
|
|
0e03adcc79 | ||
|
|
07fcdfebae | ||
|
|
7dc26f58ee | ||
|
|
10c5c75de4 | ||
|
|
8825ec7464 | ||
|
|
d9a582e949 | ||
|
|
e091759947 | ||
|
|
7ec470d49a | ||
|
|
3f396616d2 | ||
|
|
325c681cb1 | ||
|
|
33bc2716e4 | ||
|
|
29d5aa582f | ||
|
|
3766e58b9a | ||
|
|
6031905711 | ||
|
|
990ca0d100 | ||
|
|
e02e7b1a29 |
+2
-2
@@ -69,7 +69,7 @@ munge_underscores=true
|
||||
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/packages/react-native/index.js'
|
||||
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/packages/react-native/\1'
|
||||
module.name_mapper='^@react-native/dev-middleware$' -> '<PROJECT_ROOT>/packages/dev-middleware'
|
||||
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\)$' -> '<PROJECT_ROOT>/packages/react-native/Libraries/Image/RelativeImageStub'
|
||||
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\|ktx\)$' -> '<PROJECT_ROOT>/packages/react-native/Libraries/Image/RelativeImageStub'
|
||||
|
||||
module.system.haste.module_ref_prefix=m#
|
||||
|
||||
@@ -98,4 +98,4 @@ untyped-import
|
||||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.287.0
|
||||
^0.288.0
|
||||
|
||||
+50
-94
@@ -1,97 +1,6 @@
|
||||
# Changelog
|
||||
|
||||
## v0.81.4
|
||||
|
||||
### Fixed
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Fix regression that skips artifacts code generation ([f6f5ea0b2e](https://github.com/facebook/react-native/commit/f6f5ea0b2eed894725d8f6e8bd045c99c3182026) by [@kitten](https://github.com/kitten))
|
||||
- Reapplied "Use autolinking-generated react-native-config output in second step of cocoapods linking that generates artifacts and generated source" ([bb73315a3f](https://github.com/facebook/react-native/commit/bb73315a3fd8cd203c4ddb3ffa10bfec307c7e92) by [@kitten](https://github.com/kitten))
|
||||
|
||||
## v0.82.0-rc.4
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Hermes V1:** Fixed coordinates for Hermes V1 artifacts ([674fb77d93](https://github.com/facebook/react-native/commit/674fb77d93dfe67a5fe90449dc71b195b1851e13) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- **Switch:** Fix Switch layout to work with iOS26 ([91d427fe52](https://github.com/facebook/react-native/commit/91d427fe52a307f9aa8579912ef956d61808dad2) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
|
||||
## v0.82.0-rc.3
|
||||
|
||||
### Added
|
||||
|
||||
- **Hermes V1:** Added a dependency on hermes-compiler ([0caf8e70d5](https://github.com/facebook/react-native/commit/0caf8e70d53f611a73ad9b55879dfe0a5f036371) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
|
||||
### Fixed
|
||||
|
||||
#### Android specific
|
||||
|
||||
- **Hermes V1:** Changed the coordinates of hermes artifacts when using Hermes V1 ([d0fb33822d](https://github.com/facebook/react-native/commit/d0fb33822de38183895c8b3421f46966909beaf3) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- **Codegen:** Fix regression that skips artifacts code generation ([f6f5ea0b2e](https://github.com/facebook/react-native/commit/f6f5ea0b2eed894725d8f6e8bd045c99c3182026) by [@kitten](https://github.com/kitten))
|
||||
|
||||
## v0.81.3
|
||||
|
||||
### Fixed
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Reverted "Use autolinking-generated react-native-config output in second step of cocoapods linking that generates artifacts and generated source" ([537e3ad930](https://github.com/facebook/react-native/commit/537e3ad93041c0cef959f0d20586fe97818900a6) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
|
||||
## v0.81.2
|
||||
|
||||
### Added
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Create a debugOptimized buildType for Android ([5e3edafec6](https://github.com/facebook/react-native/commit/5e3edafec6c69558521061dced7a6bcd046576b0) by [@cortinico](https://github.com/cortinico))
|
||||
- Add `useNativeEqualsInNativeReadableArrayAndroid` and `useNativeTransformHelperAndroid` feature flag to the experimental channel. This should alleviate some of the perf issue users are seeing on Android + Reanimated + NewArch on 0.81([a346096da8](https://github.com/facebook/react-native/commit/a346096da81fccf5fbc82d83bfc128695e6ec3a5) by [@cortinico](https://github.com/cortinico))
|
||||
|
||||
### Fixed
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Fix Node scripts related to prebuilt tarball extraction for paths containing whitespaces ([366f2ad505](https://github.com/facebook/react-native/commit/366f2ad5057ffecc1f5b211f6aae29567ae6b7e5) by [@kitten](https://github.com/kitten))
|
||||
- Use autolinking-generated react-native-config output in second step of cocoapods linking that generates artifacts and generated source ([a2eb29e5e7](https://github.com/facebook/react-native/commit/a2eb29e5e7aef8bbdf4c647c8467b5292b013b20) by [@kitten](https://github.com/kitten))
|
||||
|
||||
## v0.82.0-rc.1
|
||||
|
||||
### Added
|
||||
|
||||
#### Android specific
|
||||
|
||||
- **Hermes V1:** Added opt-in to use the new Hermes ([3e9990f860](https://github.com/facebook/react-native/commit/3e9990f860eb9380837ef431ca02def32c4261ad) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- **Hermes V1:** Added opt-in to use the new Hermes ([e9cdc308b4](https://github.com/facebook/react-native/commit/e9cdc308b4c04753d85757e8877ac00c3c687b95) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
|
||||
### Changed
|
||||
|
||||
- **Hermes V1:** Changed the source of hermesc binary to be an npm package ([2e0bd13a25](https://github.com/facebook/react-native/commit/2e0bd13a2533fe7ab64125a95b9215b806018c6e) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
|
||||
### Deprecated
|
||||
|
||||
- **APIs:** Deprecate legacy javascript react native apis ([e7aeea26bd](https://github.com/facebook/react-native/commit/e7aeea26bde6e9cda0a3a0a55fc2a0421fb0c0e5) by [@RSNara](https://github.com/RSNara))
|
||||
|
||||
### Fixed
|
||||
|
||||
#### Android specific
|
||||
|
||||
- **Build From Source:** Fix build from source due to missing folder error on Gradle 9.0 ([9fbce3eff1](https://github.com/facebook/react-native/commit/9fbce3eff18060f16e796badc415ba733ede19af) by [@cortinico](https://github.com/cortinico))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- **RCTAlertController:** Simplify RCTAlertController, don't create additional UIWindow ([05c4321b19](https://github.com/facebook/react-native/commit/05c4321b194c3d0e146b6085bcaccc75acd3fd67) by [@okwasniewski](https://github.com/okwasniewski))
|
||||
- **Prebuild:** Fix Node scripts related to prebuilt tarball extraction for paths containing whitespaces ([9731e8ebc5](https://github.com/facebook/react-native/commit/9731e8ebc5ea87526a91b9903172639e062cd920) by [@kitten](https://github.com/kitten))
|
||||
- **Prebuild:** Use autolinking-generated react-native-config output in second step of cocoapods linking that generates artifacts and generated source ([f170db412b](https://github.com/facebook/react-native/commit/f170db412b3ab46fd0894d5d66431d9c230cd3a8) by [@kitten](https://github.com/kitten))
|
||||
|
||||
## v0.82.0-rc.0
|
||||
## v0.82.0
|
||||
|
||||
### Breaking
|
||||
|
||||
@@ -99,6 +8,7 @@
|
||||
- **`CxxSharedModuleWrapper`:** Removed CxxSharedModuleWrapper ([fafbee2402](https://github.com/facebook/react-native/commit/fafbee240235ea0e63eb01abd31ce32d6a576429) by [@javache](https://github.com/javache))
|
||||
- **DOM API:** Enable DOM APIs in host component refs ([2ad845ccb2](https://github.com/facebook/react-native/commit/2ad845ccb2fea277e05513dcf41407026a8224f0) by [@rubennorte](https://github.com/rubennorte))
|
||||
- **Error Handling:** Unhandled promises are now handled by ExceptionsManager.handleException, instead of being swallowed as Logbox Warnings. ([c4082c9ce2](https://github.com/facebook/react-native/commit/c4082c9ce208a324c2d011823ca2ba432411aafc) by [@krystofwoldrich](https://github.com/krystofwoldrich))
|
||||
- **InteractionManager:** InteractionManager has been deprecated and no longer respects interaction handles. Instead, it is now recommended to avoid executing long-running JavaScript tasks by breaking them up into smaller tasks and scheduling them using `requestIdleCallback()`. ([03d9f34a82](https://github.com/facebook/react-native/commit/03d9f34a8252456d389d9f9a3bd04b99a2828c16) by [@yungsters](https://github.com/yungsters))
|
||||
- **`shouldEmitW3CPointerEvents`:** Migrate `shouldPressibilityUseW3CPointerEventsForHover` to common private feature flags and remove `shouldEmitW3CPointerEvents` flag. ([fb4587780e](https://github.com/facebook/react-native/commit/fb4587780e8d6111139d73598a9a26ff392dee28) by [@coado](https://github.com/coado))
|
||||
- **TurboModuleUtils:** Remove unused ReactCommon/TurboModuleUtils functions #deepCopyJSIObject and #deepCopyJSIArray ([ead669ade3](https://github.com/facebook/react-native/commit/ead669ade31ee703c407f96c0ce98d8f2991bdc8) by [@christophpurrer](https://github.com/christophpurrer))
|
||||
- **TurboModules:** Delete old location of CallbackWrapper.h / LongLivedObject.h by ([cb94e71](https://github.com/facebook/react-native/commit/cb94e71845259ae7fa823eb4d21cde74fccd7435) [@christophpurrer](https://github.com/christophpurrer))
|
||||
@@ -122,6 +32,7 @@
|
||||
- **API:** Expose NativeComponentRegistry API as JavaScript root export ([f936780cd5](https://github.com/facebook/react-native/commit/f936780cd5c0c17797f9d2bbc8f5cee81c2eefce) by [@zhongwuzw](https://github.com/zhongwuzw))
|
||||
- **API:** Expose `ReactNativeVersion` API as JavaScript root export ([ec5638abd0](https://github.com/facebook/react-native/commit/ec5638abd0e872be62b6ea5d8df9bed6335c2191) by [@huntie](https://github.com/huntie))
|
||||
- **Codegen:** Added getDebugProps to codegen ([e547f466ee](https://github.com/facebook/react-native/commit/e547f466ee41415a75ec6b6f910171285ee7bfc3) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **Hermes V1:** Added a dependency on hermes-compiler ([0caf8e70d5](https://github.com/facebook/react-native/commit/0caf8e70d53f611a73ad9b55879dfe0a5f036371) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
- **Pressable:** Allow setting `blockNativeResponder` on Pressable ([6e4d23ded2](https://github.com/facebook/react-native/commit/6e4d23ded2da4a717bafcc032e3d7a0a5fbe3731) by [@zeyap](https://github.com/zeyap))
|
||||
- **Yoga/API:** Make yoga/Yoga.h an umbrell header ([8ed2cee80e](https://github.com/facebook/react-native/commit/8ed2cee80e0aaac2f2a6a897ba450888f274a5a4) by [@rudybear](https://github.com/rudybear))
|
||||
|
||||
@@ -131,18 +42,23 @@
|
||||
- **DevMenu:** Add long-press back as an option to open the DevMenu for devices that lack menu & fast-forward. ([32d37f03ad](https://github.com/facebook/react-native/commit/32d37f03ad05290205a4f04d756f6e1880c4ff89) by [@sbuggay](https://github.com/sbuggay))
|
||||
- **DevTools:** `DevSupportManager::openDebugger` now supports an optional `panel` param determining the starting panel ([7eb3536728](https://github.com/facebook/react-native/commit/7eb3536728c4a20f7e51245f4f7b64aa505bd799) by [@huntie](https://github.com/huntie))
|
||||
- **DevTools:** Adds a landing view parameter to opening RNDT, enabling arbitrary view focus on launch. ([635c707eec](https://github.com/facebook/react-native/commit/635c707eec18f6d2ceceac2dcee9f458f17f8aab) by [@sbuggay](https://github.com/sbuggay))
|
||||
- **Hermes V1:** Added opt-in to use the new Hermes ([3e9990f860](https://github.com/facebook/react-native/commit/3e9990f860eb9380837ef431ca02def32c4261ad) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
- **HWInput:** Channel up/down hardware events. ([c2a3e4420e](https://github.com/facebook/react-native/commit/c2a3e4420e07147f9a040a665da98dbe22b87a2a) by [@sbuggay](https://github.com/sbuggay))
|
||||
- **Manifest:** Add support to specify a single Manifest rather than 2 (main/debug) by using the `usesCleartextTraffic` manifest placeholder which is autoconfigured by RNGP. ([d89acc1596](https://github.com/facebook/react-native/commit/d89acc1596345534882938d2bbf40275a6cb89bd) by [@cortinico](https://github.com/cortinico))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- **API:** Add deprecation message for RCTAppdelegate APIs ([d503ea4efc](https://github.com/facebook/react-native/commit/d503ea4efc84b6511cef2a46421a16e044862e88) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **Fabric:** Add invalidation callback for non-recycled component instances ([dc4a6d2c7e](https://github.com/facebook/react-native/commit/dc4a6d2c7e2ed421b61929896f60b1a864a60d97) by [@kkafar](https://github.com/kkafar))
|
||||
- **Hermes V1:** Added opt-in to use the new Hermes ([e9cdc308b4](https://github.com/facebook/react-native/commit/e9cdc308b4c04753d85757e8877ac00c3c687b95) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
- **New Architecture:** Add warning if RCT_NEW_ARCH_ENABLED is set to 0 ([7d0bef2f25](https://github.com/facebook/react-native/commit/7d0bef2f25a206d917e7f5cc2b9a6c088f13a832) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **New Architecture:** Crash the app if they force the legacy architecture. ([dc132a4fd4](https://github.com/facebook/react-native/commit/dc132a4fd4ca8dc28dc7dbb2406ac67dac1a0ee7) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
|
||||
### Changed
|
||||
|
||||
- **Font:** Enabled `enableFontScaleChangesUpdatingLayout` feature flag by default ([686d14f1d1](https://github.com/facebook/react-native/commit/686d14f1d16c2f02720104ddd395f7d27c908350) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
- **Hermes:** Changed names of hermes binaries ([776fca1e7c](https://github.com/facebook/react-native/commit/776fca1e7c978a2d8f817d042836073e4dcb4e0e) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
- **Hermes V1:** Changed the source of hermesc binary to be an npm package ([2e0bd13a25](https://github.com/facebook/react-native/commit/2e0bd13a2533fe7ab64125a95b9215b806018c6e) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
- **Metro:** Bump Metro to ^0.83.1 ([840fd6c83f](https://github.com/facebook/react-native/commit/840fd6c83f45326a796bf2823f8c2fa942aed06c) by [@robhogan](https://github.com/robhogan))
|
||||
- **React:** Bumped React to 19.1.1 ([ec5a98b1f5](https://github.com/facebook/react-native/commit/ec5a98b1f5c2137f5f6ff5f5f6706f20384c44df) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **Runtime:** CDP backend now accepts `addBinding` and `removeBinding` methods earlier, before a Runtime exists. ([3271e57c75](https://github.com/facebook/react-native/commit/3271e57c751e7d1193c1e9f7b53e545231511b9d) by [@motiz88](https://github.com/motiz88))
|
||||
@@ -176,6 +92,7 @@
|
||||
|
||||
### Deprecated
|
||||
|
||||
- **APIs:** Deprecate legacy javascript react native apis ([e7aeea26bd](https://github.com/facebook/react-native/commit/e7aeea26bde6e9cda0a3a0a55fc2a0421fb0c0e5) by [@RSNara](https://github.com/RSNara))
|
||||
- **StyleSheet:** `StyleSheet.absoluteFillObject` is deprecated in favor of `StyleSheet.absoluteFill` (equivalent). ([83e19813ff](https://github.com/facebook/react-native/commit/83e19813ff5498ab3497d97fe38dba63a5554425) by [@huntie](https://github.com/huntie))
|
||||
- Deprecate all the c++ classes not used by interop, or the new architecture. ([9539cd2626](https://github.com/facebook/react-native/commit/9539cd26261aef646379104833c7f719e3d83d02) by [@RSNara](https://github.com/RSNara))
|
||||
|
||||
@@ -229,6 +146,7 @@
|
||||
- **Casting:** Casting rawValue to int was incorrectly truncating ([31b9f10364](https://github.com/facebook/react-native/commit/31b9f103645e67586bdfc5c2f590c28c04ca3871) by [@javache](https://github.com/javache))
|
||||
- **Codegen:** Help Codegen find library's package.json if some libraries using `exports` field in their package.json file and the `./package.json` subpath is not explicitly defined ([739dfd2141](https://github.com/facebook/react-native/commit/739dfd2141015a8126448bda64a559f5bf22672e) by [@RakaDoank](https://github.com/RakaDoank))
|
||||
- **Hermes:** Change leftover references to `hermes.framework` to `hermesvm.framework` ([7f051c5470](https://github.com/facebook/react-native/commit/7f051c54701b3585f76f63846abbf7e68e2688d2) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
- **Hermes V1:** Fixed coordinates for Hermes V1 artifacts ([674fb77d93](https://github.com/facebook/react-native/commit/674fb77d93dfe67a5fe90449dc71b195b1851e13) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
- **Performance Panel:** Fix typo in Performance.js type checking condition ([6caf2dfa38](https://github.com/facebook/react-native/commit/6caf2dfa382fd4f1184b8d21b030c36687a256e4) by [@YangJonghun](https://github.com/YangJonghun))
|
||||
- **Performance Panel:** Add default cases to switch statements in headers ([323fe3a5d4](https://github.com/facebook/react-native/commit/323fe3a5d471ae5a2f94d5c2bd13cc97feffe0a5) by [@NSProgrammer](https://github.com/NSProgrammer))
|
||||
- **ReactCommon:** Bring back ContextContainer::Shared = std::shared_ptr<const ContextContainer> alias ([daeb6e99ab](https://github.com/facebook/react-native/commit/daeb6e99abbca2b6395a9a703d2b0bb9e5091fb7) by [@christophpurrer](https://github.com/christophpurrer))
|
||||
@@ -240,11 +158,13 @@
|
||||
#### Android specific
|
||||
|
||||
- **Accessability:** Stabilize custom accessibility action IDs to prevent "incompatible action" errors in TalkBack. ([626568f9a3](https://github.com/facebook/react-native/commit/626568f9a3f956a52f6c55df1dc3bc5cd017e353) by [@leg234-png](https://github.com/leg234-png))
|
||||
- **Build From Source:** Fix build from source due to missing folder error on Gradle 9.0 ([9fbce3eff1](https://github.com/facebook/react-native/commit/9fbce3eff18060f16e796badc415ba733ede19af) by [@cortinico](https://github.com/cortinico))
|
||||
- **Determinism:** Turned off build IDs for native libraries, fixing issues with reproducibility ([4b8dbe7642](https://github.com/facebook/react-native/commit/4b8dbe7642be53d0ccfc68ca8c9b3f5e750a68c0) by [@Rexogamer](https://github.com/Rexogamer))
|
||||
- **DevTools:** Fix stack trace linkifying failing when using Android emulator and other situations where the device and debugger have different bundle urls ([794df48ad6](https://github.com/facebook/react-native/commit/794df48ad6a259022e66de1a38ff54b5ec67c3e4) by [@vzaidman](https://github.com/vzaidman))
|
||||
- **Edge to Edge:** Fix `Dimensions` `window` values on Android < 15 when edge-to-edge is enabled ([3b185e4bce](https://github.com/facebook/react-native/commit/3b185e4bcef24e0689cccd4cf250d469b114d4da) by [@zoontek](https://github.com/zoontek))
|
||||
- **Fonts:** Update font scale when recreating `RootView` ([5cda3065ce](https://github.com/facebook/react-native/commit/5cda3065ce635460a7458cbab5c10e24bea3bfe2) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
- **Fonts:** Fix incorrect positioning of inline view at the end of string when RTL text in LTR container ([7f224941bb](https://github.com/facebook/react-native/commit/7f224941bb807919b487d8e1634dd2124f9258b8) by [@NickGerleman](https://github.com/NickGerleman))
|
||||
- **Hermes V1:** Changed the coordinates of hermes artifacts when using Hermes V1 ([d0fb33822d](https://github.com/facebook/react-native/commit/d0fb33822de38183895c8b3421f46966909beaf3) by [@j-piasecki](https://github.com/j-piasecki))
|
||||
- **Locale:** Use the first available locale instead of the default one to decide `isDevicePreferredLanguageRTL` ([a03780d279](https://github.com/facebook/react-native/commit/a03780d279d0944e0dcbbf5a93680775006598b0) by Kaining Zhong)
|
||||
- **New Architecture:** Correctly account for insets on first render of Modals on New Arch ([2e76fc8e8e](https://github.com/facebook/react-native/commit/2e76fc8e8ea01fbce5bd131f675364e688f49088) by [@cortinico](https://github.com/cortinico))
|
||||
- **Performance:** Fix mounting is very slow on Android by shipping native transform optimizations ([c557311ed8](https://github.com/facebook/react-native/commit/c557311ed836cded8548c5bca32f3eded0abc7ff) by [@cortinico](https://github.com/cortinico))
|
||||
@@ -257,13 +177,18 @@
|
||||
- **Build:** Non-UTF8 crashes Info.plist local frameworks ([91e69b5d4c](https://github.com/facebook/react-native/commit/91e69b5d4c768278680a8d9ae979bc267624ce98) by [@philipheinser](https://github.com/philipheinser))
|
||||
- **Build:** Fixed variable naming error in `set_fast_float_config` method in `react_native_pods.rb` ([327057fad5](https://github.com/facebook/react-native/commit/327057fad5c78a95e6c039bfe380d78672e83a43) by [@eliotfallon213](https://github.com/eliotfallon213))
|
||||
- **Build:** Fix pure cocoapods dynamic framework build ([aa4555eaf1](https://github.com/facebook/react-native/commit/aa4555eaf1b6aab83660c600e867fa6c2da4128e) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **Codegen:** Fix regression that skips artifacts code generation ([f6f5ea0b2e](https://github.com/facebook/react-native/commit/f6f5ea0b2eed894725d8f6e8bd045c99c3182026) by [@kitten](https://github.com/kitten))
|
||||
- **Native Modules:** Fix concurrent calls into resolve/reject inside native modules ([dc879950d1](https://github.com/facebook/react-native/commit/dc879950d196dfd429229f1c4c8e743ef1799d11) by [@RSNara](https://github.com/RSNara))
|
||||
- **New Architecture:** Fix overriding (xc)framework Info.plist files with RCTNewArchEnabled field ([f84514a88b](https://github.com/facebook/react-native/commit/f84514a88be00f8dcae7972f84aa89d829392a58) by [@msynowski](https://github.com/msynowski))
|
||||
- **Prebuild:** Fix Node scripts related to prebuilt tarball extraction for paths containing whitespaces ([9731e8ebc5](https://github.com/facebook/react-native/commit/9731e8ebc5ea87526a91b9903172639e062cd920) by [@kitten](https://github.com/kitten))
|
||||
- **Prebuild:** Use autolinking-generated react-native-config output in second step of cocoapods linking that generates artifacts and generated source ([f170db412b](https://github.com/facebook/react-native/commit/f170db412b3ab46fd0894d5d66431d9c230cd3a8) by [@kitten](https://github.com/kitten))
|
||||
- **RCTAlertController:** Simplify RCTAlertController, don't create additional UIWindow ([05c4321b19](https://github.com/facebook/react-native/commit/05c4321b194c3d0e146b6085bcaccc75acd3fd67) by [@okwasniewski](https://github.com/okwasniewski))
|
||||
- **RCTPullToRefreshViewComponentView:** Properly initialize the `RCTPullToRefreshViewComponentView` ([27217e8bd6](https://github.com/facebook/react-native/commit/27217e8bd601757b5db6efc022db428b552a2aa4) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **RCTReactNativeFactory:** Ask the delegate for `getModuleForClass` and `getModuleInstanceFromClass` ([85b47afb48](https://github.com/facebook/react-native/commit/85b47afb48e50b036d2c2c79a008f571d3bfcb43) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **ScrollView:** Correctly propagate `ScrollView` props to `RefreshControl` ([09daad27ea](https://github.com/facebook/react-native/commit/09daad27ea22b83fab65176ea3c7f5f1488ba408) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **ScrollView:** Make sure that `ScrollView` recycled refresh control have the right props setup. ([21b93d8d7d](https://github.com/facebook/react-native/commit/21b93d8d7d46a26f728df19764f85a8aebf318bb) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **Switch:** Fixed a crash when rendering the `Switch` component ([28275a0f7b](https://github.com/facebook/react-native/commit/28275a0f7b182a215010d47fb841d9c2c36bb24c) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **Switch:** Fix Switch layout to work with iOS26 ([91d427fe52](https://github.com/facebook/react-native/commit/91d427fe52a307f9aa8579912ef956d61808dad2) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- **Text:** Fix selectable prop not working correctly ([f004cd39bc](https://github.com/facebook/react-native/commit/f004cd39bc4b632006085cbcf61df52bc5d25242) by [@iamAbhi-916](https://github.com/iamAbhi-916))
|
||||
- **TextInput:** Update TextInput recycling logic to clean up the `inputAccessoryView` dependency. ([eb08f54594](https://github.com/facebook/react-native/commit/eb08f545948de9e2eca91ab3cb7569670c553b15) by [@ArturKalach](https://github.com/ArturKalach))
|
||||
- **TextInput:** Fixed TextInput behavior when `maxLength={null}` is passed ([56ad53cb14](https://github.com/facebook/react-native/commit/56ad53cb14b5c842714fcf976b6ba81f68c140f2) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
@@ -273,6 +198,39 @@
|
||||
|
||||
- **Network:** Fixed vulnerability on undici and on-headers ([dd00c9055a](https://github.com/facebook/react-native/commit/dd00c9055a8f0c9ceac1716385a8a9874f7a4c2e) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
|
||||
## v0.81.4
|
||||
|
||||
### Fixed
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Fix regression that skips artifacts code generation ([f6f5ea0b2e](https://github.com/facebook/react-native/commit/f6f5ea0b2eed894725d8f6e8bd045c99c3182026) by [@kitten](https://github.com/kitten))
|
||||
- Reapplied "Use autolinking-generated react-native-config output in second step of cocoapods linking that generates artifacts and generated source" ([bb73315a3f](https://github.com/facebook/react-native/commit/bb73315a3fd8cd203c4ddb3ffa10bfec307c7e92) by [@kitten](https://github.com/kitten))
|
||||
|
||||
## v0.81.3
|
||||
|
||||
### Fixed
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Reverted "Use autolinking-generated react-native-config output in second step of cocoapods linking that generates artifacts and generated source" ([537e3ad930](https://github.com/facebook/react-native/commit/537e3ad93041c0cef959f0d20586fe97818900a6) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
||||
|
||||
## v0.81.2
|
||||
|
||||
### Added
|
||||
|
||||
#### Android specific
|
||||
|
||||
- Create a debugOptimized buildType for Android ([5e3edafec6](https://github.com/facebook/react-native/commit/5e3edafec6c69558521061dced7a6bcd046576b0) by [@cortinico](https://github.com/cortinico))
|
||||
- Add `useNativeEqualsInNativeReadableArrayAndroid` and `useNativeTransformHelperAndroid` feature flag to the experimental channel. This should alleviate some of the perf issue users are seeing on Android + Reanimated + NewArch on 0.81([a346096da8](https://github.com/facebook/react-native/commit/a346096da81fccf5fbc82d83bfc128695e6ec3a5) by [@cortinico](https://github.com/cortinico))
|
||||
|
||||
### Fixed
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Fix Node scripts related to prebuilt tarball extraction for paths containing whitespaces ([366f2ad505](https://github.com/facebook/react-native/commit/366f2ad5057ffecc1f5b211f6aae29567ae6b7e5) by [@kitten](https://github.com/kitten))
|
||||
- Use autolinking-generated react-native-config output in second step of cocoapods linking that generates artifacts and generated source ([a2eb29e5e7](https://github.com/facebook/react-native/commit/a2eb29e5e7aef8bbdf4c647c8467b5292b013b20) by [@kitten](https://github.com/kitten))
|
||||
|
||||
## v0.81.1
|
||||
|
||||
### Added
|
||||
@@ -287,7 +245,6 @@
|
||||
- **Infra:** Add missing Babel dependencies ([bf2c3af93b](https://github.com/facebook/react-native/commit/bf2c3af93b146943cb35866fa9badcd188e63f5b) by [@tido64](https://github.com/tido64))
|
||||
- **Accessibility:** fix `aria-label` on `TextInput` ([6965d57e75](https://github.com/facebook/react-native/commit/6965d57e75ed0cf9f265c6020d478ddb9af4bf10) by [@mdjastrzebski](https://github.com/mdjastrzebski))
|
||||
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- **TextInput:** Setting maxLength to 0 in TextInput now correctly blocks typing ([c5956da8c0](https://github.com/facebook/react-native/commit/c5956da8c0b735d47761af51019ed25b49001c00) by [@riteshshukla04](https://github.com/riteshshukla04))
|
||||
@@ -301,7 +258,6 @@
|
||||
- **Prebuild:** Fix "file exists" error in `ReactNativeDependencies.podspec` ([4c570b5d31](https://github.com/facebook/react-native/commit/4c570b5d31ef46e04e5fa26fa92d7f7090bf15e2) by [@vonovak](https://github.com/vonovak))
|
||||
- **Prebuild:** added explicit handling of ReactCodegen ([6526a98d68](https://github.com/facebook/react-native/commit/6526a98d68dbc8578ea15cbf117c0a216c6e9af0) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
|
||||
|
||||
## v0.81.0
|
||||
|
||||
### Breaking
|
||||
|
||||
@@ -4,6 +4,13 @@ org.gradle.caching=true
|
||||
|
||||
android.useAndroidX=true
|
||||
|
||||
# Those 2 properties are needed to make our project compatible with
|
||||
# AGP 9.0.0 for the time being. Ideally we should not opt-out of
|
||||
# builtInKotlin and newDsl once AGP 9.0.0 hits stable.
|
||||
# More on this: https://developer.android.com/build/releases/agp-preview#android-gradle-plugin-built-in-kotlin
|
||||
android.builtInKotlin=false
|
||||
android.newDsl=false
|
||||
|
||||
# Use this property to specify which architecture you want to build.
|
||||
# You can also override it from the CLI using
|
||||
# ./gradlew <task> -PreactNativeArchitectures=x86_64
|
||||
|
||||
+8
-8
@@ -58,8 +58,8 @@
|
||||
"@jest/create-cache-key-function": "^29.7.0",
|
||||
"@microsoft/api-extractor": "^7.52.2",
|
||||
"@octokit/rest": "^22.0.0",
|
||||
"@react-native/metro-babel-transformer": "0.82.0-main",
|
||||
"@react-native/metro-config": "0.82.0-main",
|
||||
"@react-native/metro-babel-transformer": "0.83.0-main",
|
||||
"@react-native/metro-config": "0.83.0-main",
|
||||
"@tsconfig/node22": "22.0.2",
|
||||
"@types/react": "^19.1.0",
|
||||
"@typescript-eslint/parser": "^8.36.0",
|
||||
@@ -86,7 +86,7 @@
|
||||
"eslint-plugin-relay": "^1.8.3",
|
||||
"fb-dotslash": "0.5.8",
|
||||
"flow-api-translator": "0.32.0",
|
||||
"flow-bin": "^0.287.0",
|
||||
"flow-bin": "^0.288.0",
|
||||
"glob": "^7.1.1",
|
||||
"hermes-eslint": "0.32.0",
|
||||
"hermes-transform": "0.32.0",
|
||||
@@ -101,15 +101,15 @@
|
||||
"markdownlint-cli2": "^0.17.2",
|
||||
"markdownlint-rule-relative-links": "^3.0.0",
|
||||
"memfs": "^4.38.2",
|
||||
"metro-babel-register": "^0.83.1",
|
||||
"metro-transform-plugins": "^0.83.1",
|
||||
"metro-babel-register": "^0.83.3",
|
||||
"metro-transform-plugins": "^0.83.3",
|
||||
"micromatch": "^4.0.4",
|
||||
"node-fetch": "^2.2.0",
|
||||
"nullthrows": "^1.1.1",
|
||||
"prettier": "3.6.2",
|
||||
"prettier-plugin-hermes-parser": "0.32.0",
|
||||
"react": "19.1.1",
|
||||
"react-test-renderer": "19.1.1",
|
||||
"react": "19.2.0",
|
||||
"react-test-renderer": "19.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"shelljs": "^0.8.5",
|
||||
"signedsource": "^2.0.0",
|
||||
@@ -121,7 +121,7 @@
|
||||
},
|
||||
"resolutions": {
|
||||
"eslint-plugin-react-hooks": "6.1.0-canary-12bc60f5-20250613",
|
||||
"react-is": "19.1.1",
|
||||
"react-is": "19.2.0",
|
||||
"on-headers": "1.1.0",
|
||||
"compression": "1.8.1"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/assets-registry",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Asset support code for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/babel-plugin-codegen",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Babel plugin to generate native module and view manager code for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -26,7 +26,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/traverse": "^7.25.3",
|
||||
"@react-native/codegen": "0.82.0-main"
|
||||
"@react-native/codegen": "0.83.0-main"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/community-cli-plugin",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Core CLI commands for React Native",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
@@ -22,16 +22,16 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@react-native/dev-middleware": "0.82.0-main",
|
||||
"@react-native/dev-middleware": "0.83.0-main",
|
||||
"debug": "^4.4.0",
|
||||
"invariant": "^2.2.4",
|
||||
"metro": "^0.83.1",
|
||||
"metro-config": "^0.83.1",
|
||||
"metro-core": "^0.83.1",
|
||||
"metro": "^0.83.3",
|
||||
"metro-config": "^0.83.3",
|
||||
"metro-core": "^0.83.3",
|
||||
"semver": "^7.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"metro-resolver": "^0.83.1"
|
||||
"metro-resolver": "^0.83.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-native-community/cli": "*",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/core-cli-utils",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "React Native CLI library for Frameworks to build on",
|
||||
"license": "MIT",
|
||||
"main": "./src/index.flow.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/debugger-frontend",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Debugger frontend for React Native based on Chrome DevTools",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
|
||||
@@ -1,71 +1,71 @@
|
||||
#!/usr/bin/env dotslash
|
||||
|
||||
// @generated SignedSource<<f03dde90e30b4654dc18ba4c688f588e>>
|
||||
// @generated SignedSource<<8b06371489dc8b79c23cbf095568c91a>>
|
||||
|
||||
|
||||
{
|
||||
"name": "React Native DevTools",
|
||||
"platforms": {
|
||||
"linux-aarch64": {
|
||||
"size": 116056498,
|
||||
"size": 116051181,
|
||||
"hash": "sha256",
|
||||
"digest": "74ddbe463a81b57533a87f4301c6a6c74323018f70e4f1dbeed0dfbe2ebab257",
|
||||
"digest": "a6060e1291f9ee7e9feecd511012c041ed2a65c6df6f8ab5aca4d96adbbc9921",
|
||||
"providers": [
|
||||
{
|
||||
"type": "http",
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQNNgo1RofrfkLfx2qh_zLXdyNL54sIiYfd6p9aXIk-1zJ2lV1dpD2p58FTweCN6y3RZcdE_u9U8z16S_xRbtgA0mobHgSK6JASeR3dCLmMAazKXiiSb98rToqI9XAdOc4pJOGhOb2PVQ_c6lzngiOQ0vkyYU7xFENy-7jKKLbqYFSoDgT7RBs4dnbw"
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQOD3-UmqD25MctpnB7Ogj0A8nHDs-SgFnMNFfStIxOajFAFSN93zuoWsLD3ylc3wVuX6-L-ndcMftTd7tlR1ZZWYy4a7g78w4N1UTzIT_z9vdOXpYGe7fZrHXiBHJu0QexD0b54OcdDSEFhh0-7puUTGPnIg3pHhThiU6bf_5AqvGIEYA5FGjih3zY"
|
||||
}
|
||||
],
|
||||
"format": "tar.gz",
|
||||
"path": "React Native DevTools-linux-arm64/React Native DevTools"
|
||||
},
|
||||
"linux-x86_64": {
|
||||
"size": 115924960,
|
||||
"size": 115927343,
|
||||
"hash": "sha256",
|
||||
"digest": "eba05066886fe6cd88b4123ed423ad301fd35b2f12381627b3b22c7955c73333",
|
||||
"digest": "354f6550617d0c6b4bb4478ad085d4efe3671ba9a1b78d90d9bfc003a523cb6d",
|
||||
"providers": [
|
||||
{
|
||||
"type": "http",
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQOXAiG9ivBeW9v9jZMpg7nJZRT1SNBjTz8Nc5_SWUPCUf3xDekbhB6w3lWc8JtfklAzOL5TlJOsvIT3eujx2exadBpcS5NiAnq47KYvcgGP9iVxv5NuRwxttCc3Vncl5CLpGA6-Ifkt1g2-MrdM5yiaSaMKOCDQ83C2Fw07zH6tXt28jsZcTaPj"
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQMVMfCfSykWSI8mB5koUEUtx819xGQGW3Tm1DBpEmjWA_g8C4PoPPDCIPpgJmB5nUKrv081_dtayoArCncyFJVs0ofbxGn0EkaEW2vW3OJ2J0XMH58v5cTLED3dT8TmWwAg6aYUTr0ch8DfVXRxsibYUIWaxJUwOJ-urR-iQm7YPQUboLElaJbM"
|
||||
}
|
||||
],
|
||||
"format": "tar.gz",
|
||||
"path": "React Native DevTools-linux-x64/React Native DevTools"
|
||||
},
|
||||
"macos-aarch64": {
|
||||
"size": 110890882,
|
||||
"size": 110891048,
|
||||
"hash": "sha256",
|
||||
"digest": "f289b7ae3c300b9d744c729a0024e55a2a8d6953a6a8e834d867f705daad1153",
|
||||
"digest": "df41cfce9bc977ef4fdc66c3c892c0eedee5b07aa618550308157c51b8e75561",
|
||||
"providers": [
|
||||
{
|
||||
"type": "http",
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQP4xY72fwAGy3-m2Gx7mPodV90K-GbWYYIZ9_xgI89O0rm5GPmXE0u-C18Vq2h6x3zL479nhS7o9_OonWaISxx6TMYZcZsG9nkqTW3-uWcUi6ndzPNQILwryGVg034jrlmjKLB2CiIRoJvdW37wB_1AWFCOKO9gXRozFKV4ndjGDxDC6HJvbfFTacvX"
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQOGfzOOV_mwg63orI4Hv0VQKQtE5Vk60eSl55gZDd0djjU-lmqddRZm_LxsWsek4xM7qIxqCbw6wGx7zqnrlmQGyfD98n0TBFh3uhVeYP_j3r2UkKci6tqjEqcLTHjFj3agjI6jDEe3fDpZtwKY4UMhXdVP4o1goYq13rG-IQAqIsAm04MnPFOYyp5X"
|
||||
}
|
||||
],
|
||||
"format": "tar.gz",
|
||||
"path": "React Native DevTools.app/Contents/MacOS/React Native DevTools"
|
||||
},
|
||||
"macos-x86_64": {
|
||||
"size": 117778007,
|
||||
"size": 117777930,
|
||||
"hash": "sha256",
|
||||
"digest": "a4698d6c3e2fdfb0c7bafec2130f3701c655468f953af836bf66ce3fe848c6ae",
|
||||
"digest": "96805c51623a163b1d94b501e2e091f403b4c3575063bd7363f8e1550cda8dc5",
|
||||
"providers": [
|
||||
{
|
||||
"type": "http",
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQMpGXCifWF6VrFwv_jM4lw-E8eFi59l776z1OYrS8u3mLluAyA8bUtscEyLwoMitqyjF7or5lPuW7OFyiyZ00bKFxSC5lH6Xo_Sc41cQN5n5hmXCX7Wpku9ilU39_ZWmI95W3_oAacYXA1l6ZmHX2AWlv3jERpywrP4J_RNFBi5UAvOhPFo4LtRXw"
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQNbF-vba13QuctGdSckSWSApEqUne0w8vGceEm5u9VNYqHzwaZu6_T0n12Ml7aHuNgAgU0OOxJKUjcr2DVsNEsjcCYwMqCjZys8yF8NfM39OH1YePjHZCw5jinydbhGxhF1zbJ_zKmuOx1FhJtzCD3CUbLSea7fuhPh6ytLUIu3Ctx4aFQLFtbJZQ"
|
||||
}
|
||||
],
|
||||
"format": "tar.gz",
|
||||
"path": "React Native DevTools.app/Contents/MacOS/React Native DevTools"
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"size": 125528869,
|
||||
"size": 125533589,
|
||||
"hash": "sha256",
|
||||
"digest": "95234a13e6ba55556cff46f3da8af9e57ff1010c5483265cbbd444cad01c4216",
|
||||
"digest": "7f560e6d68b4b917c53ba0518a778a20e267cce55474ad972d345b2738746a52",
|
||||
"providers": [
|
||||
{
|
||||
"type": "http",
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQOJdgsL68PBrM0rJk-WOm-re-8uqKfI1FfcTcAr1hiFSQr2bKBOqQNtHLnEA6JlRvKrwlOp4XTB6y9pC1TISeGo2dG_BYwN9jsVRLzcGWvfnpZ6GR7evVe82-XKS3Ya5YpScRdLycRqrhHuACXXbQ0HNvhNJjBWZtnQ8N3vOFJXn5QOGlobXqYp"
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQPZzccNNBkp1OKt_SPZ-iDoK5LDWyvZhFMgz4oTf9Ja9PlKU7i_5ydAVd714waJteCM1cdAidPN6PumBRs1uK12E9moytEskWXlMPbQObFpaTnkxLn6xp3N5EAKbAXvPfecX41Tz_7HRqh19_hW3XpwXF-VNsAdtn59ApMtX1fpN0peB1l4o57P"
|
||||
}
|
||||
],
|
||||
"format": "tar.gz",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-native/debugger-shell",
|
||||
"productName": "React Native DevTools",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Experimental debugger shell for React Native for use with @react-native/debugger-frontend",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/dev-middleware",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Dev server middleware for React Native",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
@@ -23,8 +23,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@isaacs/ttlcache": "^1.4.1",
|
||||
"@react-native/debugger-frontend": "0.82.0-main",
|
||||
"@react-native/debugger-shell": "0.82.0-main",
|
||||
"@react-native/debugger-frontend": "0.83.0-main",
|
||||
"@react-native/debugger-shell": "0.83.0-main",
|
||||
"chrome-launcher": "^0.15.2",
|
||||
"chromium-edge-launcher": "^0.2.0",
|
||||
"connect": "^3.6.5",
|
||||
@@ -39,7 +39,7 @@
|
||||
"node": ">= 20.19.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native/debugger-shell": "0.82.0-main",
|
||||
"@react-native/debugger-shell": "0.83.0-main",
|
||||
"selfsigned": "^2.4.1",
|
||||
"undici": "^5.29.0",
|
||||
"wait-for-expect": "^3.0.2"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-config",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "ESLint config for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -22,7 +22,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/eslint-parser": "^7.25.1",
|
||||
"@react-native/eslint-plugin": "0.82.0-main",
|
||||
"@react-native/eslint-plugin": "0.83.0-main",
|
||||
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
||||
"@typescript-eslint/parser": "^8.36.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-plugin",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "ESLint rules for @react-native/eslint-config",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-plugin-specs",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "ESLint rules to validate NativeModule and Component Specs",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -26,7 +26,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
|
||||
"@react-native/codegen": "0.82.0-main",
|
||||
"@react-native/codegen": "0.83.0-main",
|
||||
"make-dir": "^2.1.0",
|
||||
"pirates": "^4.0.1",
|
||||
"source-map-support": "0.5.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/gradle-plugin",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Gradle Plugin for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
+1
@@ -100,6 +100,7 @@ internal object AgpConfiguratorUtils {
|
||||
project.extensions
|
||||
.getByType(ApplicationAndroidComponentsExtension::class.java)
|
||||
.finalizeDsl { ext ->
|
||||
ext.buildFeatures.resValues = true
|
||||
ext.defaultConfig.resValue(
|
||||
"string",
|
||||
"react_native_dev_server_ip",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/metro-config",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Metro configuration for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -26,9 +26,9 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@react-native/js-polyfills": "0.82.0-main",
|
||||
"@react-native/metro-babel-transformer": "0.82.0-main",
|
||||
"metro-config": "^0.83.1",
|
||||
"metro-runtime": "^0.83.1"
|
||||
"@react-native/js-polyfills": "0.83.0-main",
|
||||
"@react-native/metro-babel-transformer": "0.83.0-main",
|
||||
"metro-config": "^0.83.3",
|
||||
"metro-runtime": "^0.83.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/new-app-screen",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "NewAppScreen component for React Native",
|
||||
"keywords": [
|
||||
"react-native"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/normalize-colors",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Color normalization for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/js-polyfills",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Polyfills for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/babel-preset",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Babel preset for React Native applications",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -66,7 +66,7 @@
|
||||
"@babel/plugin-transform-typescript": "^7.25.2",
|
||||
"@babel/plugin-transform-unicode-regex": "^7.24.7",
|
||||
"@babel/template": "^7.25.0",
|
||||
"@react-native/babel-plugin-codegen": "0.82.0-main",
|
||||
"@react-native/babel-plugin-codegen": "0.83.0-main",
|
||||
"babel-plugin-syntax-hermes-parser": "0.32.0",
|
||||
"babel-plugin-transform-flow-enums": "^0.0.2",
|
||||
"react-refresh": "^0.14.0"
|
||||
|
||||
+11
-2
@@ -20,6 +20,10 @@ const EXCLUDED_FIRST_PARTY_PATHS = [
|
||||
/[/\\]private[/\\]react-native-fantom[/\\]/,
|
||||
];
|
||||
|
||||
// customTransformOptions may be strings from URL params, or booleans passed
|
||||
// programatically. For strings, handle them as Metro does when parsing URLs.
|
||||
const TRUE_VALS = new Set([true, 'true', '1']);
|
||||
|
||||
function isTypeScriptSource(fileName) {
|
||||
return !!fileName && fileName.endsWith('.ts');
|
||||
}
|
||||
@@ -55,6 +59,9 @@ const getPreset = (src, options) => {
|
||||
|
||||
const isNull = src == null;
|
||||
const hasClass = isNull || src.indexOf('class') !== -1;
|
||||
const preserveClasses = TRUE_VALS.has(
|
||||
options?.customTransformOptions?.unstable_preserveClasses,
|
||||
);
|
||||
|
||||
const extraPlugins = [];
|
||||
const firstPartyPlugins = [];
|
||||
@@ -91,7 +98,7 @@ const getPreset = (src, options) => {
|
||||
);
|
||||
}
|
||||
|
||||
if (hasClass) {
|
||||
if (hasClass && !preserveClasses) {
|
||||
extraPlugins.push([require('@babel/plugin-transform-classes')]);
|
||||
}
|
||||
|
||||
@@ -235,7 +242,9 @@ const getPreset = (src, options) => {
|
||||
],
|
||||
[require('babel-plugin-transform-flow-enums')],
|
||||
[require('@babel/plugin-transform-block-scoping')],
|
||||
[require('@babel/plugin-transform-class-properties'), {loose}],
|
||||
...(preserveClasses
|
||||
? []
|
||||
: [[require('@babel/plugin-transform-class-properties'), {loose}]]),
|
||||
[require('@babel/plugin-transform-private-methods'), {loose}],
|
||||
[
|
||||
require('@babel/plugin-transform-private-property-in-object'),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/metro-babel-transformer",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Babel transformer for React Native applications.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -27,7 +27,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@react-native/babel-preset": "0.82.0-main",
|
||||
"@react-native/babel-preset": "0.83.0-main",
|
||||
"hermes-parser": "0.32.0",
|
||||
"nullthrows": "^1.1.1"
|
||||
},
|
||||
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {SchemaType} from '../../../../src/CodegenSchema';
|
||||
|
||||
const generator = require('../../../../src/generators/modules/GenerateModuleCpp');
|
||||
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
||||
const fs = require('fs');
|
||||
|
||||
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/modules`;
|
||||
|
||||
const parser = new FlowParser();
|
||||
|
||||
function getModules(): SchemaType {
|
||||
const filenames: Array<string> = fs.readdirSync(FIXTURE_DIR);
|
||||
return filenames.reduce<SchemaType>(
|
||||
(accumulator, file) => {
|
||||
const schema = parser.parseFile(`${FIXTURE_DIR}/${file}`);
|
||||
return {
|
||||
modules: {
|
||||
...accumulator.modules,
|
||||
...schema.modules,
|
||||
},
|
||||
};
|
||||
},
|
||||
{modules: {}},
|
||||
);
|
||||
}
|
||||
|
||||
describe('GenerateModuleCpp', () => {
|
||||
it('can generate an implementation file NativeModule specs', () => {
|
||||
const libName = 'RNCodegenModuleFixtures';
|
||||
const output = generator.generate(libName, getModules(), undefined, false);
|
||||
expect(output.get(libName + 'JSI-generated.cpp')).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('can generate a header file NativeModule specs with assume nonnull enabled', () => {
|
||||
const libName = 'RNCodegenModuleFixtures';
|
||||
const output = generator.generate(libName, getModules(), undefined, true);
|
||||
expect(output.get(libName + 'JSI-generated.cpp')).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
-1643
File diff suppressed because it is too large
Load Diff
+1696
-2762
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/codegen",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Code generation tools for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -36,7 +36,6 @@ const generateTests = require('./components/GenerateTests.js');
|
||||
const generateThirdPartyFabricComponentsProviderH = require('./components/GenerateThirdPartyFabricComponentsProviderH.js');
|
||||
const generateThirdPartyFabricComponentsProviderObjCpp = require('./components/GenerateThirdPartyFabricComponentsProviderObjCpp.js');
|
||||
const generateViewConfigJs = require('./components/GenerateViewConfigJs.js');
|
||||
const generateModuleCpp = require('./modules/GenerateModuleCpp.js');
|
||||
const generateModuleH = require('./modules/GenerateModuleH.js');
|
||||
const generateModuleJavaSpec = require('./modules/GenerateModuleJavaSpec.js');
|
||||
const generateModuleJniCpp = require('./modules/GenerateModuleJniCpp.js');
|
||||
@@ -56,7 +55,6 @@ const ALL_GENERATORS = {
|
||||
generateStateCpp: generateStateCpp.generate,
|
||||
generateStateH: generateStateH.generate,
|
||||
generateModuleH: generateModuleH.generate,
|
||||
generateModuleCpp: generateModuleCpp.generate,
|
||||
generateModuleObjCpp: generateModuleObjCpp.generate,
|
||||
generateModuleJavaSpec: generateModuleJavaSpec.generate,
|
||||
generateModuleJniCpp: generateModuleJniCpp.generate,
|
||||
@@ -179,7 +177,7 @@ const LIBRARY_GENERATORS: LibraryGeneratorsFunctions = {
|
||||
generateModuleJniH.generate,
|
||||
generateModuleJavaSpec.generate,
|
||||
],
|
||||
modulesCxx: [generateModuleCpp.generate, generateModuleH.generate],
|
||||
modulesCxx: [generateModuleH.generate],
|
||||
modulesIOS: [generateModuleObjCpp.generate],
|
||||
tests: [generateTests.generate],
|
||||
'shadow-nodes': [
|
||||
|
||||
@@ -1,296 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {
|
||||
NamedShape,
|
||||
NativeModuleEnumMap,
|
||||
NativeModuleFunctionTypeAnnotation,
|
||||
NativeModuleParamTypeAnnotation,
|
||||
NativeModulePropertyShape,
|
||||
NativeModuleTypeAnnotation,
|
||||
Nullable,
|
||||
SchemaType,
|
||||
} from '../../CodegenSchema';
|
||||
import type {AliasResolver} from './Utils';
|
||||
|
||||
const {unwrapNullable} = require('../../parsers/parsers-commons');
|
||||
const {createAliasResolver, getModules} = require('./Utils');
|
||||
|
||||
type FilesOutput = Map<string, string>;
|
||||
|
||||
const HostFunctionTemplate = ({
|
||||
hasteModuleName,
|
||||
methodName,
|
||||
returnTypeAnnotation,
|
||||
args,
|
||||
}: $ReadOnly<{
|
||||
hasteModuleName: string,
|
||||
methodName: string,
|
||||
returnTypeAnnotation: Nullable<NativeModuleTypeAnnotation>,
|
||||
args: Array<string>,
|
||||
}>) => {
|
||||
const isNullable = returnTypeAnnotation.type === 'NullableTypeAnnotation';
|
||||
const isVoid = returnTypeAnnotation.type === 'VoidTypeAnnotation';
|
||||
const methodCallArgs = [' rt', ...args].join(',\n ');
|
||||
const methodCall = `static_cast<${hasteModuleName}CxxSpecJSI *>(&turboModule)->${methodName}(\n${methodCallArgs}\n )`;
|
||||
|
||||
return `static jsi::Value __hostFunction_${hasteModuleName}CxxSpecJSI_${methodName}(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {${
|
||||
isVoid
|
||||
? `\n ${methodCall};`
|
||||
: isNullable
|
||||
? `\n auto result = ${methodCall};`
|
||||
: ''
|
||||
}
|
||||
return ${
|
||||
isVoid
|
||||
? 'jsi::Value::undefined()'
|
||||
: isNullable
|
||||
? 'result ? jsi::Value(std::move(*result)) : jsi::Value::null()'
|
||||
: methodCall
|
||||
};
|
||||
}`;
|
||||
};
|
||||
|
||||
const ModuleTemplate = ({
|
||||
hasteModuleName,
|
||||
hostFunctions,
|
||||
moduleName,
|
||||
methods,
|
||||
}: $ReadOnly<{
|
||||
hasteModuleName: string,
|
||||
hostFunctions: $ReadOnlyArray<string>,
|
||||
moduleName: string,
|
||||
methods: $ReadOnlyArray<$ReadOnly<{methodName: string, paramCount: number}>>,
|
||||
}>) => {
|
||||
return `${hostFunctions.join('\n')}
|
||||
|
||||
${hasteModuleName}CxxSpecJSI::${hasteModuleName}CxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule("${moduleName}", jsInvoker) {
|
||||
${methods
|
||||
.map(({methodName, paramCount}) => {
|
||||
return ` methodMap_["${methodName}"] = MethodMetadata {${paramCount}, __hostFunction_${hasteModuleName}CxxSpecJSI_${methodName}};`;
|
||||
})
|
||||
.join('\n')}
|
||||
}`;
|
||||
};
|
||||
|
||||
const FileTemplate = ({
|
||||
libraryName,
|
||||
modules,
|
||||
}: $ReadOnly<{
|
||||
libraryName: string,
|
||||
modules: string,
|
||||
}>) => {
|
||||
return `/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* ${'@'}generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include "${libraryName}JSI.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
${modules}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
`;
|
||||
};
|
||||
|
||||
type Param = NamedShape<Nullable<NativeModuleParamTypeAnnotation>>;
|
||||
|
||||
function serializeArg(
|
||||
moduleName: string,
|
||||
arg: Param,
|
||||
index: number,
|
||||
resolveAlias: AliasResolver,
|
||||
enumMap: NativeModuleEnumMap,
|
||||
): string {
|
||||
const {typeAnnotation: nullableTypeAnnotation, optional} = arg;
|
||||
const [typeAnnotation, nullable] =
|
||||
unwrapNullable<NativeModuleParamTypeAnnotation>(nullableTypeAnnotation);
|
||||
|
||||
let realTypeAnnotation = typeAnnotation;
|
||||
if (realTypeAnnotation.type === 'TypeAliasTypeAnnotation') {
|
||||
realTypeAnnotation = resolveAlias(realTypeAnnotation.name);
|
||||
}
|
||||
|
||||
function wrap(callback: (val: string) => string) {
|
||||
const val = `args[${index}]`;
|
||||
const expression = callback(val);
|
||||
|
||||
// param?: T
|
||||
if (optional && !nullable) {
|
||||
// throw new Error('are we hitting this case? ' + moduleName);
|
||||
return `count <= ${index} || ${val}.isUndefined() ? std::nullopt : std::make_optional(${expression})`;
|
||||
}
|
||||
|
||||
// param: ?T
|
||||
// param?: ?T
|
||||
if (nullable || optional) {
|
||||
return `count <= ${index} || ${val}.isNull() || ${val}.isUndefined() ? std::nullopt : std::make_optional(${expression})`;
|
||||
}
|
||||
|
||||
// param: T
|
||||
return `count <= ${index} ? throw jsi::JSError(rt, "Expected argument in position ${index} to be passed") : ${expression}`;
|
||||
}
|
||||
|
||||
switch (realTypeAnnotation.type) {
|
||||
case 'ReservedTypeAnnotation':
|
||||
switch (realTypeAnnotation.name) {
|
||||
case 'RootTag':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
default:
|
||||
(realTypeAnnotation.name: empty);
|
||||
throw new Error(
|
||||
`Unknown prop type for "${arg.name}, found: ${realTypeAnnotation.name}"`,
|
||||
);
|
||||
}
|
||||
case 'StringTypeAnnotation':
|
||||
return wrap(val => `${val}.asString(rt)`);
|
||||
case 'StringLiteralTypeAnnotation':
|
||||
return wrap(val => `${val}.asString(rt)`);
|
||||
case 'StringLiteralUnionTypeAnnotation':
|
||||
return wrap(val => `${val}.asString(rt)`);
|
||||
case 'BooleanTypeAnnotation':
|
||||
return wrap(val => `${val}.asBool()`);
|
||||
case 'EnumDeclaration':
|
||||
switch (realTypeAnnotation.memberType) {
|
||||
case 'NumberTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'StringTypeAnnotation':
|
||||
return wrap(val => `${val}.asString(rt)`);
|
||||
default:
|
||||
throw new Error(
|
||||
`Unknown enum type for "${arg.name}, found: ${realTypeAnnotation.type}"`,
|
||||
);
|
||||
}
|
||||
case 'NumberTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'FloatTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'DoubleTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'Int32TypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'NumberLiteralTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'ArrayTypeAnnotation':
|
||||
return wrap(val => `${val}.asObject(rt).asArray(rt)`);
|
||||
case 'FunctionTypeAnnotation':
|
||||
return wrap(val => `${val}.asObject(rt).asFunction(rt)`);
|
||||
case 'GenericObjectTypeAnnotation':
|
||||
return wrap(val => `${val}.asObject(rt)`);
|
||||
case 'UnionTypeAnnotation':
|
||||
switch (typeAnnotation.memberType) {
|
||||
case 'NumberTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'ObjectTypeAnnotation':
|
||||
return wrap(val => `${val}.asObject(rt)`);
|
||||
case 'StringTypeAnnotation':
|
||||
return wrap(val => `${val}.asString(rt)`);
|
||||
default:
|
||||
throw new Error(
|
||||
`Unsupported union member type for param "${arg.name}, found: ${realTypeAnnotation.memberType}"`,
|
||||
);
|
||||
}
|
||||
case 'ObjectTypeAnnotation':
|
||||
return wrap(val => `${val}.asObject(rt)`);
|
||||
case 'MixedTypeAnnotation':
|
||||
return wrap(val => `jsi::Value(rt, ${val})`);
|
||||
default:
|
||||
(realTypeAnnotation.type: empty);
|
||||
throw new Error(
|
||||
`Unknown prop type for "${arg.name}, found: ${realTypeAnnotation.type}"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function serializePropertyIntoHostFunction(
|
||||
moduleName: string,
|
||||
hasteModuleName: string,
|
||||
property: NativeModulePropertyShape,
|
||||
resolveAlias: AliasResolver,
|
||||
enumMap: NativeModuleEnumMap,
|
||||
): string {
|
||||
const [propertyTypeAnnotation] =
|
||||
unwrapNullable<NativeModuleFunctionTypeAnnotation>(property.typeAnnotation);
|
||||
|
||||
return HostFunctionTemplate({
|
||||
hasteModuleName,
|
||||
methodName: property.name,
|
||||
returnTypeAnnotation: propertyTypeAnnotation.returnTypeAnnotation,
|
||||
args: propertyTypeAnnotation.params.map((p, i) =>
|
||||
serializeArg(moduleName, p, i, resolveAlias, enumMap),
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generate(
|
||||
libraryName: string,
|
||||
schema: SchemaType,
|
||||
packageName?: string,
|
||||
assumeNonnull: boolean = false,
|
||||
headerPrefix?: string,
|
||||
): FilesOutput {
|
||||
const nativeModules = getModules(schema);
|
||||
|
||||
const modules = Object.keys(nativeModules)
|
||||
.map((hasteModuleName: string) => {
|
||||
const nativeModule = nativeModules[hasteModuleName];
|
||||
const {
|
||||
aliasMap,
|
||||
enumMap,
|
||||
spec: {methods},
|
||||
moduleName,
|
||||
} = nativeModule;
|
||||
const resolveAlias = createAliasResolver(aliasMap);
|
||||
const hostFunctions = methods.map(property =>
|
||||
serializePropertyIntoHostFunction(
|
||||
moduleName,
|
||||
hasteModuleName,
|
||||
property,
|
||||
resolveAlias,
|
||||
enumMap,
|
||||
),
|
||||
);
|
||||
|
||||
return ModuleTemplate({
|
||||
hasteModuleName,
|
||||
hostFunctions,
|
||||
moduleName,
|
||||
methods: methods.map(
|
||||
({name: propertyName, typeAnnotation: nullableTypeAnnotation}) => {
|
||||
const [{params}] = unwrapNullable(nullableTypeAnnotation);
|
||||
return {
|
||||
methodName: propertyName,
|
||||
paramCount: params.length,
|
||||
};
|
||||
},
|
||||
),
|
||||
});
|
||||
})
|
||||
.join('\n');
|
||||
|
||||
const fileName = `${libraryName}JSI-generated.cpp`;
|
||||
const replacedTemplate = FileTemplate({
|
||||
modules,
|
||||
libraryName,
|
||||
});
|
||||
return new Map([[fileName, replacedTemplate]]);
|
||||
},
|
||||
};
|
||||
@@ -9,17 +9,17 @@
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {
|
||||
NamedShape,
|
||||
NativeModuleBaseTypeAnnotation,
|
||||
} from '../../CodegenSchema';
|
||||
import type {
|
||||
NativeModuleAliasMap,
|
||||
NativeModuleBaseTypeAnnotation,
|
||||
NativeModuleEnumMap,
|
||||
NativeModuleEnumMember,
|
||||
NativeModuleEnumMemberType,
|
||||
NativeModuleEventEmitterShape,
|
||||
NativeModuleFunctionTypeAnnotation,
|
||||
NativeModuleParamTypeAnnotation,
|
||||
NativeModulePropertyShape,
|
||||
NativeModuleTypeAnnotation,
|
||||
Nullable,
|
||||
@@ -30,7 +30,6 @@ import type {AliasResolver} from './Utils';
|
||||
const {unwrapNullable} = require('../../parsers/parsers-commons');
|
||||
const {wrapOptional} = require('../TypeUtils/Cxx');
|
||||
const {getEnumName, toPascalCase, toSafeCppString} = require('../Utils');
|
||||
const {indent} = require('../Utils');
|
||||
const {
|
||||
createAliasResolver,
|
||||
getModules,
|
||||
@@ -40,74 +39,151 @@ const {
|
||||
|
||||
type FilesOutput = Map<string, string>;
|
||||
|
||||
const ModuleClassDeclarationTemplate = ({
|
||||
hasteModuleName,
|
||||
moduleProperties,
|
||||
structs,
|
||||
enums,
|
||||
}: $ReadOnly<{
|
||||
hasteModuleName: string,
|
||||
moduleProperties: string[],
|
||||
structs: string,
|
||||
enums: string,
|
||||
}>) => {
|
||||
return `${enums}
|
||||
${structs}class JSI_EXPORT ${hasteModuleName}CxxSpecJSI : public TurboModule {
|
||||
protected:
|
||||
${hasteModuleName}CxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
||||
type Param = NamedShape<Nullable<NativeModuleParamTypeAnnotation>>;
|
||||
|
||||
public:
|
||||
${indent(moduleProperties.join('\n'), 2)}
|
||||
function serializeArg(
|
||||
moduleName: string,
|
||||
arg: Param,
|
||||
index: number,
|
||||
resolveAlias: AliasResolver,
|
||||
enumMap: NativeModuleEnumMap,
|
||||
): string {
|
||||
const {typeAnnotation: nullableTypeAnnotation, optional} = arg;
|
||||
const [typeAnnotation, nullable] =
|
||||
unwrapNullable<NativeModuleParamTypeAnnotation>(nullableTypeAnnotation);
|
||||
|
||||
};`;
|
||||
};
|
||||
let realTypeAnnotation = typeAnnotation;
|
||||
if (realTypeAnnotation.type === 'TypeAliasTypeAnnotation') {
|
||||
realTypeAnnotation = resolveAlias(realTypeAnnotation.name);
|
||||
}
|
||||
|
||||
function wrap(callback: (val: string) => string) {
|
||||
const val = `args[${index}]`;
|
||||
const expression = callback(val);
|
||||
|
||||
// param?: T
|
||||
if (optional && !nullable) {
|
||||
// throw new Error('are we hitting this case? ' + moduleName);
|
||||
return `count <= ${index} || ${val}.isUndefined() ? std::nullopt : std::make_optional(${expression})`;
|
||||
}
|
||||
|
||||
// param: ?T
|
||||
// param?: ?T
|
||||
if (nullable || optional) {
|
||||
return `count <= ${index} || ${val}.isNull() || ${val}.isUndefined() ? std::nullopt : std::make_optional(${expression})`;
|
||||
}
|
||||
|
||||
// param: T
|
||||
return `count <= ${index} ? throw jsi::JSError(rt, "Expected argument in position ${index} to be passed") : ${expression}`;
|
||||
}
|
||||
|
||||
switch (realTypeAnnotation.type) {
|
||||
case 'ReservedTypeAnnotation':
|
||||
switch (realTypeAnnotation.name) {
|
||||
case 'RootTag':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
default:
|
||||
(realTypeAnnotation.name: empty);
|
||||
throw new Error(
|
||||
`Unknown prop type for "${arg.name}, found: ${realTypeAnnotation.name}"`,
|
||||
);
|
||||
}
|
||||
case 'StringTypeAnnotation':
|
||||
return wrap(val => `${val}.asString(rt)`);
|
||||
case 'StringLiteralTypeAnnotation':
|
||||
return wrap(val => `${val}.asString(rt)`);
|
||||
case 'StringLiteralUnionTypeAnnotation':
|
||||
return wrap(val => `${val}.asString(rt)`);
|
||||
case 'BooleanTypeAnnotation':
|
||||
return wrap(val => `${val}.asBool()`);
|
||||
case 'EnumDeclaration':
|
||||
switch (realTypeAnnotation.memberType) {
|
||||
case 'NumberTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'StringTypeAnnotation':
|
||||
return wrap(val => `${val}.asString(rt)`);
|
||||
default:
|
||||
throw new Error(
|
||||
`Unknown enum type for "${arg.name}, found: ${realTypeAnnotation.type}"`,
|
||||
);
|
||||
}
|
||||
case 'NumberTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'FloatTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'DoubleTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'Int32TypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'NumberLiteralTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'ArrayTypeAnnotation':
|
||||
return wrap(val => `${val}.asObject(rt).asArray(rt)`);
|
||||
case 'FunctionTypeAnnotation':
|
||||
return wrap(val => `${val}.asObject(rt).asFunction(rt)`);
|
||||
case 'GenericObjectTypeAnnotation':
|
||||
return wrap(val => `${val}.asObject(rt)`);
|
||||
case 'UnionTypeAnnotation':
|
||||
switch (typeAnnotation.memberType) {
|
||||
case 'NumberTypeAnnotation':
|
||||
return wrap(val => `${val}.asNumber()`);
|
||||
case 'ObjectTypeAnnotation':
|
||||
return wrap(val => `${val}.asObject(rt)`);
|
||||
case 'StringTypeAnnotation':
|
||||
return wrap(val => `${val}.asString(rt)`);
|
||||
default:
|
||||
throw new Error(
|
||||
`Unsupported union member type for param "${arg.name}, found: ${realTypeAnnotation.memberType}"`,
|
||||
);
|
||||
}
|
||||
case 'ObjectTypeAnnotation':
|
||||
return wrap(val => `${val}.asObject(rt)`);
|
||||
case 'MixedTypeAnnotation':
|
||||
return wrap(val => `jsi::Value(rt, ${val})`);
|
||||
default:
|
||||
(realTypeAnnotation.type: empty);
|
||||
throw new Error(
|
||||
`Unknown prop type for "${arg.name}, found: ${realTypeAnnotation.type}"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const ModuleSpecClassDeclarationTemplate = ({
|
||||
hasteModuleName,
|
||||
moduleName,
|
||||
structs,
|
||||
enums,
|
||||
moduleEventEmitters,
|
||||
moduleProperties,
|
||||
moduleFunctions,
|
||||
methods,
|
||||
}: $ReadOnly<{
|
||||
hasteModuleName: string,
|
||||
moduleName: string,
|
||||
structs: string,
|
||||
enums: string,
|
||||
moduleEventEmitters: EventEmitterCpp[],
|
||||
moduleProperties: string[],
|
||||
moduleFunctions: string[],
|
||||
methods: $ReadOnlyArray<$ReadOnly<{methodName: string, paramCount: number}>>,
|
||||
}>) => {
|
||||
return `template <typename T>
|
||||
return `${enums}${structs}
|
||||
template <typename T>
|
||||
class JSI_EXPORT ${hasteModuleName}CxxSpec : public TurboModule {
|
||||
public:
|
||||
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
||||
return delegate_.create(rt, propName);
|
||||
}
|
||||
|
||||
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
||||
return delegate_.getPropertyNames(runtime);
|
||||
}
|
||||
|
||||
static constexpr std::string_view kModuleName = "${moduleName}";
|
||||
|
||||
protected:
|
||||
${hasteModuleName}CxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(std::string{${hasteModuleName}CxxSpec::kModuleName}, jsInvoker),
|
||||
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
||||
${moduleEventEmitters.map(e => e.emitFunction).join('\n')}
|
||||
|
||||
${hasteModuleName}CxxSpec(std::shared_ptr<CallInvoker> jsInvoker) : TurboModule(std::string{${hasteModuleName}CxxSpec::kModuleName}, jsInvoker) {
|
||||
${methods
|
||||
.map(({methodName, paramCount}) => {
|
||||
return ` methodMap_["${methodName}"] = MethodMetadata {.argCount = ${paramCount}, .invoker = __${methodName}};`;
|
||||
})
|
||||
.join(
|
||||
'\n',
|
||||
)}${moduleEventEmitters.length > 0 ? '\n' : ''}${moduleEventEmitters.map(e => e.registerEventEmitter).join('\n')}
|
||||
}
|
||||
${moduleEventEmitters.map(e => e.emitFunction).join('\n')}
|
||||
private:
|
||||
class Delegate : public ${hasteModuleName}CxxSpecJSI {
|
||||
public:
|
||||
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
||||
${hasteModuleName}CxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
||||
${moduleEventEmitters.map(e => e.registerEventEmitter).join('\n')}
|
||||
}
|
||||
|
||||
${indent(moduleProperties.join('\n'), 4)}
|
||||
|
||||
private:
|
||||
friend class ${hasteModuleName}CxxSpec;
|
||||
T *instance_;
|
||||
};
|
||||
|
||||
Delegate delegate_;
|
||||
${moduleFunctions.join('\n\n')}
|
||||
};`;
|
||||
};
|
||||
|
||||
@@ -292,7 +368,7 @@ function createStructsString(
|
||||
return bridging::toJs(rt, value);
|
||||
}`,
|
||||
)
|
||||
.join('\n\n');
|
||||
.join('\n');
|
||||
return `
|
||||
#pragma mark - ${structName}
|
||||
|
||||
@@ -476,19 +552,19 @@ function createEnums(
|
||||
.join('\n');
|
||||
}
|
||||
|
||||
function translatePropertyToCpp(
|
||||
function translateFunctionToCpp(
|
||||
hasteModuleName: string,
|
||||
prop: NativeModulePropertyShape,
|
||||
resolveAlias: AliasResolver,
|
||||
enumMap: NativeModuleEnumMap,
|
||||
abstract: boolean = false,
|
||||
args: Array<string>,
|
||||
returnTypeAnnotation: Nullable<NativeModuleTypeAnnotation>,
|
||||
): string {
|
||||
const [propTypeAnnotation] =
|
||||
unwrapNullable<NativeModuleFunctionTypeAnnotation>(prop.typeAnnotation);
|
||||
|
||||
const params = propTypeAnnotation.params.map(
|
||||
param => `std::move(${param.name})`,
|
||||
);
|
||||
const isNullable = returnTypeAnnotation.type === 'NullableTypeAnnotation';
|
||||
const isVoid = returnTypeAnnotation.type === 'VoidTypeAnnotation';
|
||||
|
||||
const paramTypes = propTypeAnnotation.params.map(param => {
|
||||
const translatedParam = translatePrimitiveJSTypeToCpp(
|
||||
@@ -503,6 +579,7 @@ function translatePropertyToCpp(
|
||||
);
|
||||
return `${translatedParam} ${param.name}`;
|
||||
});
|
||||
paramTypes.unshift('jsi::Runtime &rt');
|
||||
|
||||
const returnType = translatePrimitiveJSTypeToCpp(
|
||||
hasteModuleName,
|
||||
@@ -514,23 +591,16 @@ function translatePropertyToCpp(
|
||||
enumMap,
|
||||
);
|
||||
|
||||
// The first param will always be the runtime reference.
|
||||
paramTypes.unshift('jsi::Runtime &rt');
|
||||
|
||||
const method = `${returnType} ${prop.name}(${paramTypes.join(', ')})`;
|
||||
|
||||
if (abstract) {
|
||||
return `virtual ${method} = 0;`;
|
||||
let methodCallArgs = [...args].join(',\n ');
|
||||
if (methodCallArgs.length > 0) {
|
||||
methodCallArgs = `,\n ${methodCallArgs}`;
|
||||
}
|
||||
|
||||
return `${method} override {
|
||||
static_assert(
|
||||
return ` static jsi::Value __${prop.name}(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* ${args.length > 0 ? 'args' : '/*args*/'}, size_t ${args.length > 0 ? 'count' : '/*count*/'}) {
|
||||
static_assert(
|
||||
bridging::getParameterCount(&T::${prop.name}) == ${paramTypes.length},
|
||||
"Expected ${prop.name}(...) to have ${paramTypes.length} parameters");
|
||||
|
||||
return bridging::callFromJs<${returnType}>(
|
||||
rt, &T::${prop.name}, jsInvoker_, ${['instance_', ...params].join(', ')});
|
||||
}`;
|
||||
${!isVoid ? (!isNullable ? 'return ' : 'auto result = ') : ''}bridging::callFromJs<${returnType}>(rt, &T::${prop.name}, static_cast<${hasteModuleName}CxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule)${methodCallArgs});${!isVoid ? (!isNullable ? '' : 'return result ? jsi::Value(std::move(*result)) : jsi::Value::null();') : 'return jsi::Value::undefined();'}\n }`;
|
||||
}
|
||||
|
||||
type EventEmitterCpp = {
|
||||
@@ -563,7 +633,7 @@ function translateEventEmitterToCpp(
|
||||
return {
|
||||
isVoidTypeAnnotation: isVoidTypeAnnotation,
|
||||
templateName: isVoidTypeAnnotation ? `/*${templateName}*/` : templateName,
|
||||
registerEventEmitter: ` eventEmitterMap_["${
|
||||
registerEventEmitter: ` eventEmitterMap_["${
|
||||
eventEmitter.name
|
||||
}"] = std::make_shared<AsyncEventEmitter<${
|
||||
isVoidTypeAnnotation ? '' : 'jsi::Value'
|
||||
@@ -585,7 +655,7 @@ function translateEventEmitterToCpp(
|
||||
}
|
||||
static_cast<AsyncEventEmitter<${
|
||||
isVoidTypeAnnotation ? '' : 'jsi::Value'
|
||||
}>&>(*delegate_.eventEmitterMap_["${eventEmitter.name}"]).emit(${
|
||||
}>&>(*eventEmitterMap_["${eventEmitter.name}"]).emit(${
|
||||
isVoidTypeAnnotation
|
||||
? ''
|
||||
: `[jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
||||
@@ -607,8 +677,14 @@ module.exports = {
|
||||
const nativeModules = getModules(schema);
|
||||
|
||||
const modules = Object.keys(nativeModules).flatMap(hasteModuleName => {
|
||||
const {aliasMap, enumMap, spec, moduleName} =
|
||||
nativeModules[hasteModuleName];
|
||||
const nativeModule = nativeModules[hasteModuleName];
|
||||
const {
|
||||
aliasMap,
|
||||
enumMap,
|
||||
spec: {methods},
|
||||
spec,
|
||||
moduleName,
|
||||
} = nativeModule;
|
||||
const resolveAlias = createAliasResolver(aliasMap);
|
||||
const structs = createStructsString(
|
||||
hasteModuleName,
|
||||
@@ -617,25 +693,12 @@ module.exports = {
|
||||
enumMap,
|
||||
);
|
||||
const enums = createEnums(hasteModuleName, enumMap, resolveAlias);
|
||||
|
||||
return [
|
||||
ModuleClassDeclarationTemplate({
|
||||
hasteModuleName,
|
||||
moduleProperties: spec.methods.map(prop =>
|
||||
translatePropertyToCpp(
|
||||
hasteModuleName,
|
||||
prop,
|
||||
resolveAlias,
|
||||
enumMap,
|
||||
true,
|
||||
),
|
||||
),
|
||||
structs,
|
||||
enums,
|
||||
}),
|
||||
ModuleSpecClassDeclarationTemplate({
|
||||
hasteModuleName,
|
||||
moduleName,
|
||||
structs,
|
||||
enums,
|
||||
moduleEventEmitters: spec.eventEmitters.map(eventEmitter =>
|
||||
translateEventEmitterToCpp(
|
||||
moduleName,
|
||||
@@ -644,13 +707,30 @@ module.exports = {
|
||||
enumMap,
|
||||
),
|
||||
),
|
||||
moduleProperties: spec.methods.map(prop =>
|
||||
translatePropertyToCpp(
|
||||
moduleFunctions: spec.methods.map(property => {
|
||||
const [propertyTypeAnnotation] =
|
||||
unwrapNullable<NativeModuleFunctionTypeAnnotation>(
|
||||
property.typeAnnotation,
|
||||
);
|
||||
return translateFunctionToCpp(
|
||||
hasteModuleName,
|
||||
prop,
|
||||
property,
|
||||
resolveAlias,
|
||||
enumMap,
|
||||
),
|
||||
propertyTypeAnnotation.params.map((p, i) =>
|
||||
serializeArg(moduleName, p, i, resolveAlias, enumMap),
|
||||
),
|
||||
propertyTypeAnnotation.returnTypeAnnotation,
|
||||
);
|
||||
}),
|
||||
methods: methods.map(
|
||||
({name: propertyName, typeAnnotation: nullableTypeAnnotation}) => {
|
||||
const [{params}] = unwrapNullable(nullableTypeAnnotation);
|
||||
return {
|
||||
methodName: propertyName,
|
||||
paramCount: params.length,
|
||||
};
|
||||
},
|
||||
),
|
||||
}),
|
||||
];
|
||||
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const fixtures = require('../__test_fixtures__/fixtures.js');
|
||||
const generator = require('../GenerateModuleCpp.js');
|
||||
|
||||
describe('GenerateModuleCpp', () => {
|
||||
Object.keys(fixtures)
|
||||
.sort()
|
||||
.forEach(fixtureName => {
|
||||
const fixture = fixtures[fixtureName];
|
||||
|
||||
it(`can generate fixture ${fixtureName}`, () => {
|
||||
expect(
|
||||
generator.generate(
|
||||
fixtureName,
|
||||
fixture,
|
||||
'com.facebook.fbreact.specs',
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
-782
@@ -1,782 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture SampleWithUppercaseName 1`] = `
|
||||
Map {
|
||||
"SampleWithUppercaseNameJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"SampleWithUppercaseNameJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
|
||||
|
||||
NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"SampleTurboModule\\", jsInvoker) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture complex_objects 1`] = `
|
||||
Map {
|
||||
"complex_objectsJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"complex_objectsJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_difficult(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->difficult(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_optionals(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->optionals(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_optionalMethod(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->optionalMethod(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt),
|
||||
count <= 1 ? throw jsi::JSError(rt, \\"Expected argument in position 1 to be passed\\") : args[1].asObject(rt).asFunction(rt),
|
||||
count <= 2 || args[2].isUndefined() ? std::nullopt : std::make_optional(args[2].asObject(rt).asArray(rt))
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getArrays(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getArrays(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNullableObject(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
auto result = static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getNullableObject(
|
||||
rt
|
||||
);
|
||||
return result ? jsi::Value(std::move(*result)) : jsi::Value::null();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNullableGenericObject(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
auto result = static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getNullableGenericObject(
|
||||
rt
|
||||
);
|
||||
return result ? jsi::Value(std::move(*result)) : jsi::Value::null();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNullableArray(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
auto result = static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getNullableArray(
|
||||
rt
|
||||
);
|
||||
return result ? jsi::Value(std::move(*result)) : jsi::Value::null();
|
||||
}
|
||||
|
||||
NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"SampleTurboModule\\", jsInvoker) {
|
||||
methodMap_[\\"difficult\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_difficult};
|
||||
methodMap_[\\"optionals\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_optionals};
|
||||
methodMap_[\\"optionalMethod\\"] = MethodMetadata {3, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_optionalMethod};
|
||||
methodMap_[\\"getArrays\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getArrays};
|
||||
methodMap_[\\"getNullableObject\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNullableObject};
|
||||
methodMap_[\\"getNullableGenericObject\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNullableGenericObject};
|
||||
methodMap_[\\"getNullableArray\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNullableArray};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture cxx_only_native_modules 1`] = `
|
||||
Map {
|
||||
"cxx_only_native_modulesJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"cxx_only_native_modulesJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getArray(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getArray(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt).asArray(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getBool(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getBool(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asBool()
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getConstants(
|
||||
rt
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getCustomEnum(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getCustomEnum(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asNumber()
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getCustomHostObject(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getCustomHostObject(
|
||||
rt
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_consumeCustomHostObject(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->consumeCustomHostObject(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getBinaryTreeNode(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getBinaryTreeNode(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getGraphNode(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getGraphNode(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNumEnum(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getNumEnum(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asNumber()
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getStrEnum(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getStrEnum(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asString(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getMap(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getMap(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNumber(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getNumber(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asNumber()
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getObject(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getObject(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getSet(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getSet(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt).asArray(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getString(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getString(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asString(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getUnion(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getUnion(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asNumber(),
|
||||
count <= 1 ? throw jsi::JSError(rt, \\"Expected argument in position 1 to be passed\\") : args[1].asString(rt),
|
||||
count <= 2 ? throw jsi::JSError(rt, \\"Expected argument in position 2 to be passed\\") : args[2].asString(rt),
|
||||
count <= 3 ? throw jsi::JSError(rt, \\"Expected argument in position 3 to be passed\\") : args[3].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValue(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getValue(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asNumber(),
|
||||
count <= 1 ? throw jsi::JSError(rt, \\"Expected argument in position 1 to be passed\\") : args[1].asString(rt),
|
||||
count <= 2 ? throw jsi::JSError(rt, \\"Expected argument in position 2 to be passed\\") : args[2].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValueWithCallback(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getValueWithCallback(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt).asFunction(rt)
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValueWithPromise(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getValueWithPromise(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asBool()
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getWithWithOptionalArgs(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
auto result = static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getWithWithOptionalArgs(
|
||||
rt,
|
||||
count <= 0 || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asBool())
|
||||
);
|
||||
return result ? jsi::Value(std::move(*result)) : jsi::Value::null();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFunc(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->voidFunc(
|
||||
rt
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_setMenu(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->setMenu(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_emitCustomDeviceEvent(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->emitCustomDeviceEvent(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asString(rt)
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFuncThrows(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->voidFuncThrows(
|
||||
rt
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getObjectThrows(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getObjectThrows(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFuncAssert(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->voidFuncAssert(
|
||||
rt
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getObjectAssert(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getObjectAssert(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
}
|
||||
|
||||
NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"SampleTurboModuleCxx\\", jsInvoker) {
|
||||
methodMap_[\\"getArray\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getArray};
|
||||
methodMap_[\\"getBool\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getBool};
|
||||
methodMap_[\\"getConstants\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getConstants};
|
||||
methodMap_[\\"getCustomEnum\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getCustomEnum};
|
||||
methodMap_[\\"getCustomHostObject\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getCustomHostObject};
|
||||
methodMap_[\\"consumeCustomHostObject\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_consumeCustomHostObject};
|
||||
methodMap_[\\"getBinaryTreeNode\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getBinaryTreeNode};
|
||||
methodMap_[\\"getGraphNode\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getGraphNode};
|
||||
methodMap_[\\"getNumEnum\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNumEnum};
|
||||
methodMap_[\\"getStrEnum\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getStrEnum};
|
||||
methodMap_[\\"getMap\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getMap};
|
||||
methodMap_[\\"getNumber\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNumber};
|
||||
methodMap_[\\"getObject\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getObject};
|
||||
methodMap_[\\"getSet\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getSet};
|
||||
methodMap_[\\"getString\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getString};
|
||||
methodMap_[\\"getUnion\\"] = MethodMetadata {4, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getUnion};
|
||||
methodMap_[\\"getValue\\"] = MethodMetadata {3, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValue};
|
||||
methodMap_[\\"getValueWithCallback\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValueWithCallback};
|
||||
methodMap_[\\"getValueWithPromise\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValueWithPromise};
|
||||
methodMap_[\\"getWithWithOptionalArgs\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getWithWithOptionalArgs};
|
||||
methodMap_[\\"voidFunc\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFunc};
|
||||
methodMap_[\\"setMenu\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_setMenu};
|
||||
methodMap_[\\"emitCustomDeviceEvent\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_emitCustomDeviceEvent};
|
||||
methodMap_[\\"voidFuncThrows\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFuncThrows};
|
||||
methodMap_[\\"getObjectThrows\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getObjectThrows};
|
||||
methodMap_[\\"voidFuncAssert\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFuncAssert};
|
||||
methodMap_[\\"getObjectAssert\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getObjectAssert};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture empty_native_modules 1`] = `
|
||||
Map {
|
||||
"empty_native_modulesJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"empty_native_modulesJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
|
||||
|
||||
NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"SampleTurboModule\\", jsInvoker) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture event_emitter_module 1`] = `
|
||||
Map {
|
||||
"event_emitter_moduleJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"event_emitter_moduleJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFunc(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->voidFunc(
|
||||
rt
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
|
||||
NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"SampleTurboModule\\", jsInvoker) {
|
||||
methodMap_[\\"voidFunc\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFunc};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture native_modules_with_type_aliases 1`] = `
|
||||
Map {
|
||||
"native_modules_with_type_aliasesJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"native_modules_with_type_aliasesJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_AliasTurboModuleCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<AliasTurboModuleCxxSpecJSI *>(&turboModule)->getConstants(
|
||||
rt
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_AliasTurboModuleCxxSpecJSI_cropImage(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<AliasTurboModuleCxxSpecJSI *>(&turboModule)->cropImage(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
|
||||
AliasTurboModuleCxxSpecJSI::AliasTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"AliasTurboModule\\", jsInvoker) {
|
||||
methodMap_[\\"getConstants\\"] = MethodMetadata {0, __hostFunction_AliasTurboModuleCxxSpecJSI_getConstants};
|
||||
methodMap_[\\"cropImage\\"] = MethodMetadata {1, __hostFunction_AliasTurboModuleCxxSpecJSI_cropImage};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture real_module_example 1`] = `
|
||||
Map {
|
||||
"real_module_exampleJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"real_module_exampleJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_NativeCameraRollManagerCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeCameraRollManagerCxxSpecJSI *>(&turboModule)->getConstants(
|
||||
rt
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeCameraRollManagerCxxSpecJSI_getPhotos(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeCameraRollManagerCxxSpecJSI *>(&turboModule)->getPhotos(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeCameraRollManagerCxxSpecJSI_saveToCameraRoll(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeCameraRollManagerCxxSpecJSI *>(&turboModule)->saveToCameraRoll(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asString(rt),
|
||||
count <= 1 ? throw jsi::JSError(rt, \\"Expected argument in position 1 to be passed\\") : args[1].asString(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeCameraRollManagerCxxSpecJSI_deletePhotos(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeCameraRollManagerCxxSpecJSI *>(&turboModule)->deletePhotos(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt).asArray(rt)
|
||||
);
|
||||
}
|
||||
|
||||
NativeCameraRollManagerCxxSpecJSI::NativeCameraRollManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"CameraRollManager\\", jsInvoker) {
|
||||
methodMap_[\\"getConstants\\"] = MethodMetadata {0, __hostFunction_NativeCameraRollManagerCxxSpecJSI_getConstants};
|
||||
methodMap_[\\"getPhotos\\"] = MethodMetadata {1, __hostFunction_NativeCameraRollManagerCxxSpecJSI_getPhotos};
|
||||
methodMap_[\\"saveToCameraRoll\\"] = MethodMetadata {2, __hostFunction_NativeCameraRollManagerCxxSpecJSI_saveToCameraRoll};
|
||||
methodMap_[\\"deletePhotos\\"] = MethodMetadata {1, __hostFunction_NativeCameraRollManagerCxxSpecJSI_deletePhotos};
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeExceptionsManagerCxxSpecJSI_reportFatalException(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeExceptionsManagerCxxSpecJSI *>(&turboModule)->reportFatalException(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asString(rt),
|
||||
count <= 1 ? throw jsi::JSError(rt, \\"Expected argument in position 1 to be passed\\") : args[1].asObject(rt).asArray(rt),
|
||||
count <= 2 ? throw jsi::JSError(rt, \\"Expected argument in position 2 to be passed\\") : args[2].asNumber()
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeExceptionsManagerCxxSpecJSI_reportSoftException(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeExceptionsManagerCxxSpecJSI *>(&turboModule)->reportSoftException(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asString(rt),
|
||||
count <= 1 ? throw jsi::JSError(rt, \\"Expected argument in position 1 to be passed\\") : args[1].asObject(rt).asArray(rt),
|
||||
count <= 2 ? throw jsi::JSError(rt, \\"Expected argument in position 2 to be passed\\") : args[2].asNumber()
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeExceptionsManagerCxxSpecJSI_reportException(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeExceptionsManagerCxxSpecJSI *>(&turboModule)->reportException(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeExceptionsManagerCxxSpecJSI_updateExceptionMessage(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeExceptionsManagerCxxSpecJSI *>(&turboModule)->updateExceptionMessage(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asString(rt),
|
||||
count <= 1 ? throw jsi::JSError(rt, \\"Expected argument in position 1 to be passed\\") : args[1].asObject(rt).asArray(rt),
|
||||
count <= 2 ? throw jsi::JSError(rt, \\"Expected argument in position 2 to be passed\\") : args[2].asNumber()
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeExceptionsManagerCxxSpecJSI_dismissRedbox(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeExceptionsManagerCxxSpecJSI *>(&turboModule)->dismissRedbox(
|
||||
rt
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
|
||||
NativeExceptionsManagerCxxSpecJSI::NativeExceptionsManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"ExceptionsManager\\", jsInvoker) {
|
||||
methodMap_[\\"reportFatalException\\"] = MethodMetadata {3, __hostFunction_NativeExceptionsManagerCxxSpecJSI_reportFatalException};
|
||||
methodMap_[\\"reportSoftException\\"] = MethodMetadata {3, __hostFunction_NativeExceptionsManagerCxxSpecJSI_reportSoftException};
|
||||
methodMap_[\\"reportException\\"] = MethodMetadata {1, __hostFunction_NativeExceptionsManagerCxxSpecJSI_reportException};
|
||||
methodMap_[\\"updateExceptionMessage\\"] = MethodMetadata {3, __hostFunction_NativeExceptionsManagerCxxSpecJSI_updateExceptionMessage};
|
||||
methodMap_[\\"dismissRedbox\\"] = MethodMetadata {0, __hostFunction_NativeExceptionsManagerCxxSpecJSI_dismissRedbox};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture simple_native_modules 1`] = `
|
||||
Map {
|
||||
"simple_native_modulesJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"simple_native_modulesJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getConstants(
|
||||
rt
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFunc(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->voidFunc(
|
||||
rt
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getBool(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getBool(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asBool()
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNumber(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getNumber(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asNumber()
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getString(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getString(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asString(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getArray(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getArray(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt).asArray(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getObject(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getObject(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getRootTag(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getRootTag(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asNumber()
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValue(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getValue(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asNumber(),
|
||||
count <= 1 ? throw jsi::JSError(rt, \\"Expected argument in position 1 to be passed\\") : args[1].asString(rt),
|
||||
count <= 2 ? throw jsi::JSError(rt, \\"Expected argument in position 2 to be passed\\") : args[2].asObject(rt)
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getEnumReturn(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getEnumReturn(
|
||||
rt
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValueWithCallback(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getValueWithCallback(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asObject(rt).asFunction(rt)
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValueWithPromise(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getValueWithPromise(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asBool()
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValueWithOptionalArg(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getValueWithOptionalArg(
|
||||
rt,
|
||||
count <= 0 || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asObject(rt))
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getEnums(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getEnums(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asNumber(),
|
||||
count <= 1 ? throw jsi::JSError(rt, \\"Expected argument in position 1 to be passed\\") : args[1].asNumber(),
|
||||
count <= 2 ? throw jsi::JSError(rt, \\"Expected argument in position 2 to be passed\\") : args[2].asString(rt)
|
||||
);
|
||||
}
|
||||
|
||||
NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"SampleTurboModule\\", jsInvoker) {
|
||||
methodMap_[\\"getConstants\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getConstants};
|
||||
methodMap_[\\"voidFunc\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFunc};
|
||||
methodMap_[\\"getBool\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getBool};
|
||||
methodMap_[\\"getNumber\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getNumber};
|
||||
methodMap_[\\"getString\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getString};
|
||||
methodMap_[\\"getArray\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getArray};
|
||||
methodMap_[\\"getObject\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getObject};
|
||||
methodMap_[\\"getRootTag\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getRootTag};
|
||||
methodMap_[\\"getValue\\"] = MethodMetadata {3, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValue};
|
||||
methodMap_[\\"getEnumReturn\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getEnumReturn};
|
||||
methodMap_[\\"getValueWithCallback\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValueWithCallback};
|
||||
methodMap_[\\"getValueWithPromise\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValueWithPromise};
|
||||
methodMap_[\\"getValueWithOptionalArg\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getValueWithOptionalArg};
|
||||
methodMap_[\\"getEnums\\"] = MethodMetadata {3, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getEnums};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture string_literals 1`] = `
|
||||
Map {
|
||||
"string_literalsJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"string_literalsJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getStringLiteral(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getStringLiteral(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asString(rt)
|
||||
);
|
||||
}
|
||||
|
||||
NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"SampleTurboModule\\", jsInvoker) {
|
||||
methodMap_[\\"getStringLiteral\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getStringLiteral};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture two_modules_different_files 1`] = `
|
||||
Map {
|
||||
"two_modules_different_filesJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"two_modules_different_filesJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFunc(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->voidFunc(
|
||||
rt
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
|
||||
NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"SampleTurboModule\\", jsInvoker) {
|
||||
methodMap_[\\"voidFunc\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_voidFunc};
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModule2CxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModule2CxxSpecJSI *>(&turboModule)->getConstants(
|
||||
rt
|
||||
);
|
||||
}
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModule2CxxSpecJSI_voidFunc(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
static_cast<NativeSampleTurboModule2CxxSpecJSI *>(&turboModule)->voidFunc(
|
||||
rt
|
||||
);
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
|
||||
NativeSampleTurboModule2CxxSpecJSI::NativeSampleTurboModule2CxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"SampleTurboModule2\\", jsInvoker) {
|
||||
methodMap_[\\"getConstants\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModule2CxxSpecJSI_getConstants};
|
||||
methodMap_[\\"voidFunc\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModule2CxxSpecJSI_voidFunc};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`GenerateModuleCpp can generate fixture union_module 1`] = `
|
||||
Map {
|
||||
"union_moduleJSI-generated.cpp" => "/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include \\"union_moduleJSI.h\\"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getUnion(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleTurboModuleCxxSpecJSI *>(&turboModule)->getUnion(
|
||||
rt,
|
||||
count <= 0 ? throw jsi::JSError(rt, \\"Expected argument in position 0 to be passed\\") : args[0].asNumber(),
|
||||
count <= 1 ? throw jsi::JSError(rt, \\"Expected argument in position 1 to be passed\\") : args[1].asNumber(),
|
||||
count <= 2 ? throw jsi::JSError(rt, \\"Expected argument in position 2 to be passed\\") : args[2].asObject(rt),
|
||||
count <= 3 ? throw jsi::JSError(rt, \\"Expected argument in position 3 to be passed\\") : args[3].asString(rt),
|
||||
count <= 4 ? throw jsi::JSError(rt, \\"Expected argument in position 4 to be passed\\") : args[4].asString(rt)
|
||||
);
|
||||
}
|
||||
|
||||
NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(\\"SampleTurboModule\\", jsInvoker) {
|
||||
methodMap_[\\"getUnion\\"] = MethodMetadata {5, __hostFunction_NativeSampleTurboModuleCxxSpecJSI_getUnion};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
",
|
||||
}
|
||||
`;
|
||||
+577
-1039
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/compatibility-check",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "Check a React Native app's boundary between JS and Native for incompatibilities",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -29,7 +29,7 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@react-native/codegen": "0.82.0-main"
|
||||
"@react-native/codegen": "0.83.0-main"
|
||||
},
|
||||
"devDependencies": {
|
||||
"flow-remove-types": "^2.237.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/popup-menu-android",
|
||||
"version": "0.82.0-main",
|
||||
"version": "0.83.0-main",
|
||||
"description": "PopupMenu for the Android platform",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@react-native/codegen": "0.82.0-main"
|
||||
"@react-native/codegen": "0.83.0-main"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.1.0",
|
||||
|
||||
@@ -97,7 +97,7 @@ export default function createAnimatedComponent<
|
||||
>(
|
||||
Component: TInstance,
|
||||
): AnimatedComponentType<
|
||||
$ReadOnly<React.ElementProps<TInstance>>,
|
||||
$ReadOnly<React.ElementConfig<TInstance>>,
|
||||
React.ElementRef<TInstance>,
|
||||
> {
|
||||
return unstable_createAnimatedComponentWithAllowlist(Component, null);
|
||||
|
||||
+26
-10
@@ -110,6 +110,27 @@ function isRgbaAnimatedValue(value: any): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
export function getRgbaValueAndNativeColor(
|
||||
value: RgbaValue | ColorValue,
|
||||
): $ReadOnly<{
|
||||
rgbaValue: RgbaValue,
|
||||
nativeColor?: NativeColorValue,
|
||||
}> {
|
||||
const processedColor: RgbaValue | NativeColorValue =
|
||||
// $FlowFixMe[incompatible-type] - Type is verified above
|
||||
processColor((value: ColorValue | RgbaValue)) ?? defaultColor;
|
||||
if (isRgbaValue(processedColor)) {
|
||||
// $FlowFixMe[incompatible-type] - Type is verified above
|
||||
return {rgbaValue: (processedColor: RgbaValue)};
|
||||
} else {
|
||||
return {
|
||||
// $FlowFixMe[incompatible-type] - Type is verified above
|
||||
nativeColor: (processedColor: NativeColorValue),
|
||||
rgbaValue: defaultColor,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default class AnimatedColor extends AnimatedWithChildren {
|
||||
r: AnimatedValue;
|
||||
g: AnimatedValue;
|
||||
@@ -132,18 +153,13 @@ export default class AnimatedColor extends AnimatedWithChildren {
|
||||
this.b = rgbaAnimatedValue.b;
|
||||
this.a = rgbaAnimatedValue.a;
|
||||
} else {
|
||||
const processedColor: RgbaValue | NativeColorValue =
|
||||
const {rgbaValue: initColor, nativeColor} = getRgbaValueAndNativeColor(
|
||||
// $FlowFixMe[incompatible-type] - Type is verified above
|
||||
processColor((value: ColorValue | RgbaValue)) ?? defaultColor;
|
||||
let initColor: RgbaValue = defaultColor;
|
||||
if (isRgbaValue(processedColor)) {
|
||||
// $FlowFixMe[incompatible-type] - Type is verified above
|
||||
initColor = (processedColor: RgbaValue);
|
||||
} else {
|
||||
// $FlowFixMe[incompatible-type] - Type is verified above
|
||||
this.nativeColor = (processedColor: NativeColorValue);
|
||||
(value: ColorValue | RgbaValue),
|
||||
);
|
||||
if (nativeColor) {
|
||||
this.nativeColor = nativeColor;
|
||||
}
|
||||
|
||||
this.r = new AnimatedValue(initColor.r);
|
||||
this.g = new AnimatedValue(initColor.g);
|
||||
this.b = new AnimatedValue(initColor.b);
|
||||
|
||||
@@ -120,6 +120,7 @@ std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupDefaultJsExecutor
|
||||
RCTTurboModuleManager *turboModuleManager,
|
||||
const std::shared_ptr<facebook::react::RuntimeScheduler> &runtimeScheduler)
|
||||
{
|
||||
#ifndef RCT_REMOVE_LEGACY_ARCH
|
||||
// Necessary to allow NativeModules to lookup TurboModules
|
||||
[bridge setRCTTurboModuleRegistry:turboModuleManager];
|
||||
|
||||
@@ -146,12 +147,18 @@ std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupDefaultJsExecutor
|
||||
return std::make_unique<facebook::react::HermesExecutorFactory>(
|
||||
facebook::react::RCTJSIExecutorRuntimeInstaller(runtimeInstallerLambda));
|
||||
#endif
|
||||
#else
|
||||
// This method should not be invoked in the New Arch. So when Legacy Arch is removed, we can
|
||||
// safly return a nullptr.
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupJsExecutorFactoryForOldArch(
|
||||
RCTBridge *bridge,
|
||||
const std::shared_ptr<facebook::react::RuntimeScheduler> &runtimeScheduler)
|
||||
{
|
||||
#ifndef RCT_REMOVE_LEGACY_ARCH
|
||||
auto runtimeInstallerLambda = [bridge, runtimeScheduler](facebook::jsi::Runtime &runtime) {
|
||||
if (!bridge) {
|
||||
return;
|
||||
@@ -164,4 +171,9 @@ std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupJsExecutorFactory
|
||||
return std::make_unique<facebook::react::HermesExecutorFactory>(
|
||||
facebook::react::RCTJSIExecutorRuntimeInstaller(runtimeInstallerLambda));
|
||||
#endif
|
||||
#else
|
||||
// This method should not be invoked in the New Arch. So when Legacy Arch is removed, we can
|
||||
// safly return a nullptr.
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
@class RCTBridge;
|
||||
@protocol RCTComponentViewProtocol;
|
||||
@class RCTSurfacePresenterBridgeAdapter;
|
||||
@class RCTDevMenuConfiguration;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -116,6 +117,8 @@ typedef NS_ENUM(NSInteger, RCTReleaseLevel) { Canary, Experimental, Stable };
|
||||
|
||||
@property (nonatomic, weak) id<RCTReactNativeFactoryDelegate> delegate;
|
||||
|
||||
@property (nonatomic, nullable) RCTDevMenuConfiguration *devMenuConfiguration;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#import "RCTReactNativeFactory.h"
|
||||
#import <React/RCTColorSpaceUtils.h>
|
||||
#import <React/RCTDevMenu.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import <React/RCTRootView.h>
|
||||
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
||||
@@ -82,7 +83,8 @@ using namespace facebook::react;
|
||||
{
|
||||
UIView *rootView = [self.rootViewFactory viewWithModuleName:moduleName
|
||||
initialProperties:initialProperties
|
||||
launchOptions:launchOptions];
|
||||
launchOptions:launchOptions
|
||||
devMenuConfiguration:self.devMenuConfiguration];
|
||||
UIViewController *rootViewController = [_delegate createRootViewController];
|
||||
[_delegate setRootView:rootView toRootViewController:rootViewController];
|
||||
window.rootViewController = rootViewController;
|
||||
@@ -259,7 +261,12 @@ using namespace facebook::react;
|
||||
|
||||
configuration.sourceURLForBridge = ^NSURL *_Nullable(RCTBridge *_Nonnull bridge)
|
||||
{
|
||||
#ifndef RCT_REMOVE_LEGACY_ARCH
|
||||
return [weakSelf.delegate sourceURLForBridge:bridge];
|
||||
#else
|
||||
// When the Legacy Arch is removed, the Delegate does not have a sourceURLForBridge method
|
||||
return [weakSelf.delegate bundleURL];
|
||||
#endif
|
||||
};
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(extraModulesForBridge:)]) {
|
||||
@@ -273,13 +280,24 @@ using namespace facebook::react;
|
||||
configuration.extraLazyModuleClassesForBridge =
|
||||
^NSDictionary<NSString *, Class> *_Nonnull(RCTBridge *_Nonnull bridge)
|
||||
{
|
||||
#ifndef RCT_REMOVE_LEGACY_ARCH
|
||||
return [weakSelf.delegate extraLazyModuleClassesForBridge:bridge];
|
||||
#else
|
||||
// When the Legacy Arch is removed, the Delegate does not have a extraLazyModuleClassesForBridge method
|
||||
return @{};
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(bridge:didNotFindModule:)]) {
|
||||
configuration.bridgeDidNotFindModule = ^BOOL(RCTBridge *_Nonnull bridge, NSString *_Nonnull moduleName) {
|
||||
#ifndef RCT_REMOVE_LEGACY_ARCH
|
||||
return [weakSelf.delegate bridge:bridge didNotFindModule:moduleName];
|
||||
#else
|
||||
// When the Legacy Arch is removed, the Delegate does not have a bridge:didNotFindModule method
|
||||
// We return NO, because if we have invoked this method is unlikely that the module will be actually registered
|
||||
return NO;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
@@ -288,13 +306,30 @@ using namespace facebook::react;
|
||||
^(RCTBridge *_Nonnull bridge,
|
||||
RCTSourceLoadProgressBlock _Nonnull onProgress,
|
||||
RCTSourceLoadBlock _Nonnull loadCallback) {
|
||||
#ifndef RCT_REMOVE_LEGACY_ARCH
|
||||
[weakSelf.delegate loadSourceForBridge:bridge onProgress:onProgress onComplete:loadCallback];
|
||||
#else
|
||||
// When the Legacy Arch is removed, the Delegate does not have a
|
||||
// loadSourceForBridge:onProgress:onComplete: method
|
||||
// We then call the loadBundleAtURL:onProgress:onComplete: instead
|
||||
[weakSelf.delegate loadBundleAtURL:self.bundleURL onProgress:onProgress onComplete:loadCallback];
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
if ([self.delegate respondsToSelector:@selector(loadSourceForBridge:withBlock:)]) {
|
||||
configuration.loadSourceForBridge = ^(RCTBridge *_Nonnull bridge, RCTSourceLoadBlock _Nonnull loadCallback) {
|
||||
#ifndef RCT_REMOVE_LEGACY_ARCH
|
||||
[weakSelf.delegate loadSourceForBridge:bridge withBlock:loadCallback];
|
||||
#else
|
||||
// When the Legacy Arch is removed, the Delegate does not have a
|
||||
// loadSourceForBridge:withBlock: method
|
||||
// We then call the loadBundleAtURL:onProgress:onComplete: instead
|
||||
[weakSelf.delegate loadBundleAtURL:self.bundleURL
|
||||
onProgress:^(RCTLoadingProgress *progressData) {
|
||||
}
|
||||
onComplete:loadCallback];
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
@class RCTHost;
|
||||
@class RCTRootView;
|
||||
@class RCTSurfacePresenterBridgeAdapter;
|
||||
@class RCTDevMenuConfiguration;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -201,7 +202,13 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
|
||||
* @parameter: moduleName - the name of the app, used by Metro to resolve the module.
|
||||
* @parameter: initialProperties - a set of initial properties.
|
||||
* @parameter: launchOptions - a dictionary with a set of options.
|
||||
* @parameter: devMenuConfiguration - a configuration for enabling/disabling dev menu.
|
||||
*/
|
||||
- (UIView *_Nonnull)viewWithModuleName:(NSString *)moduleName
|
||||
initialProperties:(NSDictionary *__nullable)initialProperties
|
||||
launchOptions:(NSDictionary *__nullable)launchOptions
|
||||
devMenuConfiguration:(RCTDevMenuConfiguration *__nullable)devMenuConfiguration;
|
||||
|
||||
- (UIView *_Nonnull)viewWithModuleName:(NSString *)moduleName
|
||||
initialProperties:(NSDictionary *__nullable)initialProperties
|
||||
launchOptions:(NSDictionary *__nullable)launchOptions;
|
||||
@@ -219,11 +226,16 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
|
||||
* Use it to speed up later viewWithModuleName: calls.
|
||||
*
|
||||
* @parameter: launchOptions - a dictionary with a set of options.
|
||||
* @parameter: devMenuConfiguration - a configuration for enabling/disabling dev menu.
|
||||
*/
|
||||
- (void)initializeReactHostWithLaunchOptions:(NSDictionary *__nullable)launchOptions;
|
||||
- (void)initializeReactHostWithLaunchOptions:(NSDictionary *__nullable)launchOptions
|
||||
devMenuConfiguration:(RCTDevMenuConfiguration *)devMenuConfiguration;
|
||||
|
||||
- (RCTHost *)createReactHost:(NSDictionary *__nullable)launchOptions;
|
||||
|
||||
- (RCTHost *)createReactHost:(NSDictionary *__nullable)launchOptions
|
||||
devMenuConfiguration:(RCTDevMenuConfiguration *__nullable)devMenuConfiguration;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#import "RCTRootViewFactory.h"
|
||||
#import <React/RCTCxxBridgeDelegate.h>
|
||||
#import <React/RCTDevMenu.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import <React/RCTRootView.h>
|
||||
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
||||
@@ -133,29 +134,47 @@
|
||||
|
||||
- (UIView *)viewWithModuleName:(NSString *)moduleName initialProperties:(NSDictionary *)initialProperties
|
||||
{
|
||||
return [self viewWithModuleName:moduleName initialProperties:initialProperties launchOptions:nil];
|
||||
return [self viewWithModuleName:moduleName
|
||||
initialProperties:initialProperties
|
||||
launchOptions:nil
|
||||
devMenuConfiguration:[RCTDevMenuConfiguration defaultConfiguration]];
|
||||
}
|
||||
|
||||
- (UIView *)viewWithModuleName:(NSString *)moduleName
|
||||
{
|
||||
return [self viewWithModuleName:moduleName initialProperties:nil launchOptions:nil];
|
||||
return [self viewWithModuleName:moduleName
|
||||
initialProperties:nil
|
||||
launchOptions:nil
|
||||
devMenuConfiguration:[RCTDevMenuConfiguration defaultConfiguration]];
|
||||
}
|
||||
|
||||
- (void)initializeReactHostWithLaunchOptions:(NSDictionary *)launchOptions
|
||||
devMenuConfiguration:(RCTDevMenuConfiguration *)devMenuConfiguration
|
||||
{
|
||||
// Enable TurboModule interop by default in Bridgeless mode
|
||||
RCTEnableTurboModuleInterop(YES);
|
||||
RCTEnableTurboModuleInteropBridgeProxy(YES);
|
||||
|
||||
[self createReactHostIfNeeded:launchOptions];
|
||||
[self createReactHostIfNeeded:launchOptions devMenuConfiguration:devMenuConfiguration];
|
||||
return;
|
||||
}
|
||||
|
||||
- (UIView *)viewWithModuleName:(NSString *)moduleName
|
||||
initialProperties:(NSDictionary *)initialProperties
|
||||
launchOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
return [self viewWithModuleName:moduleName
|
||||
initialProperties:initialProperties
|
||||
launchOptions:launchOptions
|
||||
devMenuConfiguration:[RCTDevMenuConfiguration defaultConfiguration]];
|
||||
}
|
||||
|
||||
- (UIView *)viewWithModuleName:(NSString *)moduleName
|
||||
initialProperties:(NSDictionary *)initProps
|
||||
launchOptions:(NSDictionary *)launchOptions
|
||||
devMenuConfiguration:(RCTDevMenuConfiguration *)devMenuConfiguration
|
||||
{
|
||||
[self initializeReactHostWithLaunchOptions:launchOptions];
|
||||
[self initializeReactHostWithLaunchOptions:launchOptions devMenuConfiguration:devMenuConfiguration];
|
||||
|
||||
RCTFabricSurface *surface = [self.reactHost createSurfaceWithModuleName:moduleName
|
||||
initialProperties:initProps ? initProps : @{}];
|
||||
@@ -226,14 +245,21 @@
|
||||
#pragma mark - New Arch Utilities
|
||||
|
||||
- (void)createReactHostIfNeeded:(NSDictionary *)launchOptions
|
||||
devMenuConfiguration:(RCTDevMenuConfiguration *)devMenuConfiguration
|
||||
{
|
||||
if (self.reactHost) {
|
||||
return;
|
||||
}
|
||||
self.reactHost = [self createReactHost:launchOptions];
|
||||
self.reactHost = [self createReactHost:launchOptions devMenuConfiguration:devMenuConfiguration];
|
||||
}
|
||||
|
||||
- (RCTHost *)createReactHost:(NSDictionary *)launchOptions
|
||||
{
|
||||
return [self createReactHost:launchOptions devMenuConfiguration:[RCTDevMenuConfiguration defaultConfiguration]];
|
||||
}
|
||||
|
||||
- (RCTHost *)createReactHost:(NSDictionary *)launchOptions
|
||||
devMenuConfiguration:(RCTDevMenuConfiguration *)devMenuConfiguration
|
||||
{
|
||||
__weak __typeof(self) weakSelf = self;
|
||||
RCTHost *reactHost =
|
||||
@@ -243,7 +269,8 @@
|
||||
jsEngineProvider:^std::shared_ptr<facebook::react::JSRuntimeFactory>() {
|
||||
return [weakSelf createJSRuntimeFactory];
|
||||
}
|
||||
launchOptions:launchOptions];
|
||||
launchOptions:launchOptions
|
||||
devMenuConfiguration:devMenuConfiguration];
|
||||
[reactHost setBundleURLProvider:^NSURL *() {
|
||||
return [weakSelf bundleURL];
|
||||
}];
|
||||
|
||||
@@ -449,6 +449,12 @@ function InternalTextInput(props: TextInputProps): React.Node {
|
||||
before we can get to the long term breaking change.
|
||||
*/
|
||||
if (instance != null) {
|
||||
// Register the input immediately when the ref is set so that focus()
|
||||
// can be called from ref callbacks
|
||||
// Double registering during useLayoutEffect is fine, because the underlying
|
||||
// state is a Set.
|
||||
TextInputState.registerInput(instance);
|
||||
|
||||
// $FlowFixMe[prop-missing] - See the explanation above.
|
||||
// $FlowFixMe[unsafe-object-assign]
|
||||
Object.assign(instance, {
|
||||
|
||||
@@ -21,8 +21,8 @@ const ViewNativeComponent: HostComponent<Props> =
|
||||
}));
|
||||
|
||||
interface NativeCommands {
|
||||
+focus: () => void;
|
||||
+blur: () => void;
|
||||
+focus: (viewRef: HostInstance) => void;
|
||||
+blur: (viewRef: HostInstance) => void;
|
||||
+hotspotUpdate: (viewRef: HostInstance, x: number, y: number) => void;
|
||||
+setPressed: (viewRef: HostInstance, pressed: boolean) => void;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {HostComponent} from '../../types/public/ReactNativeTypes';
|
||||
import * as React from 'react';
|
||||
|
||||
/**
|
||||
* Configures a function that is called to determine whether a given component
|
||||
* should be registered using reflection of the native component at runtime.
|
||||
*
|
||||
* The provider should return null if the native component is unavailable in
|
||||
* the current environment.
|
||||
*/
|
||||
export function setRuntimeConfigProvider(
|
||||
runtimeConfigProvider: (name: string) => {
|
||||
native: boolean;
|
||||
verify: boolean;
|
||||
} | null,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Gets a `NativeComponent` that can be rendered by React Native.
|
||||
*
|
||||
* The supplied `viewConfigProvider` may or may not be invoked and utilized,
|
||||
* depending on how `setRuntimeConfigProvider` is configured.
|
||||
*/
|
||||
export function get<Config extends object>(
|
||||
name: string,
|
||||
viewConfigProvider: () => PartialViewConfig,
|
||||
): HostComponent<Config>;
|
||||
|
||||
/**
|
||||
* Same as `NativeComponentRegistry.get(...)`, except this will check either
|
||||
* the `setRuntimeConfigProvider` configuration or use native reflection (slow)
|
||||
* to determine whether this native component is available.
|
||||
*
|
||||
* If the native component is not available, a stub component is returned. Note
|
||||
* that the return value of this is not `HostComponent` because the returned
|
||||
* component instance is not guaranteed to have native methods.
|
||||
*/
|
||||
export function getWithFallback_DEPRECATED<Config extends object>(
|
||||
name: string,
|
||||
viewConfigProvider: () => PartialViewConfig,
|
||||
): React.ComponentType<Config>;
|
||||
|
||||
/**
|
||||
* Unstable API. Do not use!
|
||||
*
|
||||
* This method returns if there is a StaticViewConfig registered for the
|
||||
* component name received as a parameter.
|
||||
*/
|
||||
export function unstable_hasStaticViewConfig(name: string): boolean;
|
||||
|
||||
type AttributeType<T, V> =
|
||||
| true
|
||||
| {
|
||||
readonly diff?: ((arg1: T, arg2: T) => boolean) | undefined;
|
||||
readonly process?: ((arg1: V) => T) | undefined;
|
||||
};
|
||||
type AnyAttributeType = AttributeType<any, any>;
|
||||
type AttributeConfiguration = {
|
||||
readonly [propName: string]: AnyAttributeType | void;
|
||||
readonly style?:
|
||||
| {
|
||||
readonly [propName: string]: AnyAttributeType;
|
||||
}
|
||||
| undefined;
|
||||
};
|
||||
|
||||
type PartialViewConfig = Readonly<{
|
||||
bubblingEventTypes?:
|
||||
| {
|
||||
readonly [eventName: string]: {
|
||||
readonly phasedRegistrationNames: {
|
||||
readonly bubbled: string;
|
||||
readonly captured: string;
|
||||
readonly skipBubbling?: boolean | undefined;
|
||||
};
|
||||
};
|
||||
}
|
||||
| undefined;
|
||||
directEventTypes?:
|
||||
| {
|
||||
readonly [eventName: string]: {
|
||||
readonly registrationName: string;
|
||||
};
|
||||
}
|
||||
| undefined;
|
||||
supportsRawText?: boolean | undefined;
|
||||
uiViewClassName: string;
|
||||
validAttributes?: AttributeConfiguration | undefined;
|
||||
}>;
|
||||
@@ -13,7 +13,7 @@ typedef NSURLSessionConfiguration * (^NSURLSessionConfigurationProvider)(void);
|
||||
* The block provided via this function will provide the NSURLSessionConfiguration for all HTTP requests made by the
|
||||
* app.
|
||||
*/
|
||||
RCT_EXTERN void RCTSetCustomNSURLSessionConfigurationProvider(NSURLSessionConfigurationProvider);
|
||||
RCT_EXTERN void RCTSetCustomNSURLSessionConfigurationProvider(NSURLSessionConfigurationProvider /*provider*/);
|
||||
/**
|
||||
* This is the default RCTURLRequestHandler implementation for HTTP requests.
|
||||
*/
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
* - Corresponds to `PerformanceResourceTiming.requestStart` (specifically,
|
||||
* marking when the native request was initiated).
|
||||
*/
|
||||
+ (void)reportRequestStart:(NSNumber *)requestId
|
||||
+ (void)reportRequestStart:(NSString *)requestId
|
||||
request:(NSURLRequest *)request
|
||||
encodedDataLength:(int)encodedDataLength;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
* `PerformanceResourceTiming.connectStart`. Defined as "immediately before
|
||||
* the browser starts to establish the connection to the server".
|
||||
*/
|
||||
+ (void)reportConnectionTiming:(NSNumber *)requestId request:(NSURLRequest *)request;
|
||||
+ (void)reportConnectionTiming:(NSString *)requestId request:(NSURLRequest *)request;
|
||||
|
||||
/**
|
||||
* Report when HTTP response headers have been received, corresponding to
|
||||
@@ -49,7 +49,7 @@
|
||||
* - Corresponds to `Network.responseReceived` in CDP.
|
||||
* - Corresponds to `PerformanceResourceTiming.responseStart`.
|
||||
*/
|
||||
+ (void)reportResponseStart:(NSNumber *)requestId
|
||||
+ (void)reportResponseStart:(NSString *)requestId
|
||||
response:(NSURLResponse *)response
|
||||
statusCode:(int)statusCode
|
||||
headers:(NSDictionary<NSString *, NSString *> *)headers;
|
||||
@@ -59,7 +59,7 @@
|
||||
*
|
||||
* Corresponds to `Network.dataReceived` in CDP.
|
||||
*/
|
||||
+ (void)reportDataReceived:(NSNumber *)requestId data:(NSData *)data;
|
||||
+ (void)reportDataReceived:(NSString *)requestId data:(NSData *)data;
|
||||
|
||||
/**
|
||||
* Report when a network request is complete and we are no longer receiving
|
||||
@@ -68,20 +68,20 @@
|
||||
* - Corresponds to `Network.loadingFinished` in CDP.
|
||||
* - Corresponds to `PerformanceResourceTiming.responseEnd`.
|
||||
*/
|
||||
+ (void)reportResponseEnd:(NSNumber *)requestId encodedDataLength:(int)encodedDataLength;
|
||||
+ (void)reportResponseEnd:(NSString *)requestId encodedDataLength:(int)encodedDataLength;
|
||||
|
||||
/**
|
||||
* Report when a network request has failed.
|
||||
*
|
||||
* - Corresponds to `Network.loadingFailed` in CDP.
|
||||
*/
|
||||
+ (void)reportRequestFailed:(NSNumber *)requestId cancelled:(BOOL)cancelled;
|
||||
+ (void)reportRequestFailed:(NSString *)requestId cancelled:(BOOL)cancelled;
|
||||
|
||||
/**
|
||||
* Store response body preview. This is an optional reporting method, and is a
|
||||
* no-op if CDP debugging is disabled.
|
||||
*/
|
||||
+ (void)maybeStoreResponseBody:(NSNumber *)requestId data:(NSData *)data base64Encoded:(bool)base64Encoded;
|
||||
+ (void)maybeStoreResponseBody:(NSString *)requestId data:(NSData *)data base64Encoded:(bool)base64Encoded;
|
||||
|
||||
/**
|
||||
* Incrementally store a response body preview, when a string response is
|
||||
@@ -91,6 +91,6 @@
|
||||
* As with `maybeStoreResponseBody`, calling this method is optional and a
|
||||
* no-op if CDP debugging is disabled.
|
||||
*/
|
||||
+ (void)maybeStoreResponseBodyIncremental:(NSNumber *)requestId data:(NSString *)data;
|
||||
+ (void)maybeStoreResponseBodyIncremental:(NSString *)requestId data:(NSString *)data;
|
||||
|
||||
@end
|
||||
|
||||
@@ -48,14 +48,14 @@ std::string convertRequestBodyToStringTruncated(NSURLRequest *request)
|
||||
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
||||
|
||||
// Dictionary to buffer incremental response bodies (CDP debugging active only)
|
||||
static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers = nil;
|
||||
static const NSMutableDictionary<NSString *, NSMutableString *> *responseBuffers = nil;
|
||||
|
||||
#endif
|
||||
|
||||
@implementation RCTInspectorNetworkReporter {
|
||||
}
|
||||
|
||||
+ (void)reportRequestStart:(NSNumber *)requestId
|
||||
+ (void)reportRequestStart:(NSString *)requestId
|
||||
request:(NSURLRequest *)request
|
||||
encodedDataLength:(int)encodedDataLength
|
||||
{
|
||||
@@ -68,11 +68,10 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
||||
requestInfo.httpBody = convertRequestBodyToStringTruncated(request);
|
||||
#endif
|
||||
|
||||
NetworkReporter::getInstance().reportRequestStart(
|
||||
requestId.stringValue.UTF8String, requestInfo, encodedDataLength, std::nullopt);
|
||||
NetworkReporter::getInstance().reportRequestStart(requestId.UTF8String, requestInfo, encodedDataLength, std::nullopt);
|
||||
}
|
||||
|
||||
+ (void)reportConnectionTiming:(NSNumber *)requestId request:(NSURLRequest *)request
|
||||
+ (void)reportConnectionTiming:(NSString *)requestId request:(NSURLRequest *)request
|
||||
{
|
||||
Headers headersMap;
|
||||
|
||||
@@ -81,10 +80,10 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
||||
headersMap = convertNSDictionaryToHeaders(request.allHTTPHeaderFields);
|
||||
#endif
|
||||
|
||||
NetworkReporter::getInstance().reportConnectionTiming(requestId.stringValue.UTF8String, headersMap);
|
||||
NetworkReporter::getInstance().reportConnectionTiming(requestId.UTF8String, headersMap);
|
||||
}
|
||||
|
||||
+ (void)reportResponseStart:(NSNumber *)requestId
|
||||
+ (void)reportResponseStart:(NSString *)requestId
|
||||
response:(NSURLResponse *)response
|
||||
statusCode:(int)statusCode
|
||||
headers:(NSDictionary<NSString *, NSString *> *)headers
|
||||
@@ -99,17 +98,17 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
||||
#endif
|
||||
|
||||
NetworkReporter::getInstance().reportResponseStart(
|
||||
requestId.stringValue.UTF8String, responseInfo, response.expectedContentLength);
|
||||
requestId.UTF8String, responseInfo, response.expectedContentLength);
|
||||
}
|
||||
|
||||
+ (void)reportDataReceived:(NSNumber *)requestId data:(NSData *)data
|
||||
+ (void)reportDataReceived:(NSString *)requestId data:(NSData *)data
|
||||
{
|
||||
NetworkReporter::getInstance().reportDataReceived(requestId.stringValue.UTF8String, (int)data.length, std::nullopt);
|
||||
NetworkReporter::getInstance().reportDataReceived(requestId.UTF8String, (int)data.length, std::nullopt);
|
||||
}
|
||||
|
||||
+ (void)reportResponseEnd:(NSNumber *)requestId encodedDataLength:(int)encodedDataLength
|
||||
+ (void)reportResponseEnd:(NSString *)requestId encodedDataLength:(int)encodedDataLength
|
||||
{
|
||||
NetworkReporter::getInstance().reportResponseEnd(requestId.stringValue.UTF8String, encodedDataLength);
|
||||
NetworkReporter::getInstance().reportResponseEnd(requestId.UTF8String, encodedDataLength);
|
||||
|
||||
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
||||
// Debug build: Check for buffered response body and flush to NetworkReporter
|
||||
@@ -118,7 +117,7 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
||||
if (buffer != nullptr) {
|
||||
if (buffer.length > 0) {
|
||||
NetworkReporter::getInstance().storeResponseBody(
|
||||
requestId.stringValue.UTF8String, RCTStringViewFromNSString(buffer), false);
|
||||
requestId.UTF8String, RCTStringViewFromNSString(buffer), false);
|
||||
}
|
||||
[responseBuffers removeObjectForKey:requestId];
|
||||
}
|
||||
@@ -126,9 +125,9 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (void)reportRequestFailed:(NSNumber *)requestId cancelled:(bool)cancelled
|
||||
+ (void)reportRequestFailed:(NSString *)requestId cancelled:(bool)cancelled
|
||||
{
|
||||
NetworkReporter::getInstance().reportRequestFailed(requestId.stringValue.UTF8String, cancelled);
|
||||
NetworkReporter::getInstance().reportRequestFailed(requestId.UTF8String, cancelled);
|
||||
|
||||
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
||||
// Debug build: Clear buffer for request
|
||||
@@ -138,7 +137,7 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (void)maybeStoreResponseBody:(NSNumber *)requestId data:(id)data base64Encoded:(bool)base64Encoded
|
||||
+ (void)maybeStoreResponseBody:(NSString *)requestId data:(id)data base64Encoded:(bool)base64Encoded
|
||||
{
|
||||
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
||||
// Debug build: Process response body and report to NetworkReporter
|
||||
@@ -152,7 +151,7 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
||||
NSString *encodedString = [(NSData *)data base64EncodedStringWithOptions:0];
|
||||
if (encodedString != nullptr) {
|
||||
networkReporter.storeResponseBody(
|
||||
requestId.stringValue.UTF8String, RCTStringViewFromNSString(encodedString), base64Encoded);
|
||||
requestId.UTF8String, RCTStringViewFromNSString(encodedString), base64Encoded);
|
||||
} else {
|
||||
RCTLogWarn(@"Failed to encode response data for request %@", requestId);
|
||||
}
|
||||
@@ -160,13 +159,12 @@ static const NSMutableDictionary<NSNumber *, NSMutableString *> *responseBuffers
|
||||
RCTLogWarn(@"Exception while encoding response data: %@", exception.reason);
|
||||
}
|
||||
} else if ([data isKindOfClass:[NSString class]] && [(NSString *)data length] > 0) {
|
||||
networkReporter.storeResponseBody(
|
||||
requestId.stringValue.UTF8String, RCTStringViewFromNSString((NSString *)data), base64Encoded);
|
||||
networkReporter.storeResponseBody(requestId.UTF8String, RCTStringViewFromNSString((NSString *)data), base64Encoded);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (void)maybeStoreResponseBodyIncremental:(NSNumber *)requestId data:(NSString *)data
|
||||
+ (void)maybeStoreResponseBodyIncremental:(NSString *)requestId data:(NSString *)data
|
||||
{
|
||||
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
||||
// Debug build: Buffer incremental response body contents
|
||||
|
||||
@@ -28,6 +28,7 @@ typedef NS_ENUM(NSInteger, RCTNetworkTaskStatus) {
|
||||
@property (nonatomic, readonly) NSNumber *requestID;
|
||||
@property (nonatomic, readonly, weak) id requestToken;
|
||||
@property (nonatomic, readonly) NSURLResponse *response;
|
||||
@property (nonatomic, readonly) NSString *devToolsRequestId;
|
||||
|
||||
@property (nonatomic, copy) RCTURLRequestCompletionBlock completionBlock;
|
||||
@property (nonatomic, copy) RCTURLRequestProgressBlock downloadProgressBlock;
|
||||
@@ -40,7 +41,10 @@ typedef NS_ENUM(NSInteger, RCTNetworkTaskStatus) {
|
||||
- (instancetype)initWithRequest:(NSURLRequest *)request
|
||||
handler:(id<RCTURLRequestHandler>)handler
|
||||
callbackQueue:(dispatch_queue_t)callbackQueue NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithDevToolsRequestId:(NSString *)devToolsRequestId
|
||||
request:(NSURLRequest *)request
|
||||
handler:(id<RCTURLRequestHandler>)handler
|
||||
callbackQueue:(dispatch_queue_t)callbackQueue;
|
||||
- (void)start;
|
||||
- (void)cancel;
|
||||
|
||||
|
||||
@@ -26,6 +26,15 @@ static auto currentRequestId = std::atomic<NSUInteger>(0);
|
||||
- (instancetype)initWithRequest:(NSURLRequest *)request
|
||||
handler:(id<RCTURLRequestHandler>)handler
|
||||
callbackQueue:(dispatch_queue_t)callbackQueue
|
||||
{
|
||||
self = [self initWithDevToolsRequestId:nil request:request handler:handler callbackQueue:callbackQueue];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithDevToolsRequestId:(NSString *)devToolsRequestId
|
||||
request:(NSURLRequest *)request
|
||||
handler:(id<RCTURLRequestHandler>)handler
|
||||
callbackQueue:(dispatch_queue_t)callbackQueue
|
||||
{
|
||||
RCTAssertParam(request);
|
||||
RCTAssertParam(handler);
|
||||
@@ -33,6 +42,10 @@ static auto currentRequestId = std::atomic<NSUInteger>(0);
|
||||
|
||||
if ((self = [super init])) {
|
||||
_requestID = @(currentRequestId++);
|
||||
_devToolsRequestId = devToolsRequestId;
|
||||
if (_devToolsRequestId == nil) {
|
||||
_devToolsRequestId = [[NSUUID UUID] UUIDString];
|
||||
}
|
||||
_request = request;
|
||||
_handler = handler;
|
||||
_callbackQueue = callbackQueue;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import "RCTNetworking.h"
|
||||
|
||||
@protocol RCTNetworkingTextResponseHandler <NSObject>
|
||||
|
||||
- (BOOL)canHandleNetworkingTextResponseForRequest:(NSURLRequest *)request;
|
||||
- (void)handleNetworkingResponseText:(NSString *)responseText request:(NSURLRequest *)request;
|
||||
|
||||
@end
|
||||
|
||||
@interface RCTNetworking (Internal)
|
||||
|
||||
- (void)addTextResponseHandler:(id<RCTNetworkingTextResponseHandler>)handler;
|
||||
|
||||
@end
|
||||
@@ -77,12 +77,14 @@ const RCTNetworking = {
|
||||
}));
|
||||
}
|
||||
const requestId = generateRequestId();
|
||||
const devToolsRequestId =
|
||||
global.__NETWORK_REPORTER__?.createDevToolsRequestId();
|
||||
NativeNetworkingAndroid.sendRequest(
|
||||
method,
|
||||
url,
|
||||
requestId,
|
||||
convertHeadersMapToArray(headers),
|
||||
{...body, trackingName},
|
||||
{...body, trackingName, devToolsRequestId},
|
||||
responseType,
|
||||
incrementalUpdates,
|
||||
timeout,
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
*/
|
||||
- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request
|
||||
completionBlock:(RCTURLRequestCompletionBlock)completionBlock;
|
||||
- (RCTNetworkTask *)networkTaskWithDevToolsRequestId:(NSString *)devToolsRequestId
|
||||
request:(NSURLRequest *)request
|
||||
completionBlock:(RCTURLRequestCompletionBlock)completionBlock;
|
||||
|
||||
- (void)addRequestHandler:(id<RCTNetworkingRequestHandler>)handler;
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ const RCTNetworking = {
|
||||
withCredentials: boolean,
|
||||
) {
|
||||
const body = convertRequestBody(data);
|
||||
const devToolsRequestId =
|
||||
global.__NETWORK_REPORTER__?.createDevToolsRequestId();
|
||||
NativeNetworkingIOS.sendRequest(
|
||||
{
|
||||
method,
|
||||
@@ -50,6 +52,7 @@ const RCTNetworking = {
|
||||
incrementalUpdates,
|
||||
timeout,
|
||||
withCredentials,
|
||||
unstable_devToolsRequestId: devToolsRequestId,
|
||||
},
|
||||
callback,
|
||||
);
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#import <React/RCTConvert.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import <React/RCTNetworkTask.h>
|
||||
#import <React/RCTNetworking.h>
|
||||
#import <React/RCTUtils.h>
|
||||
|
||||
#import <React/RCTHTTPRequestHandler.h>
|
||||
@@ -20,6 +19,8 @@
|
||||
|
||||
#import "RCTInspectorNetworkReporter.h"
|
||||
#import "RCTNetworkPlugins.h"
|
||||
#import "RCTNetworking+Internal.h"
|
||||
#import "RCTNetworking.h"
|
||||
|
||||
typedef RCTURLRequestCancellationBlock (^RCTHTTPQueryResult)(NSError *error, NSDictionary<NSString *, id> *result);
|
||||
|
||||
@@ -28,6 +29,7 @@ NSString *const RCTNetworkingPHUploadHackScheme = @"ph-upload";
|
||||
@interface RCTNetworking () <NativeNetworkingIOSSpec>
|
||||
|
||||
- (RCTURLRequestCancellationBlock)processDataForHTTPQuery:(NSDictionary<NSString *, id> *)data
|
||||
devToolsRequestId:(NSString *)devToolsRequestId
|
||||
callback:(RCTHTTPQueryResult)callback;
|
||||
@end
|
||||
|
||||
@@ -69,7 +71,9 @@ static NSString *RCTGenerateFormBoundary()
|
||||
freeWhenDone:YES];
|
||||
}
|
||||
|
||||
- (RCTURLRequestCancellationBlock)process:(NSArray<NSDictionary *> *)formData callback:(RCTHTTPQueryResult)callback
|
||||
- (RCTURLRequestCancellationBlock)process:(NSArray<NSDictionary *> *)formData
|
||||
devToolsRequestId:(NSString *)devToolsRequestId
|
||||
callback:(RCTHTTPQueryResult)callback
|
||||
{
|
||||
RCTAssertThread(_networker.methodQueue, @"process: must be called on request queue");
|
||||
|
||||
@@ -93,12 +97,15 @@ static NSString *RCTGenerateFormBoundary()
|
||||
}
|
||||
|
||||
return [_networker processDataForHTTPQuery:_parts[0]
|
||||
devToolsRequestId:devToolsRequestId
|
||||
callback:^(NSError *error, NSDictionary<NSString *, id> *result) {
|
||||
return [self handleResult:result error:error];
|
||||
return [self handleResult:result error:error devToolsRequestId:devToolsRequestId];
|
||||
}];
|
||||
}
|
||||
|
||||
- (RCTURLRequestCancellationBlock)handleResult:(NSDictionary<NSString *, id> *)result error:(NSError *)error
|
||||
- (RCTURLRequestCancellationBlock)handleResult:(NSDictionary<NSString *, id> *)result
|
||||
error:(NSError *)error
|
||||
devToolsRequestId:(NSString *)devToolsRequestId
|
||||
{
|
||||
RCTAssertThread(_networker.methodQueue, @"handleResult: must be called on request queue");
|
||||
|
||||
@@ -129,8 +136,9 @@ static NSString *RCTGenerateFormBoundary()
|
||||
[_parts removeObjectAtIndex:0];
|
||||
if (_parts.count) {
|
||||
return [_networker processDataForHTTPQuery:_parts[0]
|
||||
devToolsRequestId:devToolsRequestId
|
||||
callback:^(NSError *err, NSDictionary<NSString *, id> *res) {
|
||||
return [self handleResult:res error:err];
|
||||
return [self handleResult:res error:err devToolsRequestId:devToolsRequestId];
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -153,6 +161,7 @@ static NSString *RCTGenerateFormBoundary()
|
||||
NSArray<id<RCTURLRequestHandler>> * (^_handlersProvider)(RCTModuleRegistry *);
|
||||
NSMutableArray<id<RCTNetworkingRequestHandler>> *_requestHandlers;
|
||||
NSMutableArray<id<RCTNetworkingResponseHandler>> *_responseHandlers;
|
||||
NSMutableArray<id<RCTNetworkingTextResponseHandler>> *_textResponseHandlers;
|
||||
dispatch_queue_t _requestQueue;
|
||||
}
|
||||
|
||||
@@ -300,6 +309,7 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
|
||||
- (RCTURLRequestCancellationBlock)buildRequest:(NSDictionary<NSString *, id> *)query
|
||||
devToolsRequestId:(NSString *)devToolsRequestId
|
||||
completionBlock:(void (^)(NSURLRequest *request))block
|
||||
{
|
||||
RCTAssertThread(_methodQueue, @"buildRequest: must be called on request queue");
|
||||
@@ -330,6 +340,7 @@ RCT_EXPORT_MODULE()
|
||||
[NSURLProtocol setProperty:trackingName forKey:@"trackingName" inRequest:request];
|
||||
}
|
||||
return [self processDataForHTTPQuery:data
|
||||
devToolsRequestId:devToolsRequestId
|
||||
callback:^(NSError *error, NSDictionary<NSString *, id> *result) {
|
||||
if (error) {
|
||||
RCTLogError(@"Error processing request body: %@", error);
|
||||
@@ -396,6 +407,7 @@ RCT_EXPORT_MODULE()
|
||||
*/
|
||||
- (RCTURLRequestCancellationBlock)
|
||||
processDataForHTTPQuery:(nullable NSDictionary<NSString *, id> *)query
|
||||
devToolsRequestId:(NSString *)devToolsRequestId
|
||||
callback:(RCTURLRequestCancellationBlock (^)(NSError *error, NSDictionary<NSString *, id> *result))
|
||||
callback
|
||||
{
|
||||
@@ -425,23 +437,24 @@ RCT_EXPORT_MODULE()
|
||||
NSURLRequest *request = [RCTConvert NSURLRequest:query[@"uri"]];
|
||||
if (request) {
|
||||
__block RCTURLRequestCancellationBlock cancellationBlock = nil;
|
||||
RCTNetworkTask *task =
|
||||
[self networkTaskWithRequest:request
|
||||
completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) {
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
cancellationBlock = callback(
|
||||
error, data ? @{@"body" : data, @"contentType" : RCTNullIfNil(response.MIMEType)} : nil);
|
||||
});
|
||||
}];
|
||||
RCTNetworkTask *task = [self
|
||||
networkTaskWithDevToolsRequestId:devToolsRequestId
|
||||
request:request
|
||||
completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) {
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
cancellationBlock = callback(
|
||||
error,
|
||||
data ? @{@"body" : data, @"contentType" : RCTNullIfNil(response.MIMEType)} : nil);
|
||||
});
|
||||
}];
|
||||
|
||||
[task start];
|
||||
|
||||
__weak RCTNetworkTask *weakTask = task;
|
||||
NSNumber *requestId = [task.requestID copy];
|
||||
return ^{
|
||||
[weakTask cancel];
|
||||
if (facebook::react::ReactNativeFeatureFlags::enableNetworkEventReporting()) {
|
||||
[RCTInspectorNetworkReporter reportRequestFailed:requestId cancelled:YES];
|
||||
[RCTInspectorNetworkReporter reportRequestFailed:devToolsRequestId cancelled:YES];
|
||||
}
|
||||
if (cancellationBlock) {
|
||||
cancellationBlock();
|
||||
@@ -452,7 +465,7 @@ RCT_EXPORT_MODULE()
|
||||
if (formData) {
|
||||
RCTHTTPFormDataHelper *formDataHelper = [RCTHTTPFormDataHelper new];
|
||||
formDataHelper.networker = self;
|
||||
return [formDataHelper process:formData callback:callback];
|
||||
return [formDataHelper process:formData devToolsRequestId:devToolsRequestId callback:callback];
|
||||
}
|
||||
// Nothing in the data payload, at least nothing we could understand anyway.
|
||||
// Ignore and treat it as if it were null.
|
||||
@@ -571,7 +584,7 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
bool base64Encoded = [responseType isEqualToString:@"base64"] || [responseType isEqualToString:@"blob"];
|
||||
|
||||
[RCTInspectorNetworkReporter maybeStoreResponseBody:task.requestID
|
||||
[RCTInspectorNetworkReporter maybeStoreResponseBody:task.devToolsRequestId
|
||||
data:responseDataForPreview
|
||||
base64Encoded:base64Encoded];
|
||||
}
|
||||
@@ -583,6 +596,7 @@ RCT_EXPORT_MODULE()
|
||||
responseType:(NSString *)responseType
|
||||
incrementalUpdates:(BOOL)incrementalUpdates
|
||||
responseSender:(RCTResponseSenderBlock)responseSender
|
||||
devToolsRequestId:(NSString *)devToolsRequestId
|
||||
{
|
||||
RCTAssertThread(_methodQueue, @"sendRequest: must be called on request queue");
|
||||
__weak __typeof(self) weakSelf = self;
|
||||
@@ -608,7 +622,7 @@ RCT_EXPORT_MODULE()
|
||||
NSArray<id> *responseJSON = @[ task.requestID, @(status), headers, responseURL ];
|
||||
|
||||
if (facebook::react::ReactNativeFeatureFlags::enableNetworkEventReporting()) {
|
||||
[RCTInspectorNetworkReporter reportResponseStart:task.requestID
|
||||
[RCTInspectorNetworkReporter reportResponseStart:task.devToolsRequestId
|
||||
response:response
|
||||
statusCode:status
|
||||
headers:headers];
|
||||
@@ -648,8 +662,8 @@ RCT_EXPORT_MODULE()
|
||||
];
|
||||
|
||||
if (facebook::react::ReactNativeFeatureFlags::enableNetworkEventReporting()) {
|
||||
[RCTInspectorNetworkReporter reportDataReceived:task.requestID data:data];
|
||||
[RCTInspectorNetworkReporter maybeStoreResponseBodyIncremental:task.requestID data:responseString];
|
||||
[RCTInspectorNetworkReporter reportDataReceived:task.devToolsRequestId data:data];
|
||||
[RCTInspectorNetworkReporter maybeStoreResponseBodyIncremental:task.devToolsRequestId data:responseString];
|
||||
}
|
||||
[weakSelf sendEventWithName:@"didReceiveNetworkIncrementalData" body:responseJSON];
|
||||
};
|
||||
@@ -672,21 +686,33 @@ RCT_EXPORT_MODULE()
|
||||
if (!(incrementalUpdates && [responseType isEqualToString:@"text"])) {
|
||||
[strongSelf sendData:data responseType:responseType response:response forTask:task];
|
||||
}
|
||||
|
||||
if ([responseType isEqualToString:@"text"]) {
|
||||
for (id<RCTNetworkingTextResponseHandler> handler in strongSelf->_textResponseHandlers) {
|
||||
if ([handler canHandleNetworkingTextResponseForRequest:task.request]) {
|
||||
NSString *responseString = [RCTNetworking decodeTextData:data
|
||||
fromResponse:task.response
|
||||
withCarryData:[NSMutableData new]];
|
||||
[handler handleNetworkingResponseText:responseString request:task.request];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NSArray *responseJSON =
|
||||
@[ task.requestID, RCTNullIfNil(error.localizedDescription), error.code == kCFURLErrorTimedOut ? @YES : @NO ];
|
||||
|
||||
if (facebook::react::ReactNativeFeatureFlags::enableNetworkEventReporting()) {
|
||||
if (error != nullptr) {
|
||||
[RCTInspectorNetworkReporter reportRequestFailed:task.requestID cancelled:NO];
|
||||
[RCTInspectorNetworkReporter reportRequestFailed:task.devToolsRequestId cancelled:NO];
|
||||
} else {
|
||||
[RCTInspectorNetworkReporter reportResponseEnd:task.requestID encodedDataLength:data.length];
|
||||
[RCTInspectorNetworkReporter reportResponseEnd:task.devToolsRequestId encodedDataLength:data.length];
|
||||
}
|
||||
}
|
||||
[strongSelf sendEventWithName:@"didCompleteNetworkResponse" body:responseJSON];
|
||||
[strongSelf->_tasksByRequestID removeObjectForKey:task.requestID];
|
||||
};
|
||||
|
||||
task = [self networkTaskWithRequest:request completionBlock:completionBlock];
|
||||
task = [self networkTaskWithDevToolsRequestId:devToolsRequestId request:request completionBlock:completionBlock];
|
||||
task.downloadProgressBlock = downloadProgressBlock;
|
||||
task.incrementalDataBlock = incrementalDataBlock;
|
||||
task.responseBlock = responseBlock;
|
||||
@@ -699,10 +725,10 @@ RCT_EXPORT_MODULE()
|
||||
_tasksByRequestID[task.requestID] = task;
|
||||
responseSender(@[ task.requestID ]);
|
||||
if (facebook::react::ReactNativeFeatureFlags::enableNetworkEventReporting()) {
|
||||
[RCTInspectorNetworkReporter reportRequestStart:task.requestID
|
||||
[RCTInspectorNetworkReporter reportRequestStart:task.devToolsRequestId
|
||||
request:request
|
||||
encodedDataLength:task.response.expectedContentLength];
|
||||
[RCTInspectorNetworkReporter reportConnectionTiming:task.requestID request:task.request];
|
||||
[RCTInspectorNetworkReporter reportConnectionTiming:task.devToolsRequestId request:task.request];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,6 +753,14 @@ RCT_EXPORT_MODULE()
|
||||
[_responseHandlers addObject:handler];
|
||||
}
|
||||
|
||||
- (void)addTextResponseHandler:(id<RCTNetworkingTextResponseHandler>)handler
|
||||
{
|
||||
if (!_textResponseHandlers) {
|
||||
_textResponseHandlers = [NSMutableArray new];
|
||||
}
|
||||
[_textResponseHandlers addObject:handler];
|
||||
}
|
||||
|
||||
- (void)removeRequestHandler:(id<RCTNetworkingRequestHandler>)handler
|
||||
{
|
||||
[_requestHandlers removeObject:handler];
|
||||
@@ -739,6 +773,13 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request
|
||||
completionBlock:(RCTURLRequestCompletionBlock)completionBlock
|
||||
{
|
||||
return [self networkTaskWithDevToolsRequestId:nil request:request completionBlock:completionBlock];
|
||||
}
|
||||
|
||||
- (RCTNetworkTask *)networkTaskWithDevToolsRequestId:(NSString *)devToolsRequestId
|
||||
request:(NSURLRequest *)request
|
||||
completionBlock:(RCTURLRequestCompletionBlock)completionBlock
|
||||
{
|
||||
id<RCTURLRequestHandler> handler = [self handlerForRequest:request];
|
||||
if (!handler) {
|
||||
@@ -746,7 +787,10 @@ RCT_EXPORT_MODULE()
|
||||
return nil;
|
||||
}
|
||||
|
||||
RCTNetworkTask *task = [[RCTNetworkTask alloc] initWithRequest:request handler:handler callbackQueue:_methodQueue];
|
||||
RCTNetworkTask *task = [[RCTNetworkTask alloc] initWithDevToolsRequestId:devToolsRequestId
|
||||
request:request
|
||||
handler:handler
|
||||
callbackQueue:_methodQueue];
|
||||
task.completionBlock = completionBlock;
|
||||
return task;
|
||||
}
|
||||
@@ -765,6 +809,7 @@ RCT_EXPORT_METHOD(sendRequest
|
||||
bool queryIncrementalUpdates = query.incrementalUpdates();
|
||||
double timeout = query.timeout();
|
||||
bool withCredentials = query.withCredentials();
|
||||
NSString *devToolsRequestId = query.unstable_devToolsRequestId();
|
||||
|
||||
dispatch_async(_methodQueue, ^{
|
||||
NSDictionary *queryDict = @{
|
||||
@@ -782,14 +827,16 @@ RCT_EXPORT_METHOD(sendRequest
|
||||
// no way to invoke it, if, for example the request is cancelled while
|
||||
// loading a large file to build the request body
|
||||
[self buildRequest:queryDict
|
||||
completionBlock:^(NSURLRequest *request) {
|
||||
NSString *responseType = [RCTConvert NSString:queryDict[@"responseType"]];
|
||||
BOOL incrementalUpdates = [RCTConvert BOOL:queryDict[@"incrementalUpdates"]];
|
||||
[self sendRequest:request
|
||||
responseType:responseType
|
||||
incrementalUpdates:incrementalUpdates
|
||||
responseSender:responseSender];
|
||||
}];
|
||||
devToolsRequestId:devToolsRequestId
|
||||
completionBlock:^(NSURLRequest *request) {
|
||||
NSString *responseType = [RCTConvert NSString:queryDict[@"responseType"]];
|
||||
BOOL incrementalUpdates = [RCTConvert BOOL:queryDict[@"incrementalUpdates"]];
|
||||
[self sendRequest:request
|
||||
responseType:responseType
|
||||
incrementalUpdates:incrementalUpdates
|
||||
responseSender:responseSender
|
||||
devToolsRequestId:devToolsRequestId];
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -14,6 +14,7 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
|
||||
import type {HostInstance} from 'react-native';
|
||||
|
||||
import ReactNativeElement from '../../../../src/private/webapis/dom/nodes/ReactNativeElement';
|
||||
import TextInput from '../../../Components/TextInput/TextInput';
|
||||
import TextInputState from '../../../Components/TextInput/TextInputState';
|
||||
import View from '../../../Components/View/View';
|
||||
import ReactFabricHostComponent from '../ReactFabricHostComponent';
|
||||
@@ -48,7 +49,7 @@ describe('ReactFabricPublicInstance', () => {
|
||||
const nodeRef = createRef<HostInstance>();
|
||||
|
||||
Fantom.runTask(() => {
|
||||
root.render(<View ref={nodeRef} />);
|
||||
root.render(<TextInput ref={nodeRef} />);
|
||||
});
|
||||
|
||||
const node = nullthrows(nodeRef.current);
|
||||
@@ -73,7 +74,7 @@ describe('ReactFabricPublicInstance', () => {
|
||||
const ref = createRef<HostInstance>();
|
||||
|
||||
Fantom.runTask(() => {
|
||||
root.render(<View ref={ref} />);
|
||||
root.render(<TextInput ref={ref} />);
|
||||
});
|
||||
|
||||
const node = nullthrows(ref.current);
|
||||
|
||||
+5768
-3487
File diff suppressed because it is too large
Load Diff
+1745
-1695
File diff suppressed because it is too large
Load Diff
+3324
-2127
File diff suppressed because it is too large
Load Diff
+5730
-3147
File diff suppressed because it is too large
Load Diff
+1715
-1397
File diff suppressed because it is too large
Load Diff
+3338
-1882
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,9 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow
|
||||
* @generated SignedSource<<cf323fc5ca893bab5669c7d321660412>>
|
||||
* @generated SignedSource<<16b364e89f43b8a47832b0dfb98af11e>>
|
||||
*
|
||||
* This file was sync'd from the facebook/react repository.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow strict-local
|
||||
* @generated SignedSource<<908f5fb85384725318e261f40e49d9a6>>
|
||||
* @generated SignedSource<<1dd9e9c3f20e37ae14e485fc6ee3d9e9>>
|
||||
*
|
||||
* This file was sync'd from the facebook/react repository.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow
|
||||
* @generated SignedSource<<8f46fdc9267fcc4fdc9e76842fe24066>>
|
||||
* @generated SignedSource<<e2c46705ed927302dbe9332dafba459d>>
|
||||
*
|
||||
* This file was sync'd from the facebook/react repository.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow strict
|
||||
* @generated SignedSource<<c0e57723772ea5f1aa8c3c897ac3c216>>
|
||||
* @generated SignedSource<<989e6e2e860dc2af7ba983849111bda8>>
|
||||
*
|
||||
* This file was sync'd from the facebook/react repository.
|
||||
*/
|
||||
|
||||
import type {
|
||||
|
||||
+3
-1
@@ -7,7 +7,9 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow strict-local
|
||||
* @generated SignedSource<<1f7876c0dc0b05685a730513dc410236>>
|
||||
* @generated SignedSource<<67d18226984338ab9301147ce0a7d414>>
|
||||
*
|
||||
* This file was sync'd from the facebook/react repository.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
+3
-1
@@ -7,7 +7,9 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow strict-local
|
||||
* @generated SignedSource<<52163887de05f1cff05388145cf85b3b>>
|
||||
* @generated SignedSource<<556d1487de0b9e4a09cbc67dd130a884>>
|
||||
*
|
||||
* This file was sync'd from the facebook/react repository.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import PackageDescription
|
||||
|
||||
let BUILD_FROM_SOURCE = false
|
||||
|
||||
/**
|
||||
This is the `Package.swift` file that allows to build React Native core using Swift PM.
|
||||
To build React Native, you need to follow these steps:
|
||||
@@ -33,6 +36,8 @@ let RuntimeExecutorPath = "ReactCommon/runtimeexecutor" // header only target
|
||||
let CallInvokerPath = "ReactCommon/callinvoker" // header only target
|
||||
let ReactFBReactNativeSpecPath = "React/FBReactNativeSpec" // generated
|
||||
let FBLazyVectorPath = "Libraries/FBLazyVector" // header only
|
||||
let virtualViewPath = "ReactCommon/react/renderer/components/virtualview" // header only
|
||||
let virtualViewExperimentalPath = "ReactCommon/react/renderer/components/virtualviewexperimental" // header only
|
||||
|
||||
// MARK: Prebuilt Dependencies declaration
|
||||
let reactNativeDependencies = BinaryTarget(
|
||||
@@ -391,6 +396,8 @@ let reactRuntimeApple = RNTarget(
|
||||
dependencies: [.reactNativeDependencies, .jsi, .reactPerfLogger, .reactCxxReact, .rctDeprecation, .yoga, .reactRuntime, .reactRCTFabric, .reactCoreModules, .reactTurboModuleCore, .hermesPrebuilt, .reactUtils]
|
||||
)
|
||||
|
||||
let publicHeadersPathForReactCore: String = BUILD_FROM_SOURCE ? "includes" : "."
|
||||
|
||||
/// React-Core.podspec
|
||||
let reactCore = RNTarget(
|
||||
name: .reactCore,
|
||||
@@ -403,7 +410,8 @@ let reactCore = RNTarget(
|
||||
linkedFrameworks: ["CoreServices"],
|
||||
excludedPaths: ["Fabric", "Tests", "Resources", "Runtime/RCTJscInstanceFactory.mm", "I18n/strings", "CxxBridge/JSCExecutorFactory.mm", "CoreModules"],
|
||||
dependencies: [.reactNativeDependencies, .reactCxxReact, .reactPerfLogger, .jsi, .reactJsiExecutor, .reactUtils, .reactFeatureFlags, .reactRuntimeScheduler, .yoga, .reactJsInspector, .reactJsiTooling, .rctDeprecation, .reactCoreRCTWebsocket, .reactRCTImage, .reactTurboModuleCore, .reactRCTText, .reactRCTBlob, .reactRCTAnimation, .reactRCTNetwork, .reactFabric, .hermesPrebuilt],
|
||||
sources: [".", "Runtime/RCTHermesInstanceFactory.mm"]
|
||||
sources: [".", "Runtime/RCTHermesInstanceFactory.mm"],
|
||||
publicHeadersPath: publicHeadersPathForReactCore
|
||||
)
|
||||
|
||||
/// React-Fabric.podspec
|
||||
@@ -434,6 +442,7 @@ let reactFabric = RNTarget(
|
||||
"components/modal",
|
||||
"components/rncore",
|
||||
"components/safeareaview",
|
||||
"components/switch",
|
||||
"components/text",
|
||||
"components/textinput",
|
||||
"components/textinput/platform/ios/",
|
||||
@@ -446,37 +455,66 @@ let reactFabric = RNTarget(
|
||||
sources: ["animations", "attributedstring", "core", "componentregistry", "componentregistry/native", "components/root", "components/view", "components/view/platform/cxx", "components/scrollview", "components/scrollview/platform/cxx", "components/legacyviewmanagerinterop", "dom", "scheduler", "mounting", "observers/events", "telemetry", "consistency", "leakchecker", "uimanager", "uimanager/consistency"]
|
||||
)
|
||||
|
||||
/// React-RCTFabric.podspec
|
||||
let reactRCTFabric = RNTarget(
|
||||
name: .reactRCTFabric,
|
||||
path: "React/Fabric",
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactRCTImage, .yoga, .reactRCTText, .jsi, .reactFabricComponents, .reactGraphics, .reactImageManager, .reactDebug, .reactUtils, .reactPerformanceTimeline, .reactRendererDebug, .reactRendererConsistency, .reactRuntimeScheduler, .reactRCTAnimation, .reactJsInspector, .reactJsInspectorNetwork, .reactJsInspectorTracing, .reactFabric, .reactFabricImage, .rctSwiftUIWrapper]
|
||||
let reactFabricInputAccessory = RNTarget(
|
||||
name: .reactFabricInputAccessory,
|
||||
path: "ReactCommon/react/renderer/components/inputaccessory",
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
|
||||
)
|
||||
|
||||
/// React-FabricComponents.podspec
|
||||
let reactFabricComponents = RNTarget(
|
||||
name: .reactFabricComponents,
|
||||
path: "ReactCommon/react/renderer",
|
||||
let reactFabricModal = RNTarget(
|
||||
name: .reactFabricModal,
|
||||
path: "ReactCommon/react/renderer/components/modal",
|
||||
excludedPaths: [
|
||||
"components/modal/platform/android",
|
||||
"components/modal/platform/cxx",
|
||||
"components/view/platform/android",
|
||||
"components/view/platform/windows",
|
||||
"components/view/platform/macos",
|
||||
"components/switch/iosswitch/react/renderer/components/switch/MacOSSwitchShadowNode.mm",
|
||||
"components/textinput/platform/android",
|
||||
"components/text/platform/android",
|
||||
"components/textinput/platform/macos",
|
||||
"components/text/tests",
|
||||
"textlayoutmanager/tests",
|
||||
"textlayoutmanager/platform/android",
|
||||
"textlayoutmanager/platform/cxx",
|
||||
"textlayoutmanager/platform/windows",
|
||||
"textlayoutmanager/platform/macos",
|
||||
"conponents/rncore", // this was the old folder where RN Core Components were generated. If you ran codegen in the past, you might have some files in it that might make the build fail.
|
||||
"platform/android",
|
||||
"platform/cxx",
|
||||
],
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
|
||||
)
|
||||
|
||||
let reactFabricSwitch = RNTarget(
|
||||
name: .reactFabricSwitch,
|
||||
path: "ReactCommon/react/renderer/components/switch/iosswitch",
|
||||
excludedPaths: ["react/renderer/components/switch/MacOSSwitchShadowNode.mm"],
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
|
||||
)
|
||||
|
||||
let reactFabricSafeAreaView = RNTarget(
|
||||
name: .reactFabricSafeAreaView,
|
||||
path: "ReactCommon/react/renderer/components/safeareaview",
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
|
||||
)
|
||||
|
||||
let reactFabricTextLayoutManager = RNTarget(
|
||||
name: .reactFabricTextLayoutManager,
|
||||
path: "ReactCommon/react/renderer/textlayoutmanager",
|
||||
excludedPaths: [
|
||||
"platform/android",
|
||||
"platform/cxx",
|
||||
"platform/windows",
|
||||
"platform/macos",
|
||||
"tests",
|
||||
],
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging],
|
||||
sources: ["components/inputaccessory", "components/modal", "components/safeareaview", "components/text", "components/text/platform/cxx", "components/textinput", "components/textinput/platform/ios/", "components/unimplementedview", "components/virtualview", "components/virtualviewexperimental", "textlayoutmanager", "textlayoutmanager/platform/ios", "components/switch/iosswitch"]
|
||||
sources: [".", "platform/ios"]
|
||||
)
|
||||
|
||||
let reactFabricText = RNTarget(
|
||||
name: .reactFabricText,
|
||||
path: "ReactCommon/react/renderer/components/text",
|
||||
excludedPaths: [
|
||||
"platform/android",
|
||||
"tests",
|
||||
],
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging, .reactFabricTextLayoutManager],
|
||||
sources: [".", "platform/cxx"]
|
||||
)
|
||||
|
||||
let reactFabricTextInput = RNTarget(
|
||||
name: .reactFabricTextInput,
|
||||
path: "ReactCommon/react/renderer/components/textinput",
|
||||
excludedPaths: ["platform/android", "platform/macos"],
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging, .reactFabricTextLayoutManager],
|
||||
sources: [".", "platform/ios"]
|
||||
)
|
||||
|
||||
/// React-FabricImage.podspec
|
||||
@@ -487,6 +525,20 @@ let reactFabricImage = RNTarget(
|
||||
dependencies: [.reactNativeDependencies, .reactFabric, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactTurboModuleBridging, .reactImageManagerApple]
|
||||
)
|
||||
|
||||
let reactFabricUnimplementedView = RNTarget(
|
||||
name: .reactFabricUnimplementedView,
|
||||
path: "ReactCommon/react/renderer/components/unimplementedview",
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
|
||||
)
|
||||
|
||||
/// React-RCTFabric.podspec
|
||||
let reactRCTFabric = RNTarget(
|
||||
name: .reactRCTFabric,
|
||||
path: "React/Fabric",
|
||||
searchPaths: [virtualViewPath, virtualViewExperimentalPath],
|
||||
dependencies: [.reactNativeDependencies, .reactCore, .reactRCTImage, .yoga, .reactRCTText, .jsi, .reactFabricInputAccessory, .reactFabricModal, .reactFabricSafeAreaView, .reactFabricSwitch, .reactFabricText, .reactFabricTextInput, .reactFabricUnimplementedView, .reactFabricTextLayoutManager, .reactGraphics, .reactImageManager, .reactDebug, .reactUtils, .reactPerformanceTimeline, .reactRendererDebug, .reactRendererConsistency, .reactRuntimeScheduler, .reactRCTAnimation, .reactJsInspector, .reactJsInspectorNetwork, .reactJsInspectorTracing, .reactFabric, .reactFabricImage, .rctSwiftUIWrapper]
|
||||
)
|
||||
|
||||
/// React-ImageManagerApple.podspec
|
||||
let reactImageManagerApple = RNTarget(
|
||||
name: .reactImageManagerApple,
|
||||
@@ -593,8 +645,15 @@ let targets = [
|
||||
rctSwiftUI,
|
||||
rctSwiftUIWrapper,
|
||||
reactRCTFabric,
|
||||
reactFabricComponents,
|
||||
reactFabricImage,
|
||||
reactFabricInputAccessory,
|
||||
reactFabricModal,
|
||||
reactFabricSafeAreaView,
|
||||
reactFabricSwitch,
|
||||
reactFabricTextLayoutManager,
|
||||
reactFabricText,
|
||||
reactFabricTextInput,
|
||||
reactFabricUnimplementedView,
|
||||
reactNativeDependencies,
|
||||
hermesPrebuilt,
|
||||
reactJsiTooling,
|
||||
@@ -762,12 +821,20 @@ extension String {
|
||||
static let reactJsInspector = "React-jsinspector"
|
||||
static let reactJsInspectorTracing = "React-jsinspectortracing"
|
||||
static let reactCxxReact = "React-cxxreact"
|
||||
static let reactCore = "React-Core"
|
||||
static let reactCoreRCTWebsocket = "React-Core/RCTWebSocket"
|
||||
static let reactCore = "React"
|
||||
static let reactCoreRCTWebsocket = "React/RCTWebSocket"
|
||||
static let reactFabric = "React-Fabric"
|
||||
static let reactRCTFabric = "React-RCTFabric"
|
||||
static let reactFabricComponents = "React-FabricComponents"
|
||||
|
||||
static let reactFabricImage = "React-FabricImage"
|
||||
static let reactFabricInputAccessory = "React-FabricInputAccessory"
|
||||
static let reactFabricModal = "React-FabricModal"
|
||||
static let reactFabricSafeAreaView = "React-FabricSafeAreaView"
|
||||
static let reactFabricSwitch = "React-FabricSwitch"
|
||||
static let reactFabricTextLayoutManager = "React-FabricTextLayoutManager"
|
||||
static let reactFabricText = "React-FabricText"
|
||||
static let reactFabricTextInput = "React-FabricTextInput"
|
||||
static let reactFabricUnimplementedView = "React-FabricUnimplementedView"
|
||||
|
||||
static let reactNativeDependencies = "ReactNativeDependencies"
|
||||
|
||||
|
||||
@@ -37,8 +37,13 @@ RCT_EXTERN BOOL RCTIsMainQueue(void);
|
||||
do { \
|
||||
} while (false)
|
||||
#endif
|
||||
RCT_EXTERN void _RCTAssertFormat(const char *, const char *, int, const char *, NSString *, ...)
|
||||
NS_FORMAT_FUNCTION(5, 6);
|
||||
RCT_EXTERN void _RCTAssertFormat(
|
||||
const char * /*condition*/,
|
||||
const char * /*fileName*/,
|
||||
int /*lineNumber*/,
|
||||
const char * /*function*/,
|
||||
NSString * /*format*/,
|
||||
...) NS_FORMAT_FUNCTION(5, 6);
|
||||
|
||||
/**
|
||||
* Report a fatal condition when executing. These calls will _NOT_ be compiled out
|
||||
|
||||
@@ -22,7 +22,7 @@ RCTAssertFunction RCTCurrentAssertFunction = nil;
|
||||
RCTFatalHandler RCTCurrentFatalHandler = nil;
|
||||
RCTFatalExceptionHandler RCTCurrentFatalExceptionHandler = nil;
|
||||
|
||||
NSException *_RCTNotImplementedException(SEL, Class);
|
||||
NSException *_RCTNotImplementedException(SEL /*cmd*/, Class /*cls*/);
|
||||
NSException *_RCTNotImplementedException(SEL cmd, Class cls)
|
||||
{
|
||||
NSString *msg = [NSString stringWithFormat:
|
||||
|
||||
@@ -117,7 +117,7 @@ NSSet<NSString *> *getCoreModuleClasses(void)
|
||||
}
|
||||
|
||||
static NSMutableArray<NSString *> *modulesLoadedWithOldArch;
|
||||
void addModuleLoadedWithOldArch(NSString *);
|
||||
void addModuleLoadedWithOldArch(NSString * /*moduleName*/);
|
||||
void addModuleLoadedWithOldArch(NSString *moduleName)
|
||||
{
|
||||
static dispatch_once_t onceToken;
|
||||
@@ -138,7 +138,7 @@ NSMutableArray<NSString *> *getModulesLoadedWithOldArch(void)
|
||||
* prior to the first bridge initialization.
|
||||
* TODO: (T115656171) Refactor RCTRegisterModule out of Bridge.m since it doesn't use the Bridge.
|
||||
*/
|
||||
void RCTRegisterModule(Class);
|
||||
void RCTRegisterModule(Class /*moduleClass*/);
|
||||
void RCTRegisterModule(Class moduleClass)
|
||||
{
|
||||
if (RCTAreLegacyLogsEnabled() && ![getCoreModuleClasses() containsObject:[moduleClass description]]) {
|
||||
|
||||
@@ -69,7 +69,7 @@ RCT_EXTERN_C_END
|
||||
* will be used as the JS module name. If omitted, the JS module name will
|
||||
* match the Objective-C class name.
|
||||
*/
|
||||
#ifndef RCT_REMOVE_LEGACY_ARCH
|
||||
#ifndef RCT_DISABLE_STATIC_MODULE_REGISTRATION
|
||||
#define RCT_EXPORT_MODULE(js_name) \
|
||||
RCT_EXTERN void RCTRegisterModule(Class); \
|
||||
+(NSString *)moduleName \
|
||||
@@ -90,7 +90,7 @@ RCT_EXTERN_C_END
|
||||
return @ #js_name; \
|
||||
}
|
||||
|
||||
#endif // RCT_REMOVE_LEGACY_ARCH
|
||||
#endif // RCT_DISABLE_STATIC_MODULE_REGISTRATION
|
||||
|
||||
/**
|
||||
* Same as RCT_EXPORT_MODULE, but uses __attribute__((constructor)) for module
|
||||
|
||||
@@ -18,7 +18,7 @@ NSString *const RCTBundleURLProviderUpdatedNotification = @"RCTBundleURLProvider
|
||||
|
||||
const NSUInteger kRCTBundleURLProviderDefaultPort = RCT_METRO_PORT;
|
||||
|
||||
#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY
|
||||
#if RCT_DEV | RCT_PACKAGER_LOADING_FUNCTIONALITY
|
||||
static BOOL kRCTAllowPackagerAccess = YES;
|
||||
void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed)
|
||||
{
|
||||
@@ -78,7 +78,7 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
|
||||
(unsigned long)kRCTBundleURLProviderDefaultPort]];
|
||||
}
|
||||
|
||||
#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY
|
||||
#if RCT_DEV | RCT_PACKAGER_LOADING_FUNCTIONALITY
|
||||
+ (BOOL)isPackagerRunning:(NSString *)hostPort
|
||||
{
|
||||
return [RCTBundleURLProvider isPackagerRunning:hostPort scheme:nil];
|
||||
@@ -155,14 +155,14 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
|
||||
|
||||
- (NSString *)packagerServerHostPort
|
||||
{
|
||||
#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY
|
||||
#if RCT_DEV | RCT_PACKAGER_LOADING_FUNCTIONALITY
|
||||
if (!kRCTAllowPackagerAccess) {
|
||||
RCTLogInfo(@"Packager server access is disabled in this environment");
|
||||
return nil;
|
||||
}
|
||||
#endif
|
||||
NSString *location = [self jsLocation];
|
||||
#if RCT_DEV_MENU
|
||||
#if RCT_DEV
|
||||
NSString *scheme = [self packagerScheme];
|
||||
if ([location length] && ![RCTBundleURLProvider isPackagerRunning:location scheme:scheme]) {
|
||||
location = nil;
|
||||
|
||||
@@ -177,9 +177,14 @@ typedef NSArray UIColorArray __deprecated_msg("Use NSArray<UIColor *>");
|
||||
/**
|
||||
* Underlying implementations of RCT_XXX_CONVERTER macros. Ignore these.
|
||||
*/
|
||||
RCT_EXTERN NSNumber *RCTConvertEnumValue(const char *, NSDictionary *, NSNumber *, id);
|
||||
RCT_EXTERN NSNumber *RCTConvertMultiEnumValue(const char *, NSDictionary *, NSNumber *, id);
|
||||
RCT_EXTERN NSArray *RCTConvertArrayValue(SEL, id);
|
||||
RCT_EXTERN NSNumber *
|
||||
RCTConvertEnumValue(const char * /*typeName*/, NSDictionary * /*mapping*/, NSNumber * /*defaultValue*/, id /*json*/);
|
||||
RCT_EXTERN NSNumber *RCTConvertMultiEnumValue(
|
||||
const char * /*typeName*/,
|
||||
NSDictionary * /*mapping*/,
|
||||
NSNumber * /*defaultValue*/,
|
||||
id /*json*/);
|
||||
RCT_EXTERN NSArray *RCTConvertArrayValue(SEL /*type*/, id /*json*/);
|
||||
|
||||
/**
|
||||
* This macro is used for logging conversion errors. This is just used to
|
||||
|
||||
@@ -75,12 +75,12 @@ RCTFormatLog(NSDate *timestamp, RCTLogLevel level, NSString *fileName, NSNumber
|
||||
/**
|
||||
* A method to generate a string RCTLogLevel
|
||||
*/
|
||||
RCT_EXTERN NSString *RCTFormatLogLevel(RCTLogLevel);
|
||||
RCT_EXTERN NSString *RCTFormatLogLevel(RCTLogLevel /*level*/);
|
||||
|
||||
/**
|
||||
* A method to generate a string from a RCTLogSource
|
||||
*/
|
||||
RCT_EXTERN NSString *RCTFormatLogSource(RCTLogSource);
|
||||
RCT_EXTERN NSString *RCTFormatLogSource(RCTLogSource /*source*/);
|
||||
|
||||
/**
|
||||
* The default logging function used by RCTLogXX.
|
||||
@@ -149,5 +149,7 @@ RCT_EXTERN void RCTLogSetBridgelessCallableJSModules(RCTCallableJSModules *calla
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
RCT_EXTERN void _RCTLogNativeInternal(RCTLogLevel, const char *, int, NSString *, ...) NS_FORMAT_FUNCTION(4, 5);
|
||||
RCT_EXTERN void _RCTLogJavaScriptInternal(RCTLogLevel, NSString *);
|
||||
RCT_EXTERN void
|
||||
_RCTLogNativeInternal(RCTLogLevel /*level*/, const char * /*fileName*/, int /*lineNumber*/, NSString * /*format*/, ...)
|
||||
NS_FORMAT_FUNCTION(4, 5);
|
||||
RCT_EXTERN void _RCTLogJavaScriptInternal(RCTLogLevel /*level*/, NSString * /*message*/);
|
||||
|
||||
@@ -706,7 +706,7 @@ NSURL *RCTDataURL(NSString *mimeType, NSData *data)
|
||||
[data base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0]]];
|
||||
}
|
||||
|
||||
BOOL RCTIsGzippedData(NSData *__nullable); // exposed for unit testing purposes
|
||||
BOOL RCTIsGzippedData(NSData *__nullable /*data*/); // exposed for unit testing purposes
|
||||
BOOL RCTIsGzippedData(NSData *__nullable data)
|
||||
{
|
||||
UInt8 *bytes = (UInt8 *)data.bytes;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#import <React/RCTEventEmitter.h>
|
||||
|
||||
RCT_EXTERN void RCTEnableAppearancePreference(BOOL enabled);
|
||||
RCT_EXTERN void RCTOverrideAppearancePreference(NSString *);
|
||||
RCT_EXTERN void RCTOverrideAppearancePreference(NSString * /*colorSchemeOverride*/);
|
||||
RCT_EXTERN void RCTUseKeyWindowForSystemStyle(BOOL useMainScreen);
|
||||
RCT_EXTERN NSString *RCTCurrentOverrideAppearancePreference(void);
|
||||
RCT_EXTERN NSString *RCTColorSchemePreference(UITraitCollection *traitCollection);
|
||||
|
||||
@@ -12,12 +12,26 @@
|
||||
#import <React/RCTBridgeProxy.h>
|
||||
#import <React/RCTDefines.h>
|
||||
|
||||
#if RCT_DEV_MENU
|
||||
|
||||
RCT_EXTERN NSString *const RCTShowDevMenuNotification;
|
||||
|
||||
@interface RCTDevMenuConfiguration : NSObject
|
||||
|
||||
#if RCT_DEV_MENU
|
||||
|
||||
@property (nonatomic, readonly) BOOL devMenuEnabled;
|
||||
@property (nonatomic, readonly) BOOL shakeGestureEnabled;
|
||||
@property (nonatomic, readonly) BOOL keyboardShortcutsEnabled;
|
||||
|
||||
- (instancetype)initWithDevMenuEnabled:(BOOL)devMenuEnabled
|
||||
shakeGestureEnabled:(BOOL)shakeGestureEnabled
|
||||
keyboardShortcutsEnabled:(BOOL)keyboardShortcutsEnabled;
|
||||
|
||||
#endif
|
||||
|
||||
+ (instancetype)defaultConfiguration;
|
||||
|
||||
@end
|
||||
|
||||
@class RCTDevMenuItem;
|
||||
|
||||
/**
|
||||
@@ -45,6 +59,16 @@ RCT_EXTERN NSString *const RCTShowDevMenuNotification;
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL hotkeysEnabled;
|
||||
|
||||
/**
|
||||
* Whether the developer menu is enabled.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL devMenuEnabled;
|
||||
|
||||
/**
|
||||
* Whether keyboard shortcuts are enabled.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL keyboardShortcutsEnabled;
|
||||
|
||||
/**
|
||||
* Presented items in development menu
|
||||
*/
|
||||
@@ -76,6 +100,11 @@ RCT_EXTERN NSString *const RCTShowDevMenuNotification;
|
||||
*/
|
||||
- (void)addItem:(RCTDevMenuItem *)item;
|
||||
|
||||
/**
|
||||
* Disable the reload command (Cmd+R) in the simulator.
|
||||
*/
|
||||
- (void)disableReloadCommand;
|
||||
|
||||
@end
|
||||
|
||||
typedef NSString * (^RCTDevMenuItemTitleBlock)(void);
|
||||
|
||||
@@ -29,6 +29,27 @@
|
||||
|
||||
NSString *const RCTShowDevMenuNotification = @"RCTShowDevMenuNotification";
|
||||
|
||||
@implementation RCTDevMenuConfiguration
|
||||
- (instancetype)initWithDevMenuEnabled:(BOOL)devMenuEnabled
|
||||
shakeGestureEnabled:(BOOL)shakeGestureEnabled
|
||||
keyboardShortcutsEnabled:(BOOL)keyboardShortcutsEnabled
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_devMenuEnabled = devMenuEnabled;
|
||||
_shakeGestureEnabled = shakeGestureEnabled;
|
||||
_keyboardShortcutsEnabled = keyboardShortcutsEnabled;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)defaultConfiguration
|
||||
{
|
||||
return [[self alloc] initWithDevMenuEnabled:RCT_DEV_MENU
|
||||
shakeGestureEnabled:RCT_DEV_MENU
|
||||
keyboardShortcutsEnabled:RCT_DEV_MENU];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation UIWindow (RCTDevMenu)
|
||||
|
||||
- (void)RCT_motionEnded:(__unused UIEventSubtype)motion withEvent:(UIEvent *)event
|
||||
@@ -127,6 +148,8 @@ RCT_EXPORT_MODULE()
|
||||
object:nil];
|
||||
_extraMenuItems = [NSMutableArray new];
|
||||
|
||||
_keyboardShortcutsEnabled = true;
|
||||
_devMenuEnabled = true;
|
||||
[self registerHotkeys];
|
||||
}
|
||||
return self;
|
||||
@@ -162,7 +185,6 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
[commands unregisterKeyCommandWithInput:@"d" modifierFlags:UIKeyModifierCommand];
|
||||
[commands unregisterKeyCommandWithInput:@"i" modifierFlags:UIKeyModifierCommand];
|
||||
[commands unregisterKeyCommandWithInput:@"n" modifierFlags:UIKeyModifierCommand];
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -172,13 +194,30 @@ RCT_EXPORT_MODULE()
|
||||
RCTKeyCommands *commands = [RCTKeyCommands sharedInstance];
|
||||
|
||||
return [commands isKeyCommandRegisteredForInput:@"d" modifierFlags:UIKeyModifierCommand] &&
|
||||
[commands isKeyCommandRegisteredForInput:@"i" modifierFlags:UIKeyModifierCommand] &&
|
||||
[commands isKeyCommandRegisteredForInput:@"n" modifierFlags:UIKeyModifierCommand];
|
||||
[commands isKeyCommandRegisteredForInput:@"i" modifierFlags:UIKeyModifierCommand];
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (BOOL)isReloadCommandRegistered
|
||||
{
|
||||
#if TARGET_OS_SIMULATOR || TARGET_OS_MACCATALYST
|
||||
RCTKeyCommands *commands = [RCTKeyCommands sharedInstance];
|
||||
return [commands isKeyCommandRegisteredForInput:@"r" modifierFlags:UIKeyModifierCommand];
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)unregisterReloadCommand
|
||||
{
|
||||
#if TARGET_OS_SIMULATOR || TARGET_OS_MACCATALYST
|
||||
RCTKeyCommands *commands = [RCTKeyCommands sharedInstance];
|
||||
[commands unregisterKeyCommandWithInput:@"r" modifierFlags:UIKeyModifierCommand];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (dispatch_queue_t)methodQueue
|
||||
{
|
||||
return dispatch_get_main_queue();
|
||||
@@ -240,6 +279,17 @@ RCT_EXPORT_MODULE()
|
||||
[_extraMenuItems addObject:item];
|
||||
}
|
||||
|
||||
- (void)setKeyboardShortcutsEnabled:(BOOL)keyboardShortcutsEnabled
|
||||
{
|
||||
if (_keyboardShortcutsEnabled != keyboardShortcutsEnabled) {
|
||||
[self setHotkeysEnabled:keyboardShortcutsEnabled];
|
||||
|
||||
if (!keyboardShortcutsEnabled) {
|
||||
[self disableReloadCommand];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setDefaultJSBundle
|
||||
{
|
||||
[[RCTBundleURLProvider sharedSettings] resetToDefaults];
|
||||
@@ -382,7 +432,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
RCT_EXPORT_METHOD(show)
|
||||
{
|
||||
if ((_actionSheet != nullptr) || RCTRunningInAppExtension()) {
|
||||
if ((_actionSheet != nullptr) || RCTRunningInAppExtension() || !_devMenuEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -437,7 +487,7 @@ RCT_EXPORT_METHOD(show)
|
||||
|
||||
- (void)setShakeToShow:(BOOL)shakeToShow
|
||||
{
|
||||
((RCTDevSettings *)[_moduleRegistry moduleForName:"DevSettings"]).isShakeToShowDevMenuEnabled = shakeToShow;
|
||||
[[_moduleRegistry moduleForName:"DevSettings"] setIsShakeToShowDevMenuEnabled:shakeToShow];
|
||||
}
|
||||
|
||||
- (BOOL)shakeToShow
|
||||
@@ -487,6 +537,13 @@ RCT_EXPORT_METHOD(setHotLoadingEnabled : (BOOL)enabled)
|
||||
return [self isHotkeysRegistered];
|
||||
}
|
||||
|
||||
- (void)disableReloadCommand
|
||||
{
|
||||
if ([self isReloadCommandRegistered]) {
|
||||
[self unregisterReloadCommand];
|
||||
}
|
||||
}
|
||||
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
||||
(const facebook::react::ObjCTurboModule::InitParams &)params
|
||||
{
|
||||
@@ -500,6 +557,15 @@ RCT_EXPORT_METHOD(setHotLoadingEnabled : (BOOL)enabled)
|
||||
@interface RCTDevMenu () <NativeDevMenuSpec>
|
||||
@end
|
||||
|
||||
@implementation RCTDevMenuConfiguration
|
||||
|
||||
+ (instancetype)defaultConfiguration
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation RCTDevMenu
|
||||
|
||||
- (void)show
|
||||
@@ -515,6 +581,10 @@ RCT_EXPORT_METHOD(setHotLoadingEnabled : (BOOL)enabled)
|
||||
{
|
||||
}
|
||||
|
||||
- (void)disableReloadCommand
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)isActionSheetShown
|
||||
{
|
||||
return NO;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <React/RCTBridgeModule.h>
|
||||
|
||||
@class RCTDevMenuConfiguration;
|
||||
|
||||
@interface RCTDevMenuConfigurationDecorator : NSObject
|
||||
|
||||
#if RCT_DEV_MENU
|
||||
|
||||
@property (nonatomic, strong, readonly) RCTDevMenuConfiguration *__nullable devMenuConfiguration;
|
||||
|
||||
- (instancetype)initWithDevMenuConfiguration:(RCTDevMenuConfiguration *__nullable)devMenuConfiguration;
|
||||
- (void)decorate:(id<RCTBridgeModule>)devMenuModule;
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import "RCTDevMenuConfigurationDecorator.h"
|
||||
|
||||
#if RCT_DEV_MENU
|
||||
|
||||
#import <React/RCTDevMenu.h>
|
||||
#import <React/RCTDevSettings.h>
|
||||
|
||||
@implementation RCTDevMenuConfigurationDecorator
|
||||
|
||||
- (instancetype)initWithDevMenuConfiguration:(RCTDevMenuConfiguration *__nullable)devMenuConfiguration
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_devMenuConfiguration = devMenuConfiguration;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)decorate:(id<RCTBridgeModule>)bridgeModule
|
||||
{
|
||||
if (_devMenuConfiguration == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ([bridgeModule isKindOfClass:[RCTDevMenu class]]) {
|
||||
RCTDevMenu *devMenu = (RCTDevMenu *)bridgeModule;
|
||||
devMenu.devMenuEnabled = _devMenuConfiguration.devMenuEnabled;
|
||||
devMenu.keyboardShortcutsEnabled = _devMenuConfiguration.keyboardShortcutsEnabled;
|
||||
}
|
||||
|
||||
if ([bridgeModule isKindOfClass:[RCTDevSettings class]]) {
|
||||
RCTDevSettings *devSettings = (RCTDevSettings *)bridgeModule;
|
||||
devSettings.isShakeGestureEnabled = _devMenuConfiguration.shakeGestureEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#else
|
||||
|
||||
@implementation RCTDevMenuConfigurationDecorator : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -65,6 +65,11 @@
|
||||
*/
|
||||
@property (nonatomic, assign, setter=setHotLoadingEnabled:) BOOL isHotLoadingEnabled;
|
||||
|
||||
/**
|
||||
* Whether shake gesture is enabled.
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL isShakeGestureEnabled;
|
||||
|
||||
/**
|
||||
* Enables starting of profiling sampler on launch
|
||||
*/
|
||||
|
||||
@@ -145,6 +145,7 @@ RCT_EXPORT_MODULE()
|
||||
};
|
||||
RCTDevSettingsUserDefaultsDataSource *dataSource =
|
||||
[[RCTDevSettingsUserDefaultsDataSource alloc] initWithDefaultValues:defaultValues];
|
||||
_isShakeGestureEnabled = true;
|
||||
return [self initWithDataSource:dataSource];
|
||||
}
|
||||
|
||||
@@ -262,6 +263,12 @@ RCT_EXPORT_MODULE()
|
||||
return [_dataSource settingForKey:key];
|
||||
}
|
||||
|
||||
- (void)setIsShakeGestureEnabled:(BOOL)isShakeGestureEnabled
|
||||
{
|
||||
_isShakeGestureEnabled = isShakeGestureEnabled;
|
||||
[self setIsShakeToShowDevMenuEnabled:isShakeGestureEnabled];
|
||||
}
|
||||
|
||||
- (BOOL)isDeviceDebuggingAvailable
|
||||
{
|
||||
#if RCT_ENABLE_INSPECTOR
|
||||
@@ -305,7 +312,7 @@ RCT_EXPORT_METHOD(setIsShakeToShowDevMenuEnabled : (BOOL)enabled)
|
||||
|
||||
- (BOOL)isShakeToShowDevMenuEnabled
|
||||
{
|
||||
return [[self settingForKey:kRCTDevSettingShakeToShowDevMenu] boolValue];
|
||||
return _isShakeGestureEnabled && [[self settingForKey:kRCTDevSettingShakeToShowDevMenu] boolValue];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setProfilingEnabled : (BOOL)enabled)
|
||||
|
||||
@@ -11,4 +11,6 @@
|
||||
|
||||
@interface RCTDeviceInfo : NSObject <RCTBridgeModule>
|
||||
|
||||
- (instancetype)initWithDimensionsProvider:(NSDictionary * (^)(void))dimensionsProvider;
|
||||
|
||||
@end
|
||||
|
||||
@@ -32,6 +32,7 @@ using namespace facebook::react;
|
||||
NSDictionary *_constants;
|
||||
|
||||
__weak UIWindow *_applicationWindow;
|
||||
NSDictionary * (^_dimensionsProvider)(void);
|
||||
}
|
||||
|
||||
static NSString *const kFrameKeyPath = @"frame";
|
||||
@@ -49,6 +50,14 @@ RCT_EXPORT_MODULE()
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithDimensionsProvider:(NSDictionary * (^)(void))dimensionsProvider
|
||||
{
|
||||
if (self = [self init]) {
|
||||
_dimensionsProvider = dimensionsProvider;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath
|
||||
ofObject:(id)object
|
||||
change:(NSDictionary *)change
|
||||
@@ -199,6 +208,15 @@ static NSDictionary *RCTExportedDimensions(CGFloat fontScale)
|
||||
|
||||
- (NSDictionary *)_exportedDimensions
|
||||
{
|
||||
// if a window size provider has been set, use that. If nil is returned from the provider
|
||||
// it will fall back to the default behavior.
|
||||
if (_dimensionsProvider != nil) {
|
||||
auto dimensions = _dimensionsProvider();
|
||||
if (dimensions != nil) {
|
||||
return dimensions;
|
||||
}
|
||||
}
|
||||
|
||||
RCTAssert(!_invalidated, @"Failed to get exported dimensions: RCTDeviceInfo has been invalidated");
|
||||
RCTAssert(_moduleRegistry, @"Failed to get exported dimensions: RCTModuleRegistry is nil");
|
||||
RCTAccessibilityManager *accessibilityManager =
|
||||
|
||||
@@ -54,10 +54,6 @@
|
||||
#import "RCTMessageThread.h"
|
||||
#import "RCTObjcExecutor.h"
|
||||
|
||||
#ifdef WITH_FBSYSTRACE
|
||||
#import <React/RCTFBSystrace.h>
|
||||
#endif
|
||||
|
||||
#if RCT_DEV_MENU && __has_include(<React/RCTDevLoadingViewProtocol.h>)
|
||||
#import <React/RCTDevLoadingViewProtocol.h>
|
||||
#endif
|
||||
@@ -1507,9 +1503,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithBundleURL
|
||||
RCTAssertMainQueue();
|
||||
|
||||
[self ensureOnJavaScriptThread:^{
|
||||
#if WITH_FBSYSTRACE
|
||||
[RCTFBSystrace registerCallbacks];
|
||||
#endif
|
||||
RCTProfileInit(self);
|
||||
|
||||
[self enqueueJSCall:@"Systrace" method:@"setEnabled" args:@[ @YES ] completion:NULL];
|
||||
@@ -1525,14 +1518,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithBundleURL
|
||||
RCTProfileEnd(self, ^(NSString *log) {
|
||||
NSData *logData = [log dataUsingEncoding:NSUTF8StringEncoding];
|
||||
callback(logData);
|
||||
#if WITH_FBSYSTRACE
|
||||
if (![RCTFBSystrace verifyTraceSize:logData.length]) {
|
||||
RCTLogWarn(
|
||||
@"Your FBSystrace trace might be truncated, try to bump up the buffer size"
|
||||
" in RCTFBSystrace.m or capture a shorter trace");
|
||||
}
|
||||
[RCTFBSystrace unregisterCallbacks];
|
||||
#endif
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ class RCTMessageThread : public MessageQueueThread,
|
||||
public:
|
||||
RCTMessageThread(NSRunLoop* runLoop, RCTJavaScriptCompleteBlock errorBlock);
|
||||
~RCTMessageThread() override;
|
||||
void runOnQueue(std::function<void()>&&) override;
|
||||
void runOnQueueSync(std::function<void()>&&) override;
|
||||
void runOnQueue(std::function<void()>&& /*func*/) override;
|
||||
void runOnQueueSync(std::function<void()>&& /*func*/) override;
|
||||
void quitSynchronous() override;
|
||||
void setRunLoop(NSRunLoop* runLoop);
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class RCTObjcExecutor : public JSExecutor {
|
||||
}];
|
||||
}
|
||||
|
||||
void setBundleRegistry(std::unique_ptr<RAMBundleRegistry>) override
|
||||
void setBundleRegistry(std::unique_ptr<RAMBundleRegistry> /*bundleRegistry*/) override
|
||||
{
|
||||
RCTAssert(NO, @"RAM bundles are not supported in RCTObjcExecutor");
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ static void RCTPerformMountInstructions(
|
||||
SurfaceId surfaceId = RCTSurfaceIdForView(componentView);
|
||||
Props::Shared oldProps = [componentView props];
|
||||
Props::Shared newProps = componentDescriptor.cloneProps(
|
||||
PropsParserContext{surfaceId, *_contextContainer.get()}, oldProps, RawProps(std::move(props)));
|
||||
PropsParserContext{surfaceId, *_contextContainer}, oldProps, RawProps(std::move(props)));
|
||||
|
||||
NSSet<NSString *> *propKeys = componentView.propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN ?: [NSSet new];
|
||||
propKeys = [propKeys setByAddingObjectsFromArray:propsKeysToBeUpdated];
|
||||
|
||||
@@ -43,7 +43,7 @@ RCT_EXTERN dispatch_queue_t RCTProfileGetQueue(void)
|
||||
|
||||
RCT_EXTERN NSUInteger _RCTProfileBeginFlowEvent(void)
|
||||
__deprecated_msg("This API will be removed along with the legacy architecture.");
|
||||
RCT_EXTERN void _RCTProfileEndFlowEvent(NSUInteger)
|
||||
RCT_EXTERN void _RCTProfileEndFlowEvent(NSUInteger /*cookie*/)
|
||||
__deprecated_msg("This API will be removed along with the legacy architecture.");
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ RCT_EXTERN BOOL RCTProfileIsProfiling(void)
|
||||
/**
|
||||
* Start collecting profiling information
|
||||
*/
|
||||
RCT_EXTERN void RCTProfileInit(RCTBridge *)
|
||||
RCT_EXTERN void RCTProfileInit(RCTBridge * /*bridge*/)
|
||||
__deprecated_msg("This API will be removed along with the legacy architecture.");
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ RCT_EXTERN void RCTProfileInit(RCTBridge *)
|
||||
* returned is compliant with google's trace event format - the format used
|
||||
* as input to trace-viewer
|
||||
*/
|
||||
RCT_EXTERN void RCTProfileEnd(RCTBridge *, void (^)(NSString *))
|
||||
RCT_EXTERN void RCTProfileEnd(RCTBridge * /*bridge*/, void (^/*callback*/)(NSString *))
|
||||
__deprecated_msg("This API will be removed along with the legacy architecture.");
|
||||
|
||||
/**
|
||||
@@ -164,13 +164,13 @@ RCT_EXTERN void RCTProfileImmediateEvent(uint64_t tag, NSString *name, NSTimeInt
|
||||
/**
|
||||
* Hook into a bridge instance to log all bridge module's method calls
|
||||
*/
|
||||
RCT_EXTERN void RCTProfileHookModules(RCTBridge *)
|
||||
RCT_EXTERN void RCTProfileHookModules(RCTBridge * /*bridge*/)
|
||||
__deprecated_msg("This API will be removed along with the legacy architecture.");
|
||||
|
||||
/**
|
||||
* Unhook from a given bridge instance's modules
|
||||
*/
|
||||
RCT_EXTERN void RCTProfileUnhookModules(RCTBridge *)
|
||||
RCT_EXTERN void RCTProfileUnhookModules(RCTBridge * /*bridge*/)
|
||||
__deprecated_msg("This API will be removed along with the legacy architecture.");
|
||||
|
||||
/**
|
||||
@@ -215,7 +215,7 @@ typedef struct {
|
||||
void (*end_async_flow)(uint64_t tag, const char *name, int cookie);
|
||||
} RCTProfileCallbacks __deprecated_msg("This API will be removed along with the legacy architecture.");
|
||||
|
||||
RCT_EXTERN void RCTProfileRegisterCallbacks(RCTProfileCallbacks *)
|
||||
RCT_EXTERN void RCTProfileRegisterCallbacks(RCTProfileCallbacks * /*cb*/)
|
||||
__deprecated_msg("This API will be removed along with the legacy architecture.");
|
||||
|
||||
/**
|
||||
|
||||
@@ -184,7 +184,7 @@ RCT_EXTERN void RCTProfileTrampoline(void);
|
||||
static void *RCTProfileTrampoline = NULL;
|
||||
#endif
|
||||
|
||||
RCT_EXTERN void RCTProfileTrampolineStart(id, SEL);
|
||||
RCT_EXTERN void RCTProfileTrampolineStart(id /*self*/, SEL /*cmd*/);
|
||||
void RCTProfileTrampolineStart(id self, SEL cmd)
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -7,11 +7,6 @@ public abstract class com/facebook/react/BaseReactPackage : com/facebook/react/R
|
||||
protected fun getViewManagers (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
|
||||
}
|
||||
|
||||
public class com/facebook/react/CoreModulesPackage$$ReactModuleInfoProvider : com/facebook/react/module/model/ReactModuleInfoProvider {
|
||||
public fun <init> ()V
|
||||
public fun getReactModuleInfos ()Ljava/util/Map;
|
||||
}
|
||||
|
||||
public final class com/facebook/react/DebugCorePackage : com/facebook/react/BaseReactPackage, com/facebook/react/ViewManagerOnDemandReactPackage {
|
||||
public fun <init> ()V
|
||||
public fun createViewManager (Lcom/facebook/react/bridge/ReactApplicationContext;Ljava/lang/String;)Lcom/facebook/react/uimanager/ViewManager;
|
||||
@@ -2483,6 +2478,7 @@ public final class com/facebook/react/modules/appearance/AppearanceModule : com/
|
||||
public fun addListener (Ljava/lang/String;)V
|
||||
public final fun emitAppearanceChanged (Ljava/lang/String;)V
|
||||
public fun getColorScheme ()Ljava/lang/String;
|
||||
public final fun invalidatePlatformColorCache ()V
|
||||
public final fun onConfigurationChanged (Landroid/content/Context;)V
|
||||
public fun removeListeners (D)V
|
||||
public fun setColorScheme (Ljava/lang/String;)V
|
||||
@@ -5622,6 +5618,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android
|
||||
public fun pageScroll (I)Z
|
||||
public fun reactSmoothScrollTo (II)V
|
||||
public fun requestChildFocus (Landroid/view/View;Landroid/view/View;)V
|
||||
protected fun restoreScrollTo (II)V
|
||||
public fun scrollTo (II)V
|
||||
public fun scrollToPreservingMomentum (II)V
|
||||
public fun setBackgroundColor (I)V
|
||||
@@ -5641,6 +5638,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollView : android
|
||||
public fun setOverflowInset (IIII)V
|
||||
public fun setPagingEnabled (Z)V
|
||||
public fun setPointerEvents (Lcom/facebook/react/uimanager/PointerEvents;)V
|
||||
public fun setReactScrollViewScrollState (Lcom/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState;)V
|
||||
public fun setRemoveClippedSubviews (Z)V
|
||||
public fun setScrollEnabled (Z)V
|
||||
public fun setScrollEventThrottle (I)V
|
||||
@@ -5780,8 +5778,10 @@ public class com/facebook/react/views/scroll/ReactScrollView : android/widget/Sc
|
||||
public fun setOverflowInset (IIII)V
|
||||
public fun setPagingEnabled (Z)V
|
||||
public fun setPointerEvents (Lcom/facebook/react/uimanager/PointerEvents;)V
|
||||
public fun setReactScrollViewScrollState (Lcom/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState;)V
|
||||
public fun setRemoveClippedSubviews (Z)V
|
||||
public fun setScrollAwayTopPaddingEnabledUnstable (I)V
|
||||
public fun setScrollAwayTopPaddingEnabledUnstable (IZ)V
|
||||
public fun setScrollEnabled (Z)V
|
||||
public fun setScrollEventThrottle (I)V
|
||||
public fun setScrollPerfTag (Ljava/lang/String;)V
|
||||
@@ -5884,6 +5884,7 @@ public abstract interface class com/facebook/react/views/scroll/ReactScrollViewH
|
||||
|
||||
public abstract interface class com/facebook/react/views/scroll/ReactScrollViewHelper$HasScrollState {
|
||||
public abstract fun getReactScrollViewScrollState ()Lcom/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState;
|
||||
public abstract fun setReactScrollViewScrollState (Lcom/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState;)V
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/views/scroll/ReactScrollViewHelper$HasSmoothScroll {
|
||||
@@ -5901,18 +5902,34 @@ public abstract interface class com/facebook/react/views/scroll/ReactScrollViewH
|
||||
|
||||
public final class com/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState {
|
||||
public fun <init> ()V
|
||||
public fun <init> (Landroid/graphics/Point;ILandroid/graphics/Point;ZZFZ)V
|
||||
public synthetic fun <init> (Landroid/graphics/Point;ILandroid/graphics/Point;ZZFZILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun component1 ()Landroid/graphics/Point;
|
||||
public final fun component2 ()I
|
||||
public final fun component3 ()Landroid/graphics/Point;
|
||||
public final fun component4 ()Z
|
||||
public final fun component5 ()Z
|
||||
public final fun component6 ()F
|
||||
public final fun component7 ()Z
|
||||
public final fun copy (Landroid/graphics/Point;ILandroid/graphics/Point;ZZFZ)Lcom/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState;
|
||||
public static synthetic fun copy$default (Lcom/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState;Landroid/graphics/Point;ILandroid/graphics/Point;ZZFZILjava/lang/Object;)Lcom/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState;
|
||||
public fun equals (Ljava/lang/Object;)Z
|
||||
public final fun getDecelerationRate ()F
|
||||
public final fun getFinalAnimatedPositionScroll ()Landroid/graphics/Point;
|
||||
public final fun getLastStateUpdateScroll ()Landroid/graphics/Point;
|
||||
public final fun getScrollAwayPaddingTop ()I
|
||||
public fun hashCode ()I
|
||||
public final fun isCanceled ()Z
|
||||
public final fun isFinished ()Z
|
||||
public final fun isUpdatedByScroll ()Z
|
||||
public final fun setCanceled (Z)V
|
||||
public final fun setDecelerationRate (F)V
|
||||
public final fun setFinalAnimatedPositionScroll (II)Lcom/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState;
|
||||
public final fun setFinished (Z)V
|
||||
public final fun setLastStateUpdateScroll (II)Lcom/facebook/react/views/scroll/ReactScrollViewHelper$ReactScrollViewScrollState;
|
||||
public final fun setScrollAwayPaddingTop (I)V
|
||||
public final fun setUpdatedByScroll (Z)V
|
||||
public fun toString ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/views/scroll/ReactScrollViewHelper$ScrollListener {
|
||||
|
||||
@@ -532,11 +532,13 @@ android {
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
// Using '-Xjvm-default=all' to generate default java methods for interfaces
|
||||
freeCompilerArgs = listOf("-Xjvm-default=all")
|
||||
// Using -PenableWarningsAsErrors=true prop to enable allWarningsAsErrors
|
||||
kotlinOptions.allWarningsAsErrors = enableWarningsAsErrors()
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
// Using '-Xjvm-default=all' to generate default java methods for interfaces
|
||||
freeCompilerArgs = listOf("-Xjvm-default=all")
|
||||
// Using -PenableWarningsAsErrors=true prop to enable allWarningsAsErrors
|
||||
allWarningsAsErrors = enableWarningsAsErrors()
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
@@ -637,6 +639,7 @@ android {
|
||||
prefab = true
|
||||
prefabPublishing = true
|
||||
buildConfig = true
|
||||
resValues = true
|
||||
}
|
||||
|
||||
prefab {
|
||||
|
||||
-207
@@ -1,207 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react
|
||||
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.ReactMarker
|
||||
import com.facebook.react.bridge.ReactMarkerConstants
|
||||
import com.facebook.react.common.ClassFinder
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
|
||||
import com.facebook.react.devsupport.LogBoxModule
|
||||
import com.facebook.react.module.annotations.ReactModule
|
||||
import com.facebook.react.module.annotations.ReactModuleList
|
||||
import com.facebook.react.module.model.ReactModuleInfo
|
||||
import com.facebook.react.module.model.ReactModuleInfoProvider
|
||||
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
|
||||
import com.facebook.react.modules.core.DeviceEventManagerModule
|
||||
import com.facebook.react.modules.core.ExceptionsManagerModule
|
||||
import com.facebook.react.modules.core.HeadlessJsTaskSupportModule
|
||||
import com.facebook.react.modules.core.TimingModule
|
||||
import com.facebook.react.modules.debug.DevMenuModule
|
||||
import com.facebook.react.modules.debug.DevSettingsModule
|
||||
import com.facebook.react.modules.debug.SourceCodeModule
|
||||
import com.facebook.react.modules.deviceinfo.DeviceInfoModule
|
||||
import com.facebook.react.modules.systeminfo.AndroidInfoModule
|
||||
import com.facebook.react.uimanager.ViewManager
|
||||
import com.facebook.react.uimanager.ViewManagerResolver
|
||||
import com.facebook.systrace.Systrace
|
||||
|
||||
/**
|
||||
* This is the basic module to support React Native. The debug modules are now in DebugCorePackage.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
@ReactModuleList(
|
||||
// WARNING: If you modify this list, ensure that the list below in method
|
||||
// getReactModuleInfoByInitialization is also updated
|
||||
nativeModules =
|
||||
[
|
||||
AndroidInfoModule::class,
|
||||
DeviceEventManagerModule::class,
|
||||
DeviceInfoModule::class,
|
||||
DevMenuModule::class,
|
||||
DevSettingsModule::class,
|
||||
ExceptionsManagerModule::class,
|
||||
LogBoxModule::class,
|
||||
HeadlessJsTaskSupportModule::class,
|
||||
SourceCodeModule::class,
|
||||
TimingModule::class,
|
||||
com.facebook.react.uimanager.UIManagerModule::class,
|
||||
]
|
||||
)
|
||||
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
|
||||
@Deprecated(
|
||||
message = "This class is part of Legacy Architecture and will be removed in a future release",
|
||||
level = DeprecationLevel.WARNING,
|
||||
)
|
||||
internal class CoreModulesPackage(
|
||||
private val reactInstanceManager: ReactInstanceManager,
|
||||
private val hardwareBackBtnHandler: DefaultHardwareBackBtnHandler,
|
||||
private val lazyViewManagersEnabled: Boolean,
|
||||
private val minTimeLeftInFrameForNonBatchedOperationMs: Int,
|
||||
) : BaseReactPackage() {
|
||||
/**
|
||||
* This method is overridden, since OSS does not run the annotation processor to generate
|
||||
* [CoreModulesPackage.ReactModuleInfoProvider] class. Here we check if it exists with the method
|
||||
* [canLoadClassesFromAnnotationProcessors]. If it does not exist, we generate one manually in
|
||||
* [CoreModulesPackage.getReactModuleInfoByInitialization] and return that instead.
|
||||
*/
|
||||
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
||||
if (!ClassFinder.canLoadClassesFromAnnotationProcessors()) {
|
||||
return fallbackForMissingClass()
|
||||
}
|
||||
|
||||
try {
|
||||
val reactModuleInfoProviderClass =
|
||||
ClassFinder.findClass("com.facebook.react.CoreModulesPackage\$\$ReactModuleInfoProvider")
|
||||
return reactModuleInfoProviderClass?.getDeclaredConstructor()?.newInstance()
|
||||
as ReactModuleInfoProvider
|
||||
} catch (e: ClassNotFoundException) {
|
||||
return fallbackForMissingClass()
|
||||
} catch (e: InstantiationException) {
|
||||
throw RuntimeException(
|
||||
"No ReactModuleInfoProvider for CoreModulesPackage$\$ReactModuleInfoProvider",
|
||||
e,
|
||||
)
|
||||
} catch (e: IllegalAccessException) {
|
||||
throw RuntimeException(
|
||||
"No ReactModuleInfoProvider for CoreModulesPackage$\$ReactModuleInfoProvider",
|
||||
e,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun fallbackForMissingClass(): ReactModuleInfoProvider {
|
||||
// In OSS case, the annotation processor does not run. We fall back on creating this byhand
|
||||
val moduleList: Array<Class<out NativeModule>> =
|
||||
arrayOf(
|
||||
AndroidInfoModule::class.java,
|
||||
DeviceEventManagerModule::class.java,
|
||||
DeviceInfoModule::class.java,
|
||||
DevMenuModule::class.java,
|
||||
DevSettingsModule::class.java,
|
||||
ExceptionsManagerModule::class.java,
|
||||
LogBoxModule::class.java,
|
||||
HeadlessJsTaskSupportModule::class.java,
|
||||
SourceCodeModule::class.java,
|
||||
TimingModule::class.java,
|
||||
com.facebook.react.uimanager.UIManagerModule::class.java,
|
||||
)
|
||||
|
||||
val reactModuleInfoMap: MutableMap<String, ReactModuleInfo> = HashMap<String, ReactModuleInfo>()
|
||||
for (moduleClass in moduleList) {
|
||||
val reactModule: ReactModule? =
|
||||
moduleClass.getAnnotation<ReactModule>(ReactModule::class.java)
|
||||
|
||||
if (reactModule != null) {
|
||||
reactModuleInfoMap[reactModule.name] =
|
||||
ReactModuleInfo(
|
||||
reactModule.name,
|
||||
moduleClass.name,
|
||||
reactModule.canOverrideExistingModule,
|
||||
reactModule.needsEagerInit,
|
||||
reactModule.isCxxModule,
|
||||
ReactModuleInfo.classIsTurboModule(moduleClass),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return ReactModuleInfoProvider { reactModuleInfoMap }
|
||||
}
|
||||
|
||||
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
||||
return when (name) {
|
||||
AndroidInfoModule.NAME -> AndroidInfoModule(reactContext)
|
||||
DeviceEventManagerModule.NAME ->
|
||||
DeviceEventManagerModule(reactContext, hardwareBackBtnHandler)
|
||||
DevMenuModule.NAME -> DevMenuModule(reactContext, reactInstanceManager.devSupportManager)
|
||||
DevSettingsModule.NAME ->
|
||||
DevSettingsModule(reactContext, reactInstanceManager.devSupportManager)
|
||||
ExceptionsManagerModule.NAME ->
|
||||
ExceptionsManagerModule(reactInstanceManager.devSupportManager)
|
||||
LogBoxModule.NAME -> LogBoxModule(reactContext, reactInstanceManager.devSupportManager)
|
||||
HeadlessJsTaskSupportModule.NAME -> HeadlessJsTaskSupportModule(reactContext)
|
||||
SourceCodeModule.NAME -> SourceCodeModule(reactContext)
|
||||
TimingModule.NAME -> TimingModule(reactContext, reactInstanceManager.devSupportManager)
|
||||
com.facebook.react.uimanager.UIManagerModule.NAME -> createUIManager(reactContext)
|
||||
DeviceInfoModule.NAME -> DeviceInfoModule(reactContext)
|
||||
else ->
|
||||
throw IllegalArgumentException(
|
||||
"In CoreModulesPackage, could not find Native module for $name"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createUIManager(
|
||||
reactContext: ReactApplicationContext
|
||||
): com.facebook.react.uimanager.UIManagerModule {
|
||||
ReactMarker.logMarker(ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_START)
|
||||
Systrace.beginSection(Systrace.TRACE_TAG_REACT, "createUIManagerModule")
|
||||
|
||||
try {
|
||||
if (lazyViewManagersEnabled) {
|
||||
val resolver: ViewManagerResolver =
|
||||
object : ViewManagerResolver {
|
||||
override fun getViewManager(viewManagerName: String): ViewManager<*, *>? {
|
||||
return reactInstanceManager.createViewManager(viewManagerName)
|
||||
}
|
||||
|
||||
override fun getViewManagerNames(): Collection<String> {
|
||||
return reactInstanceManager.viewManagerNames
|
||||
}
|
||||
}
|
||||
|
||||
return com.facebook.react.uimanager.UIManagerModule(
|
||||
reactContext,
|
||||
resolver,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs,
|
||||
)
|
||||
} else {
|
||||
return com.facebook.react.uimanager.UIManagerModule(
|
||||
reactContext,
|
||||
reactInstanceManager.getOrCreateViewManagers(reactContext),
|
||||
minTimeLeftInFrameForNonBatchedOperationMs,
|
||||
)
|
||||
}
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT)
|
||||
ReactMarker.logMarker(ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_END)
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
init {
|
||||
LegacyArchitectureLogger.assertLegacyArchitecture(
|
||||
"CoreModulesPackage",
|
||||
LegacyArchitectureLogLevel.ERROR,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
-11
@@ -300,17 +300,6 @@ public class ReactInstanceManager {
|
||||
synchronized (mPackages) {
|
||||
PrinterHolder.getPrinter()
|
||||
.logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: Use Split Packages");
|
||||
mPackages.add(
|
||||
new CoreModulesPackage(
|
||||
this,
|
||||
new DefaultHardwareBackBtnHandler() {
|
||||
@Override
|
||||
public void invokeDefaultOnBackPressed() {
|
||||
ReactInstanceManager.this.invokeDefaultOnBackPressed();
|
||||
}
|
||||
},
|
||||
lazyViewManagersEnabled,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs));
|
||||
if (mUseDeveloperSupport) {
|
||||
mPackages.add(new DebugCorePackage());
|
||||
}
|
||||
|
||||
+2
-2
@@ -132,7 +132,7 @@ internal class InterpolationAnimatedNode(config: ReadableMap) : ValueAnimatedNod
|
||||
val outputRange = arrayOfNulls<DoubleArray>(size)
|
||||
|
||||
// Match the first pattern into a List, since we don't know its length yet
|
||||
var m = numericPattern.matcher(array.getString(0) ?: "")
|
||||
var m = numericPattern.matcher(array.getString(0).orEmpty())
|
||||
val firstOutputRange: MutableList<Double> = ArrayList()
|
||||
while (m.find()) {
|
||||
firstOutputRange.add(m.group().toDouble())
|
||||
@@ -145,7 +145,7 @@ internal class InterpolationAnimatedNode(config: ReadableMap) : ValueAnimatedNod
|
||||
for (i in 1 until size) {
|
||||
val outputArr = DoubleArray(firstOutputRangeArr.size)
|
||||
var j = 0
|
||||
m = numericPattern.matcher(array.getString(i) ?: "")
|
||||
m = numericPattern.matcher(array.getString(i).orEmpty())
|
||||
while (m.find() && j < firstOutputRangeArr.size) {
|
||||
outputArr[j++] = m.group().toDouble()
|
||||
}
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ import okhttp3.WebSocket
|
||||
import okhttp3.WebSocketListener
|
||||
|
||||
/** Java wrapper around a C++ InspectorPackagerConnection. */
|
||||
@DoNotStripAny
|
||||
internal class CxxInspectorPackagerConnection(
|
||||
url: String,
|
||||
deviceName: String,
|
||||
|
||||
+34
-5
@@ -381,8 +381,8 @@ public abstract class DevSupportManagerBase(
|
||||
DevOptionHandler {
|
||||
UiThreadUtil.runOnUiThread {
|
||||
if (reactInstanceDevHelper is PerfMonitorDevHelper) {
|
||||
reactInstanceDevHelper.inspectorTarget?.let {
|
||||
if (it.pauseAndAnalyzeBackgroundTrace()) {
|
||||
reactInstanceDevHelper.inspectorTarget?.let { target ->
|
||||
if (!target.pauseAndAnalyzeBackgroundTrace()) {
|
||||
openDebugger(DebuggerFrontendPanelName.PERFORMANCE.toString())
|
||||
}
|
||||
}
|
||||
@@ -543,7 +543,14 @@ public abstract class DevSupportManagerBase(
|
||||
!disabledItemKeys.contains(getItem(position))
|
||||
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View =
|
||||
super.getView(position, convertView, parent).apply { isEnabled = isEnabled(position) }
|
||||
super.getView(position, convertView, parent).apply {
|
||||
isEnabled = isEnabled(position)
|
||||
if (this is TextView) {
|
||||
setTextColor(
|
||||
if (isEnabled) android.graphics.Color.WHITE else android.graphics.Color.GRAY
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
devOptionsDialog =
|
||||
@@ -558,6 +565,24 @@ public abstract class DevSupportManagerBase(
|
||||
|
||||
devOptionsDialog?.show()
|
||||
|
||||
// Prior to Android 12, the list view in AlertDialogs did not match
|
||||
// their content size.
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
|
||||
devOptionsDialog?.getListView()?.let { listView ->
|
||||
val displayMetrics = context.resources.displayMetrics
|
||||
val maxHeight = (displayMetrics.heightPixels * 0.7).toInt()
|
||||
|
||||
val layoutParams =
|
||||
listView.layoutParams
|
||||
?: ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
)
|
||||
layoutParams.height = maxHeight
|
||||
listView.layoutParams = layoutParams
|
||||
}
|
||||
}
|
||||
|
||||
val reactContext = currentReactContext
|
||||
reactContext?.getJSModule(RCTNativeAppEventEmitter::class.java)?.emit("RCTDevMenuShown", null)
|
||||
}
|
||||
@@ -567,8 +592,10 @@ public abstract class DevSupportManagerBase(
|
||||
perfMonitorOverlayManager?.let { manager ->
|
||||
reactInstanceDevHelper.inspectorTarget?.addPerfMonitorListener(manager)
|
||||
}
|
||||
perfMonitorOverlayManager?.enable()
|
||||
perfMonitorOverlayManager?.startBackgroundTrace()
|
||||
if (isPackagerConnected) {
|
||||
perfMonitorOverlayManager?.enable()
|
||||
perfMonitorOverlayManager?.startBackgroundTrace()
|
||||
}
|
||||
perfMonitorInitialized = true
|
||||
}
|
||||
|
||||
@@ -896,11 +923,13 @@ public abstract class DevSupportManagerBase(
|
||||
override fun onPackagerConnected() {
|
||||
isPackagerConnected = true
|
||||
perfMonitorOverlayManager?.enable()
|
||||
perfMonitorOverlayManager?.startBackgroundTrace()
|
||||
}
|
||||
|
||||
override fun onPackagerDisconnected() {
|
||||
isPackagerConnected = false
|
||||
perfMonitorOverlayManager?.disable()
|
||||
perfMonitorOverlayManager?.stopBackgroundTrace()
|
||||
}
|
||||
|
||||
override fun onPackagerReloadCommand() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user