mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
49
Commits
+181
@@ -1,5 +1,186 @@
|
||||
# Changelog
|
||||
|
||||
## v0.82.0-rc.0
|
||||
|
||||
### Breaking
|
||||
|
||||
- **Appearance.setColorScheme:** `Appearance.setColorScheme` no longer accepts a nullable value ([a4581ecd8b](https://github.com/facebook/react-native/commit/a4581ecd8b6df5efa44dfe6d43708320209c900b) by [@huntie](https://github.com/huntie))
|
||||
- **`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))
|
||||
- **`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))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- **Deps:** Gradle to 9.0 ([7f93b664b4](https://github.com/facebook/react-native/commit/7f93b664b41ba11226aae7cca0e7c9b7f38a7d18) by [@cortinico](https://github.com/cortinico))
|
||||
- **Image Prefetching:** Android: Image Prefetching send ImageResizeMode as enum value ([e30f34eda6](https://github.com/facebook/react-native/commit/e30f34eda689994cab8cd62aa38175238da8638b) by [@christophpurrer](https://github.com/christophpurrer))
|
||||
- **New Architecture:** Remove possibility to newArchEnabled=false in 0.82 ([d5d21d0614](https://github.com/facebook/react-native/commit/d5d21d061493ee973c789a7c6ab8cceebc1f04f9) by [@cortinico](https://github.com/cortinico))
|
||||
- **`reactNativeHost`:** Throw Exception if ReactApplication.reactNativeHost is not overriden ([0d3791ca0a](https://github.com/facebook/react-native/commit/0d3791ca0ab30d5a12881c9901f31291b3e998c6) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **ViewManagerInterfaces:** Migrate ViewManagerInterfaces to kotlin. Some types in code generated ViewManagerInterfaces might differ. e.g. this will start enforcing nullability in parameters of viewManagerInterface methods (e.g. String commands parameters are not nullable, view params are not nullable in any method, etc) ([79ca9036d3](https://github.com/facebook/react-native/commit/79ca9036d39c16cd115dc0427cb7092f358ac47e) by [@mdvacca](https://github.com/mdvacca))
|
||||
|
||||
#### iOS Specific
|
||||
- **New Architecture:** Removed the opt-out from the New Architecture. ([83e6eaf693](https://github.com/facebook/react-native/commit/83e6eaf693f967b7870a5d4896cbb799206a14f0) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
|
||||
### Added
|
||||
|
||||
- **Animated:** `Animated.CompositeAnomation` is now exposed when using `"react-native-strict-api"` ([024d25794a](https://github.com/facebook/react-native/commit/024d25794a51c94c877c1dfa115a82ebbf559614) by [@huntie](https://github.com/huntie))
|
||||
- **Animated:** Allow calling createAnimatedNode without batching ([d9d9a49e18](https://github.com/facebook/react-native/commit/d9d9a49e18f3c51caa18cf7da0a1fcd62f1ecf18) by [@zeyap](https://github.com/zeyap))
|
||||
- **Animated:** Allow filter usage with native animated driver. ([138d0eb01d](https://github.com/facebook/react-native/commit/138d0eb01dbe597261459a37d364d1780c3ef228) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
|
||||
- **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))
|
||||
- **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))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- **Build Type:** Create a `debugOptimized` `buildType` for Android ([eb2461c7c9](https://github.com/facebook/react-native/commit/eb2461c7c902ebed272bd2d22d6cff4d3c586da6) by [@cortinico](https://github.com/cortinico))
|
||||
- **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))
|
||||
- **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))
|
||||
- **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))
|
||||
|
||||
### 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))
|
||||
- **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))
|
||||
- **Typing:** Update types for Platform.version ([f6ba2dbf3b](https://github.com/facebook/react-native/commit/f6ba2dbf3b4c85da1a7f9079fd366a41b160fa69) by [@riteshshukla04](https://github.com/riteshshukla04))
|
||||
- **UIManager:** Avoid unnecessary copy of view props map in UIManager::updateShadowTree ([5b38bb4745](https://github.com/facebook/react-native/commit/5b38bb47457f853c2c3d5f275facbb9fbc150683) by [@zeyap](https://github.com/zeyap))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- **AGP:** AGP to 8.12.0 ([742ef3d661](https://github.com/facebook/react-native/commit/742ef3d6615c8c1202e9f683e6127ac97d7a9e23) by [@cortinico](https://github.com/cortinico))
|
||||
- **DevSupportManager:** DevSupport `openDebugger()` methods now accept a `panel: String?` param. Frameworks directly implementing `DevSupportManager` will need to adjust call signatures. ([9dba7112cf](https://github.com/facebook/react-native/commit/9dba7112cfd09b02300869a77dba3dca16f49a28) by [@huntie](https://github.com/huntie))
|
||||
- **Kotlin:**Migrated TextAttributeProps to Kotlin. You might need to update your property access to use camelCase instead of Hungarian notation. ([fa921b3c7b](https://github.com/facebook/react-native/commit/fa921b3c7b289800a79196468f993a0eb0bf693f) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrated ReactBaseTextShadowNode to Kotlin. You might need to update your property access to use camelCase instead of Hungarian notation. ([8ccfff9a46](https://github.com/facebook/react-native/commit/8ccfff9a46f317fd78f478c8b3f180441535d1ca) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrated com.facebook.react.bridge.Arguments to Kotlin. ([2534aeaddb](https://github.com/facebook/react-native/commit/2534aeaddb0490b69dfaba6b8d316616c7e10a9c) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaConfig` to Kotlin ([4d5caef76b](https://github.com/facebook/react-native/commit/4d5caef76b83eb7e983364ecc81abb6027e5f98e) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaValue` to Kotlin ([4340dcbae8](https://github.com/facebook/react-native/commit/4340dcbae8fc41cde844e805a1ebfc23d23d164f) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaNative` to Kotlin ([bc54a06fcb](https://github.com/facebook/react-native/commit/bc54a06fcb5b5d1efd8996d8568733b657fc1b06) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaConfigFactory` to Kotlin ([33ca53d9db](https://github.com/facebook/react-native/commit/33ca53d9dbe53b92d65f82dbd53a2e9f23efd4f3) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `DoNotStrip` to Kotlin ([35d8086881](https://github.com/facebook/react-native/commit/35d8086881fac643b0ebc0d53aaf7e79b7ccd830) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaLayoutType` to Kotlin ([7e461003c6](https://github.com/facebook/react-native/commit/7e461003c6592c8c539960bd5e8169c48dd27f50) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `LayoutPassReason` to Kotlin ([db2a9c089c](https://github.com/facebook/react-native/commit/db2a9c089cd5802d99e0fc86e4dc0dbf7c888307) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaNodeFactory` to Kotlin ([40afa75a7c](https://github.com/facebook/react-native/commit/40afa75a7c816a5581223c7bcd1b65b8713edf47) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaMeasureOutput` to Kotlin ([453508ada8](https://github.com/facebook/react-native/commit/453508ada837554455733e3ca94440a7143f51b1) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaMeasureFunction` to Kotlin ([05eddd354e](https://github.com/facebook/react-native/commit/05eddd354e2e80ad3c95ed5a2199a59a77317891) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaStyleInputs` to Kotlin ([001736000f](https://github.com/facebook/react-native/commit/001736000f69ce98db86c17707408bbf3f0ae9a5) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaBaselineFunction` to Kotlin ([a2eb3b299d](https://github.com/facebook/react-native/commit/a2eb3b299dddea60c510821b662dfed55b334df7) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **Kotlin:** Migrate `YogaLogger` to Kotlin ([9c9a39b58e](https://github.com/facebook/react-native/commit/9c9a39b58e12bc734c27a5d9306e792b0dcaf927) by [@mateoguzmana](https://github.com/mateoguzmana))
|
||||
- **OnBatchCompleteListener:** Make OnBatchCompleteListener interface internal ([046ff8e58b](https://github.com/facebook/react-native/commit/046ff8e58bed5da0f19adc860b327c7248b19f48) by [@cortinico](https://github.com/cortinico))
|
||||
- **ReactSurface:** Changed return type of ReactSurfaceImpl.view to ReactSurfaceView to align with parameter recived by ReactSurfaceImpl.attachView() ([41029d8e91](https://github.com/facebook/react-native/commit/41029d8e91492c34c377374b442b31755874618c) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **TextAttributeProps:** Deprecate the field `TextAttributeProps.effectiveLineHeight`. This field was public but never used in OSS. ([ede037ade7](https://github.com/facebook/react-native/commit/ede037ade795bd44725f9bd82cace193a74aa68d) by [@cortinico](https://github.com/cortinico))
|
||||
- **ViewManagers:** Changed method arguments names for Core ViewManagers to match the names of ViewManagerInterfaces ([e7d9e0d197](https://github.com/facebook/react-native/commit/e7d9e0d1977c136a85b9a78ef36a258631d1e9ba) by [@mdvacca](https://github.com/mdvacca))
|
||||
|
||||
### Deprecated
|
||||
|
||||
- **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))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- **DevMenu:** Remove bridge mode string from React Native Dev Menu title ([1c838f32a9](https://github.com/facebook/react-native/commit/1c838f32a9bcee3867ec0502b344889308302f26) by [@sbuggay](https://github.com/sbuggay))
|
||||
- **New Architecture:** DefaultDevSupportManagerFactory.create() method used for Old Arch ([026e22bb8d](https://github.com/facebook/react-native/commit/026e22bb8d7b38b3bd66ffcc7d4ee446adfee943) by [@cortinico](https://github.com/cortinico))
|
||||
- **New Architecture:** Deprecate `BridgelessReactContext.getCatalystInstance()` method ([4583fbe052](https://github.com/facebook/react-native/commit/4583fbe052924df1ad030e51ad80e8d754a4c5a4) by [@cortinico](https://github.com/cortinico))
|
||||
- **New Architecture:** Deprecate legacy architecture classes ReactInstanceManager and ReactInstanceManagerBuilder, these classes will be deleted in a future release ([fb84932e48](https://github.com/facebook/react-native/commit/fb84932e4894a45c0a2725e1d665acdf7bcea435) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Depreacate `CoreModulesPackage` and `NativeModuleRegistryBuilder` legacy architecture classes, these classes unused in the new architecture and will be deleted in the future ([d3bbbd893a](https://github.com/facebook/react-native/commit/d3bbbd893acd500237ab4e1778c6a2e0fe1948a9) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate Legacy Architecture ViewManagers, these classes are not used as part of the new architecture and will be deleted in the future ([da74d5da2c](https://github.com/facebook/react-native/commit/da74d5da2cac5306e37368c65490c434e7ff9f4f) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate LegacyArchitecture ShadowNode classes included in React Native ([07091a9ae8](https://github.com/facebook/react-native/commit/07091a9ae8d70a601d969d9def4952563d3b7bcf) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Depreacte all LegacyArchitecture classes from the bridge package ([c1f7c5e321](https://github.com/facebook/react-native/commit/c1f7c5e3217a7e8a77a859652aadff2a41e3ea58) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate LegacyArchitecture class UIManagerProvider ([b29b86f275](https://github.com/facebook/react-native/commit/b29b86f27553eac50daa18ffb6bca07be3f24f25) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate BridgeDevSupportManager and JSInstance ([25c011eb4d](https://github.com/facebook/react-native/commit/25c011eb4d403040b57e338bec704769de20793c) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate NativeModuleRegistry Legacy Architecture class ([22e4c25211](https://github.com/facebook/react-native/commit/22e4c252116da1a6658b15a84720e0ee314dddd6) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate subset of LegacyArchitecture classes in com/facebook/react/bridge ([78a3ff81eb](https://github.com/facebook/react-native/commit/78a3ff81eb38ae26fb15106580de841477897101) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate LegacyArchitecture class FrescoBasedReactTextInlineImageShadowNode ([25f466cc4d](https://github.com/facebook/react-native/commit/25f466cc4dd28c962b967475c04c284d26efb722) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate Legacy Architecture class CallbackImpl ([718126fcf0](https://github.com/facebook/react-native/commit/718126fcf0296969ee659c31fae51b4317c896d3) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate LegacyArchitecture class JavaMethodWrapper ([19a99dd088](https://github.com/facebook/react-native/commit/19a99dd0882d786daea3db486fd3aed3c10419b5) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate Legacy Architecture ShadowNode classes ([c4715886a9](https://github.com/facebook/react-native/commit/c4715886a917eb3eb63aab366de5225090dff5a1) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate LegacyArchitecture UIManagerModules class ([85610c8b43](https://github.com/facebook/react-native/commit/85610c8b43ea132154cddcfed973ee6ceb3e55b3) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate LegacyArchitecture classes from com/facebook/react/uimanager ([7f5b2b8f84](https://github.com/facebook/react-native/commit/7f5b2b8f84d7941891a447978c6adc17929ef87f) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate LegacyArchitecture classes from package com.facebook.react.uimanager ([39d24bade3](https://github.com/facebook/react-native/commit/39d24bade317920544a3715e3a1f131663d8cded) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** Deprecate LegacyArchitecture classes from LayoutAnimation package ([f67078df07](https://github.com/facebook/react-native/commit/f67078df07b6c9ad995eb43ff47fc4a43bb2eaee) by [@mdvacca](https://github.com/mdvacca))
|
||||
- **New Architecture:** ReactPackageLogger is not supported in the new architecture and being deprecated ([65671108f6](https://github.com/facebook/react-native/commit/65671108f69d9b23a011841102e4141293581d9c) by [@mdvacca](https://github.com/mdvacca))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- **DevMenu:** Remove bridge mode title and description from React Native Dev Menu title ([775daf5972](https://github.com/facebook/react-native/commit/775daf597280db94354ed484f2ce81690f1eb7b0) by [@sbuggay](https://github.com/sbuggay))
|
||||
- **New Architecture:** Deprecate all the objc classes not used by interop, or the new architecture. ([70f53ac4ea](https://github.com/facebook/react-native/commit/70f53ac4ea144020560906f5931e480ed4dee87c) by [@RSNara](https://github.com/RSNara))
|
||||
|
||||
### Removed
|
||||
|
||||
- **New Architecture:** Core: Remove legacy components ([9c8a4c2297](https://github.com/facebook/react-native/commit/9c8a4c22973c7ce6fcf6b5d22c6d5fd4c6dc0d92) by [@RSNara](https://github.com/RSNara))
|
||||
|
||||
#### Android specific
|
||||
|
||||
- **DefaultReactHost:** Delete unused `DefaultReactHost.getDefaultReactHost()` overload ([d35ddb5e59](https://github.com/facebook/react-native/commit/d35ddb5e59a8cb990dd61a154a8e15e9542f8b15) by [@cortinico](https://github.com/cortinico))
|
||||
- **DefaultReactHost:** Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 2 ([bda6acf3b0](https://github.com/facebook/react-native/commit/bda6acf3b08779c0dae7bdadbc9913eea79acd0d) by [@cortinico](https://github.com/cortinico))
|
||||
- **DefaultReactHost:** Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 1 ([474f455a75](https://github.com/facebook/react-native/commit/474f455a7591049382da0d0308ddd21589f0cc7e) by [@cortinico](https://github.com/cortinico))
|
||||
- **Inspector:** Removed unused `Inspector` public class from React Android ([cf528526cc](https://github.com/facebook/react-native/commit/cf528526cc375f1003125cf63f66fbd88790ceae) by [@cortinico](https://github.com/cortinico))
|
||||
- **JSONArguments:** Remove the `com.facebook.react.bridge.JSONArguments` class ([04ae15d99b](https://github.com/facebook/react-native/commit/04ae15d99bb2ee6f7987bbe8c3d7acfdd46a482f) by [@cortinico](https://github.com/cortinico))
|
||||
- **MessageQueueThreadPerfStats:** Deprecated MessageQueueThreadPerfStats API and replaced with stub. ([3bf5cb3d0e](https://github.com/facebook/react-native/commit/3bf5cb3d0e7d9d1749ef19a8392b9bbd3ec7ab7d) by [@javache](https://github.com/javache))
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Accessibility:** Fix for setting the default value for accessibility props ([586f5ba89c](https://github.com/facebook/react-native/commit/586f5ba89cc20a81a9e2d5d0f2708e9cd1b440c0) by Vineeth K)
|
||||
- **Accessibility:** `aria-hidden` support for `Text`, non-editable `TextInput` and `Image` ([0f39fc3000](https://github.com/facebook/react-native/commit/0f39fc3000411a43711814e0ab9cca1f7093b625) by [@mdjastrzebski](https://github.com/mdjastrzebski))
|
||||
- **Build:** Fixed babel plugin validation error when coverage instrumentation is enabled ([191ddc1ec7](https://github.com/facebook/react-native/commit/191ddc1ec72be6641ebb8b9cb729cf0e142fff55) by Umar Mohammad)
|
||||
- **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))
|
||||
- **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))
|
||||
- **ReactCommon:** Bring back SharedImageManager = std::shared_ptr<ImageManager> alias ([4718b35259](https://github.com/facebook/react-native/commit/4718b35259135b3503033a0061ae84e15d4eb450) by [@christophpurrer](https://github.com/christophpurrer))
|
||||
- **ReactCommon:** Fixed Type Conversion Error in DynamicEventPayload ([ff38d59cff](https://github.com/facebook/react-native/commit/ff38d59cff92e0a50f0dd70384fbc4dd11d969c4) by Harini Malothu)
|
||||
- **ReactCommon:** Fixed Type Conversion Error in CSSHexColor ([2ca88a0069](https://github.com/facebook/react-native/commit/2ca88a0069969bf115da6f0ea9f2fbbae9c9226c) by [@anupriya13](https://github.com/anupriya13))
|
||||
- **TestCallInvoker:** Fix memory leak in TestCallInvoker ([9f2fbc23e4](https://github.com/facebook/react-native/commit/9f2fbc23e48af9be56b3729d514fbb3fff4ba376) by [@christophpurrer](https://github.com/christophpurrer))
|
||||
|
||||
#### 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))
|
||||
- **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))
|
||||
- **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))
|
||||
- **Scroll:** Fixed an issue where shadow tree and native tree layouts mismatch at the end of a scroll event ([1828c53f85](https://github.com/facebook/react-native/commit/1828c53f85faf599a485b3859f8b62586696265f) by [@Abbondanzo](https://github.com/Abbondanzo))
|
||||
- **Start up:** Fix wrong default for `jsBundleAssetPath` on `DefaultReactHost` ([2246e2b82c](https://github.com/facebook/react-native/commit/2246e2b82cf0c433f9a9b385ea98e532c6f322c6) by [@cortinico](https://github.com/cortinico))
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- **Build:** Fixed using USE_FRAMEWORKS (static/dynamic) with precompiled binaries ([e723ca4d6b](https://github.com/facebook/react-native/commit/e723ca4d6b86d5a98449498395c700513ceba555) by [@chrfalch](https://github.com/chrfalch))
|
||||
- **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))
|
||||
- **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))
|
||||
- **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))
|
||||
- **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))
|
||||
- **View:** Inline `View` alignment with `lineHeight` in Text ([6da351a5ed](https://github.com/facebook/react-native/commit/6da351a5ed80a10138a5558afcb380410c8a93c9) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
|
||||
|
||||
### Security
|
||||
|
||||
- **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.1
|
||||
|
||||
### Added
|
||||
|
||||
@@ -88,7 +88,6 @@ Diff: ${styleText(['dim', 'underline'], newVersion?.diffUrl ?? 'none')}
|
||||
}
|
||||
}
|
||||
|
||||
// $FlowFixMe
|
||||
function isDiffPurgeEntry(data: Partial<DiffPurge>): data is DiffPurge {
|
||||
return (
|
||||
// $FlowFixMe[incompatible-type-guard]
|
||||
|
||||
+20
-19
@@ -65,25 +65,26 @@ internal fun Project.configureReactTasks(variant: Variant, config: ReactExtensio
|
||||
if (!isDebuggableVariant) {
|
||||
val entryFileEnvVariable = System.getenv("ENTRY_FILE")
|
||||
val bundleTask =
|
||||
tasks.register("createBundle${targetName}JsAndAssets", BundleHermesCTask::class.java) {
|
||||
it.root.set(config.root)
|
||||
it.nodeExecutableAndArgs.set(config.nodeExecutableAndArgs)
|
||||
it.cliFile.set(cliFile)
|
||||
it.bundleCommand.set(config.bundleCommand)
|
||||
it.entryFile.set(detectedEntryFile(config, entryFileEnvVariable))
|
||||
it.extraPackagerArgs.set(config.extraPackagerArgs)
|
||||
it.bundleConfig.set(config.bundleConfig)
|
||||
it.bundleAssetName.set(config.bundleAssetName)
|
||||
it.jsBundleDir.set(jsBundleDir)
|
||||
it.resourcesDir.set(resourcesDir)
|
||||
it.hermesEnabled.set(isHermesEnabledInThisVariant)
|
||||
it.minifyEnabled.set(!isHermesEnabledInThisVariant)
|
||||
it.devEnabled.set(false)
|
||||
it.jsIntermediateSourceMapsDir.set(jsIntermediateSourceMapsDir)
|
||||
it.jsSourceMapsDir.set(jsSourceMapsDir)
|
||||
it.hermesCommand.set(config.hermesCommand)
|
||||
it.hermesFlags.set(config.hermesFlags)
|
||||
it.reactNativeDir.set(config.reactNativeDir)
|
||||
tasks.register("createBundle${targetName}JsAndAssets", BundleHermesCTask::class.java) { task
|
||||
->
|
||||
task.root.set(config.root)
|
||||
task.nodeExecutableAndArgs.set(config.nodeExecutableAndArgs)
|
||||
task.cliFile.set(cliFile)
|
||||
task.bundleCommand.set(config.bundleCommand)
|
||||
task.entryFile.set(detectedEntryFile(config, entryFileEnvVariable))
|
||||
task.extraPackagerArgs.set(config.extraPackagerArgs)
|
||||
task.bundleConfig.set(config.bundleConfig)
|
||||
task.bundleAssetName.set(config.bundleAssetName)
|
||||
task.jsBundleDir.set(jsBundleDir)
|
||||
task.resourcesDir.set(resourcesDir)
|
||||
task.hermesEnabled.set(isHermesEnabledInThisVariant)
|
||||
task.minifyEnabled.set(!isHermesEnabledInThisVariant)
|
||||
task.devEnabled.set(false)
|
||||
task.jsIntermediateSourceMapsDir.set(jsIntermediateSourceMapsDir)
|
||||
task.jsSourceMapsDir.set(jsSourceMapsDir)
|
||||
task.hermesCommand.set(config.hermesCommand)
|
||||
task.hermesFlags.set(config.hermesFlags)
|
||||
task.reactNativeDir.set(config.reactNativeDir)
|
||||
}
|
||||
variant.sources.res?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::resourcesDir)
|
||||
variant.sources.assets?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::jsBundleDir)
|
||||
|
||||
+3
-3
@@ -34,9 +34,9 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
|
||||
val inputFile = tempFolder.newFile("config.json")
|
||||
|
||||
val task =
|
||||
createTestTask<GenerateAutolinkingNewArchitecturesFileTask> {
|
||||
it.generatedOutputDirectory.set(outputFolder)
|
||||
it.autolinkInputFile.set(inputFile)
|
||||
createTestTask<GenerateAutolinkingNewArchitecturesFileTask> { task ->
|
||||
task.generatedOutputDirectory.set(outputFolder)
|
||||
task.autolinkInputFile.set(inputFile)
|
||||
}
|
||||
|
||||
assertThat(task.generatedOutputDirectory.get().asFile).isEqualTo(outputFolder)
|
||||
|
||||
@@ -54,7 +54,7 @@ RCTAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary
|
||||
NSArray<NSString *> *RCTAppSetupUnstableModulesRequiringMainQueueSetup(id<RCTDependencyProvider> dependencyProvider)
|
||||
{
|
||||
// For oss, insert core main queue setup modules here
|
||||
return dependencyProvider ? dependencyProvider.unstableModulesRequiringMainQueueSetup : @[];
|
||||
return (dependencyProvider != nullptr) ? dependencyProvider.unstableModulesRequiringMainQueueSetup : @[];
|
||||
}
|
||||
|
||||
id<RCTTurboModule> RCTAppSetupDefaultModuleFromClass(Class moduleClass, id<RCTDependencyProvider> dependencyProvider)
|
||||
@@ -65,11 +65,11 @@ id<RCTTurboModule> RCTAppSetupDefaultModuleFromClass(Class moduleClass, id<RCTDe
|
||||
NSArray<NSString *> *classNames = @[];
|
||||
|
||||
if (protocol == @protocol(RCTImageURLLoader)) {
|
||||
classNames = dependencyProvider ? dependencyProvider.imageURLLoaderClassNames : @[];
|
||||
classNames = (dependencyProvider != nullptr) ? dependencyProvider.imageURLLoaderClassNames : @[];
|
||||
} else if (protocol == @protocol(RCTImageDataDecoder)) {
|
||||
classNames = dependencyProvider ? dependencyProvider.imageDataDecoderClassNames : @[];
|
||||
classNames = (dependencyProvider != nullptr) ? dependencyProvider.imageDataDecoderClassNames : @[];
|
||||
} else if (protocol == @protocol(RCTURLRequestHandler)) {
|
||||
classNames = dependencyProvider ? dependencyProvider.URLRequestHandlerClassNames : @[];
|
||||
classNames = (dependencyProvider != nullptr) ? dependencyProvider.URLRequestHandlerClassNames : @[];
|
||||
}
|
||||
|
||||
NSMutableArray *modules = [NSMutableArray new];
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
- (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
|
||||
{
|
||||
return self.dependencyProvider ? self.dependencyProvider.thirdPartyFabricComponents : @{};
|
||||
return (self.dependencyProvider != nullptr) ? self.dependencyProvider.thirdPartyFabricComponents : @{};
|
||||
}
|
||||
|
||||
- (void)hostDidStart:(RCTHost *)host
|
||||
@@ -87,13 +87,15 @@
|
||||
|
||||
- (NSArray<NSString *> *)unstableModulesRequiringMainQueueSetup
|
||||
{
|
||||
return self.dependencyProvider ? RCTAppSetupUnstableModulesRequiringMainQueueSetup(self.dependencyProvider) : @[];
|
||||
return (self.dependencyProvider != nullptr)
|
||||
? RCTAppSetupUnstableModulesRequiringMainQueueSetup(self.dependencyProvider)
|
||||
: @[];
|
||||
}
|
||||
|
||||
- (nullable id<RCTModuleProvider>)getModuleProvider:(const char *)name
|
||||
{
|
||||
NSString *providerName = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
|
||||
return self.dependencyProvider ? self.dependencyProvider.moduleProviders[providerName] : nullptr;
|
||||
return (self.dependencyProvider != nullptr) ? self.dependencyProvider.moduleProviders[providerName] : nullptr;
|
||||
}
|
||||
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
|
||||
|
||||
@@ -31,7 +31,7 @@ void RCTBlobCollector::install(RCTBlobManager *blobManager)
|
||||
__weak RCTCxxBridge *cxxBridge = (RCTCxxBridge *)blobManager.bridge;
|
||||
[cxxBridge
|
||||
dispatchBlock:^{
|
||||
if (!cxxBridge || cxxBridge.runtime == nullptr) {
|
||||
if ((cxxBridge == nullptr) || cxxBridge.runtime == nullptr) {
|
||||
return;
|
||||
}
|
||||
jsi::Runtime &runtime = *(jsi::Runtime *)cxxBridge.runtime;
|
||||
|
||||
Vendored
+32
@@ -2607,3 +2607,35 @@ describe('horizontal ScrollView in RTL script', () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Views with no layout', () => {
|
||||
it('are not culled', () => {
|
||||
const root = Fantom.createRoot({viewportWidth: 100, viewportHeight: 100});
|
||||
|
||||
Fantom.runTask(() => {
|
||||
root.render(
|
||||
<ScrollView style={{height: 100, width: 100}}>
|
||||
<View nativeID={'viewWithLayout'} style={{height: 100, width: 100}} />
|
||||
<View style={{height: 1000, width: 100}} />
|
||||
<View
|
||||
nativeID={'culledViewWithLayout'}
|
||||
style={{height: 100, width: 100}}
|
||||
/>
|
||||
<View nativeID={'viewWithoutLayout'} style={{height: 0, width: 0}} />
|
||||
</ScrollView>,
|
||||
);
|
||||
});
|
||||
|
||||
expect(root.takeMountingManagerLogs()).toEqual([
|
||||
'Update {type: "RootView", nativeID: (root)}',
|
||||
'Create {type: "ScrollView", nativeID: (N/A)}',
|
||||
'Create {type: "View", nativeID: (N/A)}',
|
||||
'Create {type: "View", nativeID: "viewWithLayout"}',
|
||||
'Create {type: "View", nativeID: "viewWithoutLayout"}',
|
||||
'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "viewWithLayout"}',
|
||||
'Insert {type: "View", parentNativeID: (N/A), index: 1, nativeID: "viewWithoutLayout"}',
|
||||
'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: (N/A)}',
|
||||
'Insert {type: "ScrollView", parentNativeID: (root), index: 0, nativeID: (N/A)}',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,19 +4,17 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
import setUpPerformanceModern from '../../src/private/setup/setUpPerformanceModern';
|
||||
import NativePerformance from '../../src/private/webapis/performance/specs/NativePerformance';
|
||||
|
||||
// In case if the native implementation of the Performance API is available, use it,
|
||||
// otherwise fall back to the legacy/default one, which only defines 'Performance.now()'
|
||||
if (NativePerformance) {
|
||||
const Performance =
|
||||
require('../../src/private/webapis/performance/Performance').default;
|
||||
// $FlowExpectedError[cannot-write]
|
||||
global.performance = new Performance();
|
||||
setUpPerformanceModern();
|
||||
} else {
|
||||
if (!global.performance) {
|
||||
// $FlowExpectedError[cannot-write]
|
||||
|
||||
@@ -50,8 +50,8 @@ RCT_EXPORT_MODULE()
|
||||
completionHandler:(RCTImageLoaderCompletionBlock)completionHandler
|
||||
{
|
||||
UIImage *image = RCTImageFromLocalAssetURL(imageURL);
|
||||
if (image) {
|
||||
if (progressHandler) {
|
||||
if (image != nullptr) {
|
||||
if (progressHandler != nullptr) {
|
||||
progressHandler(1, 1);
|
||||
}
|
||||
completionHandler(nil, image);
|
||||
|
||||
@@ -27,7 +27,7 @@ RCT_EXPORT_MODULE()
|
||||
char header[7] = {};
|
||||
[imageData getBytes:header length:6];
|
||||
|
||||
return !strcmp(header, "GIF87a") || !strcmp(header, "GIF89a");
|
||||
return (strcmp(header, "GIF87a") == 0) || (strcmp(header, "GIF89a") == 0);
|
||||
}
|
||||
|
||||
- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData
|
||||
@@ -38,7 +38,7 @@ RCT_EXPORT_MODULE()
|
||||
{
|
||||
RCTAnimatedImage *image = [[RCTAnimatedImage alloc] initWithData:imageData scale:scale];
|
||||
|
||||
if (!image) {
|
||||
if (image == nullptr) {
|
||||
completionHandler(nil, nil);
|
||||
return ^{
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ UIImage *RCTBlurredImageWithRadius(UIImage *inputImage, CGFloat radius)
|
||||
}
|
||||
|
||||
// convert to ARGB if it isn't
|
||||
if (CGImageGetBitsPerPixel(imageRef) != 32 || !((CGImageGetBitmapInfo(imageRef) & kCGBitmapAlphaInfoMask))) {
|
||||
if (CGImageGetBitsPerPixel(imageRef) != 32 || (((CGImageGetBitmapInfo(imageRef) & kCGBitmapAlphaInfoMask)) == 0u)) {
|
||||
UIGraphicsImageRendererFormat *const rendererFormat = [UIGraphicsImageRendererFormat defaultFormat];
|
||||
rendererFormat.scale = inputImage.scale;
|
||||
UIGraphicsImageRenderer *const renderer = [[UIGraphicsImageRenderer alloc] initWithSize:inputImage.size
|
||||
@@ -36,11 +36,11 @@ UIImage *RCTBlurredImageWithRadius(UIImage *inputImage, CGFloat radius)
|
||||
buffer1.rowBytes = buffer2.rowBytes = CGImageGetBytesPerRow(imageRef);
|
||||
size_t bytes = buffer1.rowBytes * buffer1.height;
|
||||
buffer1.data = malloc(bytes);
|
||||
if (!buffer1.data) {
|
||||
if (buffer1.data == nullptr) {
|
||||
return inputImage;
|
||||
}
|
||||
buffer2.data = malloc(bytes);
|
||||
if (!buffer2.data) {
|
||||
if (buffer2.data == nullptr) {
|
||||
free(buffer1.data);
|
||||
return inputImage;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ UIImage *RCTBlurredImageWithRadius(UIImage *inputImage, CGFloat radius)
|
||||
return inputImage;
|
||||
}
|
||||
void *tempBuffer = malloc(tempBufferSize);
|
||||
if (!tempBuffer) {
|
||||
if (tempBuffer == nullptr) {
|
||||
free(buffer1.data);
|
||||
free(buffer2.data);
|
||||
return inputImage;
|
||||
|
||||
@@ -48,7 +48,7 @@ RCT_EXPORT_MODULE()
|
||||
{
|
||||
dispatch_async(_methodQueue, ^{
|
||||
[self removeImageForTag:imageTag];
|
||||
if (block) {
|
||||
if (block != nullptr) {
|
||||
block();
|
||||
}
|
||||
});
|
||||
@@ -58,7 +58,7 @@ RCT_EXPORT_MODULE()
|
||||
{
|
||||
RCTAssertThread(_methodQueue, @"Must be called on RCTImageStoreManager thread");
|
||||
|
||||
if (!_store) {
|
||||
if (_store == nullptr) {
|
||||
_store = [NSMutableDictionary new];
|
||||
_id = 0;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ RCT_EXPORT_METHOD(getBase64ForTag
|
||||
: (RCTResponseSenderBlock)errorCallback)
|
||||
{
|
||||
NSData *imageData = _store[imageTag];
|
||||
if (!imageData) {
|
||||
if (imageData == nullptr) {
|
||||
errorCallback(
|
||||
@[ RCTJSErrorFromNSError(RCTErrorWithMessage([NSString stringWithFormat:@"Invalid imageTag: %@", imageTag])) ]);
|
||||
return;
|
||||
@@ -132,7 +132,7 @@ RCT_EXPORT_METHOD(addImageFromBase64
|
||||
// Dispatching to a background thread to perform base64 decoding
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
NSData *imageData = [[NSData alloc] initWithBase64EncodedString:base64String options:0];
|
||||
if (imageData) {
|
||||
if (imageData != nullptr) {
|
||||
dispatch_async(self->_methodQueue, ^{
|
||||
successCallback(@[ [self _storeImageData:imageData] ]);
|
||||
});
|
||||
@@ -164,14 +164,14 @@ RCT_EXPORT_METHOD(addImageFromBase64
|
||||
|
||||
NSString *imageTag = request.URL.absoluteString;
|
||||
NSData *imageData = self->_store[imageTag];
|
||||
if (!imageData) {
|
||||
if (imageData == nullptr) {
|
||||
NSError *error = RCTErrorWithMessage([NSString stringWithFormat:@"Invalid imageTag: %@", imageTag]);
|
||||
[delegate URLRequest:cancellationBlock didCompleteWithError:error];
|
||||
return;
|
||||
}
|
||||
|
||||
CGImageSourceRef sourceRef = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL);
|
||||
if (!sourceRef) {
|
||||
if (sourceRef == nullptr) {
|
||||
NSError *error =
|
||||
RCTErrorWithMessage([NSString stringWithFormat:@"Unable to decode data for imageTag: %@", imageTag]);
|
||||
[delegate URLRequest:cancellationBlock didCompleteWithError:error];
|
||||
@@ -197,7 +197,7 @@ RCT_EXPORT_METHOD(addImageFromBase64
|
||||
|
||||
- (void)cancelRequest:(id)requestToken
|
||||
{
|
||||
if (requestToken) {
|
||||
if (requestToken != nullptr) {
|
||||
((void (^)(void))requestToken)();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ RCT_EXPORT_MODULE()
|
||||
completionHandler:(RCTImageLoaderCompletionBlock)completionHandler
|
||||
{
|
||||
UIImage *image = RCTImageFromLocalAssetURL(imageURL);
|
||||
if (image) {
|
||||
if (progressHandler) {
|
||||
if (image != nullptr) {
|
||||
if (progressHandler != nullptr) {
|
||||
progressHandler(1, 1);
|
||||
}
|
||||
completionHandler(nil, image);
|
||||
|
||||
@@ -155,7 +155,7 @@ RCT_EXPORT_METHOD(canOpenURL
|
||||
RCT_EXPORT_METHOD(getInitialURL : (RCTPromiseResolveBlock)resolve reject : (__unused RCTPromiseRejectBlock)reject)
|
||||
{
|
||||
NSURL *initialURL = nil;
|
||||
if (self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey]) {
|
||||
if (self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey] != nullptr) {
|
||||
initialURL = self.bridge.launchOptions[UIApplicationLaunchOptionsURLKey];
|
||||
} else {
|
||||
NSDictionary *userActivityDictionary =
|
||||
|
||||
+8
-8
@@ -13,8 +13,8 @@ import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
|
||||
import type {
|
||||
ListRenderItem,
|
||||
ListRenderItemInfo,
|
||||
ListViewToken,
|
||||
ViewabilityConfigCallbackPair,
|
||||
ViewToken,
|
||||
VirtualizedListProps,
|
||||
} from '@react-native/virtualized-lists';
|
||||
|
||||
@@ -573,7 +573,7 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
|
||||
return keyExtractor(items, index);
|
||||
};
|
||||
|
||||
_pushMultiColumnViewable(arr: Array<ViewToken>, v: ViewToken): void {
|
||||
_pushMultiColumnViewable(arr: Array<ListViewToken>, v: ListViewToken): void {
|
||||
const numColumns = numColumnsOrDefault(this.props.numColumns);
|
||||
const keyExtractor = this.props.keyExtractor ?? defaultKeyExtractor;
|
||||
v.item.forEach((item, ii) => {
|
||||
@@ -585,22 +585,22 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
|
||||
|
||||
_createOnViewableItemsChanged(
|
||||
onViewableItemsChanged: ?(info: {
|
||||
viewableItems: Array<ViewToken>,
|
||||
changed: Array<ViewToken>,
|
||||
viewableItems: Array<ListViewToken>,
|
||||
changed: Array<ListViewToken>,
|
||||
...
|
||||
}) => void,
|
||||
// $FlowFixMe[missing-local-annot]
|
||||
) {
|
||||
return (info: {
|
||||
viewableItems: Array<ViewToken>,
|
||||
changed: Array<ViewToken>,
|
||||
viewableItems: Array<ListViewToken>,
|
||||
changed: Array<ListViewToken>,
|
||||
...
|
||||
}) => {
|
||||
const numColumns = numColumnsOrDefault(this.props.numColumns);
|
||||
if (onViewableItemsChanged) {
|
||||
if (numColumns > 1) {
|
||||
const changed: Array<ViewToken> = [];
|
||||
const viewableItems: Array<ViewToken> = [];
|
||||
const changed: Array<ListViewToken> = [];
|
||||
const viewableItems: Array<ListViewToken> = [];
|
||||
info.viewableItems.forEach(v =>
|
||||
this._pushMultiColumnViewable(viewableItems, v),
|
||||
);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
export type {
|
||||
ViewToken,
|
||||
ListViewToken as ViewToken,
|
||||
ViewabilityConfig,
|
||||
ViewabilityConfigCallbackPair,
|
||||
} from '@react-native/virtualized-lists';
|
||||
|
||||
@@ -19,6 +19,7 @@ const VirtualizedListComponent: VirtualizedListType =
|
||||
export type {
|
||||
ListRenderItemInfo,
|
||||
ListRenderItem,
|
||||
ListViewToken,
|
||||
Separators,
|
||||
VirtualizedListProps,
|
||||
} from '@react-native/virtualized-lists';
|
||||
|
||||
@@ -102,7 +102,6 @@ export function testBadSectionsShape(): React.MixedElement {
|
||||
],
|
||||
},
|
||||
];
|
||||
// $FlowExpectedError - section missing `data` field
|
||||
return <SectionList renderItem={renderMyListItem} sections={sections} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
- (instancetype)initWithEventPath:(NSArray<NSString *> *)eventPath valueNode:(RCTValueAnimatedNode *)valueNode
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
if ((self = [super init]) != nullptr) {
|
||||
_eventPath = eventPath;
|
||||
_valueNode = valueNode;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
if ((self = [super init]) != nullptr) {
|
||||
_nodeTag = tag;
|
||||
_config = [config copy];
|
||||
}
|
||||
@@ -37,10 +37,10 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
||||
|
||||
- (void)addChild:(RCTAnimatedNode *)child
|
||||
{
|
||||
if (!_childNodes) {
|
||||
if (_childNodes == nullptr) {
|
||||
_childNodes = [NSMapTable strongToWeakObjectsMapTable];
|
||||
}
|
||||
if (child) {
|
||||
if (child != nullptr) {
|
||||
[_childNodes setObject:child forKey:child.nodeTag];
|
||||
[child onAttachedToNode:self];
|
||||
}
|
||||
@@ -48,10 +48,10 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
||||
|
||||
- (void)removeChild:(RCTAnimatedNode *)child
|
||||
{
|
||||
if (!_childNodes) {
|
||||
if (_childNodes == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (child) {
|
||||
if (child != nullptr) {
|
||||
[_childNodes removeObjectForKey:child.nodeTag];
|
||||
[child onDetachedFromNode:self];
|
||||
}
|
||||
@@ -59,20 +59,20 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
||||
|
||||
- (void)onAttachedToNode:(RCTAnimatedNode *)parent
|
||||
{
|
||||
if (!_parentNodes) {
|
||||
if (_parentNodes == nullptr) {
|
||||
_parentNodes = [NSMapTable strongToWeakObjectsMapTable];
|
||||
}
|
||||
if (parent) {
|
||||
if (parent != nullptr) {
|
||||
[_parentNodes setObject:parent forKey:parent.nodeTag];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onDetachedFromNode:(RCTAnimatedNode *)parent
|
||||
{
|
||||
if (!_parentNodes) {
|
||||
if (_parentNodes == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (parent) {
|
||||
if (parent != nullptr) {
|
||||
[_parentNodes removeObjectForKey:parent.nodeTag];
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -86,7 +86,7 @@ NSString *RCTInterpolateString(
|
||||
|
||||
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
|
||||
{
|
||||
if ((self = [super initWithTag:tag config:config])) {
|
||||
if ((self = [super initWithTag:tag config:config]) != nullptr) {
|
||||
_inputRange = config[@"inputRange"];
|
||||
|
||||
NSArray *outputRangeConfig = config[@"outputRange"];
|
||||
@@ -104,7 +104,7 @@ NSString *RCTInterpolateString(
|
||||
switch (_outputType) {
|
||||
case RCTInterpolationOutputColor: {
|
||||
UIColor *color = [RCTConvert UIColor:value];
|
||||
[outputRange addObject:color ? color : [UIColor whiteColor]];
|
||||
[outputRange addObject:(color != nullptr) ? color : [UIColor whiteColor]];
|
||||
break;
|
||||
}
|
||||
case RCTInterpolationOutputString:
|
||||
@@ -141,7 +141,7 @@ NSString *RCTInterpolateString(
|
||||
- (void)performUpdate
|
||||
{
|
||||
[super performUpdate];
|
||||
if (!_parentNode) {
|
||||
if (_parentNode == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ NSString *const NODE_TAG_KEY = @"nodeTag";
|
||||
if ([value isKindOfClass:[NSDictionary class]]) {
|
||||
NSDictionary<NSString *, id> *dict = (NSDictionary *)value;
|
||||
id nodeTag = [dict objectForKey:NODE_TAG_KEY];
|
||||
if (nodeTag && [nodeTag isKindOfClass:[NSNumber class]]) {
|
||||
if ((nodeTag != nullptr) && [nodeTag isKindOfClass:[NSNumber class]]) {
|
||||
RCTAnimatedNode *node = [self.parentNodes objectForKey:(NSNumber *)nodeTag];
|
||||
if ([node isKindOfClass:[RCTValueAnimatedNode class]]) {
|
||||
RCTValueAnimatedNode *valueNode = (RCTValueAnimatedNode *)node;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
|
||||
{
|
||||
if ((self = [super initWithTag:tag config:config])) {
|
||||
if ((self = [super initWithTag:tag config:config]) != nullptr) {
|
||||
_propsDictionary = [NSMutableDictionary new];
|
||||
}
|
||||
return self;
|
||||
@@ -36,11 +36,11 @@
|
||||
NSDictionary<NSString *, NSNumber *> *style = self.config[@"style"];
|
||||
[style enumerateKeysAndObjectsUsingBlock:^(NSString *property, NSNumber *nodeTag, __unused BOOL *stop) {
|
||||
RCTAnimatedNode *node = [self.parentNodes objectForKey:nodeTag];
|
||||
if (node) {
|
||||
if (node != nullptr) {
|
||||
if ([node isKindOfClass:[RCTValueAnimatedNode class]]) {
|
||||
RCTValueAnimatedNode *valueAnimatedNode = (RCTValueAnimatedNode *)node;
|
||||
id animatedObject = valueAnimatedNode.animatedObject;
|
||||
if (animatedObject) {
|
||||
if (animatedObject != nullptr) {
|
||||
_propsDictionary[property] = animatedObject;
|
||||
} else {
|
||||
_propsDictionary[property] = @(valueAnimatedNode.value);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
|
||||
{
|
||||
if ((self = [super initWithTag:tag config:config])) {
|
||||
if ((self = [super initWithTag:tag config:config]) != nullptr) {
|
||||
_animationId = config[@"animationId"];
|
||||
_toValueNodeTag = config[@"toValue"];
|
||||
_valueNodeTag = config[@"value"];
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
|
||||
{
|
||||
if ((self = [super initWithTag:tag config:config])) {
|
||||
if ((self = [super initWithTag:tag config:config]) != nullptr) {
|
||||
_propsDictionary = [NSMutableDictionary new];
|
||||
}
|
||||
return self;
|
||||
|
||||
@@ -59,7 +59,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
|
||||
- (instancetype)initWithBridge:(nullable RCTBridge *)bridge
|
||||
surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
if ((self = [super init]) != nullptr) {
|
||||
_bridge = bridge;
|
||||
_surfacePresenter = surfacePresenter;
|
||||
_animationNodes = [NSMutableDictionary new];
|
||||
@@ -72,7 +72,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
|
||||
- (BOOL)isNodeManagedByFabric:(NSNumber *)tag
|
||||
{
|
||||
RCTAnimatedNode *node = _animationNodes[tag];
|
||||
if (node) {
|
||||
if (node != nullptr) {
|
||||
return [node isManagedByFabric];
|
||||
}
|
||||
return false;
|
||||
@@ -106,7 +106,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
|
||||
NSString *nodeType = [RCTConvert NSString:config[@"type"]];
|
||||
|
||||
Class nodeClass = map[nodeType];
|
||||
if (!nodeClass) {
|
||||
if (nodeClass == nullptr) {
|
||||
RCTLogError(@"Animated node type %@ not supported natively", nodeType);
|
||||
return;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
|
||||
- (void)dropAnimatedNode:(NSNumber *)tag
|
||||
{
|
||||
RCTAnimatedNode *node = _animationNodes[tag];
|
||||
if (node) {
|
||||
if (node != nullptr) {
|
||||
[node detachNode];
|
||||
[_animationNodes removeObjectForKey:tag];
|
||||
}
|
||||
@@ -345,7 +345,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
|
||||
NSNumber *nodeTag = [RCTConvert NSNumber:eventMapping[@"animatedValueTag"]];
|
||||
RCTAnimatedNode *node = _animationNodes[nodeTag];
|
||||
|
||||
if (!node) {
|
||||
if (node == nullptr) {
|
||||
RCTLogError(@"Animated node with tag %@ does not exist", nodeTag);
|
||||
return;
|
||||
}
|
||||
@@ -407,7 +407,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
|
||||
|
||||
NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, RCTNormalizeAnimatedEventName(event.eventName)];
|
||||
NSMutableArray<RCTEventAnimation *> *driversForKey = _eventDrivers[key];
|
||||
if (driversForKey) {
|
||||
if (driversForKey != nullptr) {
|
||||
for (RCTEventAnimation *driver in driversForKey) {
|
||||
[self stopAnimationsForNode:driver.valueNode];
|
||||
[driver updateWithEvent:event];
|
||||
@@ -439,7 +439,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
|
||||
|
||||
- (void)startAnimationLoopIfNeeded
|
||||
{
|
||||
if (!_displayLink && _activeAnimations.count > 0) {
|
||||
if ((_displayLink == nullptr) && _activeAnimations.count > 0) {
|
||||
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(stepAnimations:)];
|
||||
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
|
||||
}
|
||||
@@ -454,7 +454,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
|
||||
|
||||
- (void)stopAnimationLoop
|
||||
{
|
||||
if (_displayLink) {
|
||||
if (_displayLink != nullptr) {
|
||||
[_displayLink invalidate];
|
||||
_displayLink = nil;
|
||||
}
|
||||
@@ -486,7 +486,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
|
||||
NSArray<RCTEventAnimation *> *eventAnimations = _eventDrivers[key];
|
||||
for (RCTEventAnimation *animation in eventAnimations) {
|
||||
NSNumber *nodeTag = [animation.valueNode nodeTag];
|
||||
if (nodeTag) {
|
||||
if (nodeTag != nullptr) {
|
||||
[tags addObject:nodeTag];
|
||||
}
|
||||
for (NSNumber *childNodeKey in [animation.valueNode childNodes]) {
|
||||
|
||||
@@ -25,7 +25,7 @@ RCT_EXPORT_MODULE()
|
||||
- (void)invalidate
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
||||
if (_queue) {
|
||||
if (_queue != nullptr) {
|
||||
for (NSOperation *operation in _queue.operations) {
|
||||
if (!operation.isCancelled && !operation.isFinished) {
|
||||
[operation cancel];
|
||||
@@ -44,7 +44,7 @@ RCT_EXPORT_MODULE()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
|
||||
// Lazy setup
|
||||
if (!_queue) {
|
||||
if (_queue == nullptr) {
|
||||
_queue = [NSOperationQueue new];
|
||||
_queue.maxConcurrentOperationCount = 2;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ RCT_EXPORT_MODULE()
|
||||
// Get mime type
|
||||
NSRange firstSemicolon = [request.URL.resourceSpecifier rangeOfString:@";"];
|
||||
NSString *mimeType =
|
||||
firstSemicolon.length ? [request.URL.resourceSpecifier substringToIndex:firstSemicolon.location] : nil;
|
||||
(firstSemicolon.length != 0u) ? [request.URL.resourceSpecifier substringToIndex:firstSemicolon.location] : nil;
|
||||
|
||||
// Send response
|
||||
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL
|
||||
@@ -72,7 +72,7 @@ RCT_EXPORT_MODULE()
|
||||
// Load data
|
||||
NSError *error;
|
||||
NSData *data = [NSData dataWithContentsOfURL:request.URL options:NSDataReadingMappedIfSafe error:&error];
|
||||
if (data) {
|
||||
if (data != nullptr) {
|
||||
[delegate URLRequest:strongOp didReceiveData:data];
|
||||
}
|
||||
[delegate URLRequest:strongOp didCompleteWithError:error];
|
||||
|
||||
@@ -46,7 +46,7 @@ RCT_EXPORT_MODULE()
|
||||
- (BOOL)isValid
|
||||
{
|
||||
// if session == nil and delegates != nil, we've been invalidated
|
||||
return _session || !_delegates;
|
||||
return (_session != nullptr) || (_delegates == nullptr);
|
||||
}
|
||||
|
||||
#pragma mark - NSURLRequestHandler
|
||||
@@ -67,7 +67,7 @@ RCT_EXPORT_MODULE()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
// Lazy setup
|
||||
if (!_session && [self isValid]) {
|
||||
if ((_session == nullptr) && [self isValid]) {
|
||||
// You can override default NSURLSession instance property allowsCellularAccess (default value YES)
|
||||
// by providing the following key to your RN project (edit ios/project/Info.plist file in Xcode):
|
||||
// <key>ReactNetworkForceWifiOnly</key> <true/>
|
||||
@@ -80,12 +80,12 @@ RCT_EXPORT_MODULE()
|
||||
callbackQueue.maxConcurrentOperationCount = 1;
|
||||
callbackQueue.underlyingQueue = [[_moduleRegistry moduleForName:"Networking"] methodQueue];
|
||||
NSURLSessionConfiguration *configuration;
|
||||
if (urlSessionConfigurationProvider) {
|
||||
if (urlSessionConfigurationProvider != nullptr) {
|
||||
configuration = urlSessionConfigurationProvider();
|
||||
} else {
|
||||
configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||
// Set allowsCellularAccess to NO ONLY if key ReactNetworkForceWifiOnly exists AND its value is YES
|
||||
if (useWifiOnly) {
|
||||
if (useWifiOnly != nullptr) {
|
||||
configuration.allowsCellularAccess = ![useWifiOnly boolValue];
|
||||
}
|
||||
[configuration setHTTPShouldSetCookies:YES];
|
||||
|
||||
@@ -649,8 +649,6 @@ class XMLHttpRequest extends EventTarget {
|
||||
this._url,
|
||||
this._headers,
|
||||
data,
|
||||
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
|
||||
* when making Flow check .android.js files. */
|
||||
nativeResponseType,
|
||||
incrementalEvents,
|
||||
this.timeout,
|
||||
|
||||
@@ -39,7 +39,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (instancetype)initWithUserDefaults:(NSUserDefaults *)defaults
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
if ((self = [super init]) != nullptr) {
|
||||
_defaults = defaults;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
@@ -84,7 +84,7 @@ RCT_EXPORT_METHOD(setValues : (NSDictionary *)values)
|
||||
_ignoringUpdates = YES;
|
||||
[values enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, BOOL *stop) {
|
||||
id plist = [RCTConvert NSPropertyList:json];
|
||||
if (plist) {
|
||||
if (plist != nullptr) {
|
||||
[self->_defaults setObject:plist forKey:key];
|
||||
} else {
|
||||
[self->_defaults removeObjectForKey:key];
|
||||
|
||||
+1
-5
@@ -41,11 +41,7 @@ export function testBadCompose() {
|
||||
(StyleSheet.compose(textStyle, textStyle): ImageStyleProp);
|
||||
|
||||
// $FlowExpectedError[incompatible-type] - Incompatible type.
|
||||
(StyleSheet.compose(
|
||||
// $FlowExpectedError - Incompatible type.
|
||||
[textStyle],
|
||||
null,
|
||||
): ImageStyleProp);
|
||||
(StyleSheet.compose([textStyle], null): ImageStyleProp);
|
||||
|
||||
// $FlowExpectedError[incompatible-type] - Incompatible type.
|
||||
(StyleSheet.compose(
|
||||
|
||||
@@ -141,7 +141,7 @@ RCT_EXPORT_METHOD(setTextAndSelection
|
||||
RCTExecuteOnUIManagerQueue(^{
|
||||
RCTBaseTextInputShadowView *shadowView =
|
||||
(RCTBaseTextInputShadowView *)[self.bridge.uiManager shadowViewForReactTag:viewTag];
|
||||
if (value) {
|
||||
if (value != nullptr) {
|
||||
[shadowView setText:value];
|
||||
}
|
||||
[self.bridge.uiManager setNeedsLayout];
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
+ (instancetype)newWithUnsafeDictionary:(NSDictionary<NSString *, id> *)dictionary
|
||||
{
|
||||
_RCTTypedModuleConstants *constants = [self new];
|
||||
if (constants) {
|
||||
if (constants != nullptr) {
|
||||
constants->_dictionary = dictionary;
|
||||
}
|
||||
return constants;
|
||||
|
||||
@@ -53,7 +53,7 @@ using namespace facebook;
|
||||
launchOptions:(nullable NSDictionary *)launchOptions
|
||||
{
|
||||
self = [super self];
|
||||
if (self) {
|
||||
if (self != nullptr) {
|
||||
_uiManagerProxy = [[RCTUIManagerProxy alloc] initWithViewRegistry:viewRegistry];
|
||||
_moduleRegistry = moduleRegistry;
|
||||
_bundleManager = bundleManager;
|
||||
@@ -75,7 +75,7 @@ using namespace facebook;
|
||||
|
||||
if (queue == RCTJSThread) {
|
||||
_dispatchToJSThread(block);
|
||||
} else if (queue) {
|
||||
} else if (queue != nullptr) {
|
||||
dispatch_async(queue, block);
|
||||
}
|
||||
}
|
||||
@@ -427,7 +427,7 @@ using namespace facebook;
|
||||
- (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
|
||||
{
|
||||
self = [super self];
|
||||
if (self) {
|
||||
if (self != nullptr) {
|
||||
_viewRegistry = viewRegistry;
|
||||
_legacyViewRegistry = [NSMutableDictionary new];
|
||||
}
|
||||
@@ -443,8 +443,8 @@ using namespace facebook;
|
||||
{
|
||||
[self logWarning:@"Please migrate to RCTViewRegistry: @synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED."
|
||||
cmd:_cmd];
|
||||
UIView *view = [_viewRegistry viewForReactTag:reactTag] ? [_viewRegistry viewForReactTag:reactTag]
|
||||
: [_legacyViewRegistry objectForKey:reactTag];
|
||||
UIView *view = ([_viewRegistry viewForReactTag:reactTag] != nullptr) ? [_viewRegistry viewForReactTag:reactTag]
|
||||
: [_legacyViewRegistry objectForKey:reactTag];
|
||||
return RCTPaperViewOrCurrentView(view);
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ using namespace facebook;
|
||||
__weak __typeof(self) weakSelf = self;
|
||||
RCTExecuteOnMainQueue(^{
|
||||
__typeof(self) strongSelf = weakSelf;
|
||||
if (strongSelf) {
|
||||
if (strongSelf != nullptr) {
|
||||
RCTUIManager *proxiedManager = (RCTUIManager *)strongSelf;
|
||||
RCTComposedViewRegistry *composedViewRegistry =
|
||||
[[RCTComposedViewRegistry alloc] initWithUIManager:proxiedManager
|
||||
|
||||
+4
-4
@@ -18,17 +18,17 @@ void RCTSurfaceMinimumSizeAndMaximumSizeFromSizeAndSizeMeasureMode(
|
||||
*minimumSize = CGSizeZero;
|
||||
*maximumSize = CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX);
|
||||
|
||||
if (sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthExact) {
|
||||
if ((sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthExact) != 0) {
|
||||
minimumSize->width = size.width;
|
||||
maximumSize->width = size.width;
|
||||
} else if (sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthAtMost) {
|
||||
} else if ((sizeMeasureMode & RCTSurfaceSizeMeasureModeWidthAtMost) != 0) {
|
||||
maximumSize->width = size.width;
|
||||
}
|
||||
|
||||
if (sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightExact) {
|
||||
if ((sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightExact) != 0) {
|
||||
minimumSize->height = size.height;
|
||||
maximumSize->height = size.height;
|
||||
} else if (sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightAtMost) {
|
||||
} else if ((sizeMeasureMode & RCTSurfaceSizeMeasureModeHeightAtMost) != 0) {
|
||||
maximumSize->height = size.height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ using namespace facebook::react;
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
if (self != nullptr) {
|
||||
_alertControllers = [NSMutableArray new];
|
||||
}
|
||||
return self;
|
||||
@@ -53,7 +53,7 @@ RCT_EXPORT_MODULE()
|
||||
alertController.modalPresentationStyle = UIModalPresentationPopover;
|
||||
UIView *sourceView = parentViewController.view;
|
||||
|
||||
if (anchorViewTag) {
|
||||
if (anchorViewTag != nullptr) {
|
||||
sourceView = [self.viewRegistry_DEPRECATED viewForReactTag:anchorViewTag];
|
||||
} else {
|
||||
alertController.popoverPresentationController.permittedArrowDirections = 0;
|
||||
@@ -166,12 +166,12 @@ RCT_EXPORT_METHOD(showActionSheetWithOptions
|
||||
index++;
|
||||
}
|
||||
|
||||
if (disabledButtonIndices) {
|
||||
if (disabledButtonIndices != nullptr) {
|
||||
for (NSNumber *disabledButtonIndex in disabledButtonIndices) {
|
||||
if ([disabledButtonIndex integerValue] < buttons.count) {
|
||||
UIAlertAction *action = alertController.actions[[disabledButtonIndex integerValue]];
|
||||
[action setEnabled:false];
|
||||
if (disabledButtonTintColor) {
|
||||
if (disabledButtonTintColor != nullptr) {
|
||||
[action setValue:disabledButtonTintColor forKey:@"titleTextColor"];
|
||||
}
|
||||
} else {
|
||||
@@ -235,14 +235,14 @@ RCT_EXPORT_METHOD(showShareActionSheetWithOptions
|
||||
UIColor *tintColor = [RCTConvert UIColor:options.tintColor() ? @(*options.tintColor()) : nil];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (message) {
|
||||
if (message != nullptr) {
|
||||
[items addObject:message];
|
||||
}
|
||||
if (URL) {
|
||||
if (URL != nullptr) {
|
||||
if ([URL.scheme.lowercaseString isEqualToString:@"data"]) {
|
||||
NSError *error;
|
||||
NSData *data = [NSData dataWithContentsOfURL:URL options:(NSDataReadingOptions)0 error:&error];
|
||||
if (!data) {
|
||||
if (data == nullptr) {
|
||||
failureCallback(@[ RCTJSErrorFromNSError(error) ]);
|
||||
return;
|
||||
}
|
||||
@@ -258,17 +258,17 @@ RCT_EXPORT_METHOD(showShareActionSheetWithOptions
|
||||
|
||||
UIActivityViewController *shareController = [[UIActivityViewController alloc] initWithActivityItems:items
|
||||
applicationActivities:nil];
|
||||
if (subject) {
|
||||
if (subject != nullptr) {
|
||||
[shareController setValue:subject forKey:@"subject"];
|
||||
}
|
||||
if (excludedActivityTypes) {
|
||||
if (excludedActivityTypes != nullptr) {
|
||||
shareController.excludedActivityTypes = excludedActivityTypes;
|
||||
}
|
||||
|
||||
UIViewController *controller = RCTPresentedViewController();
|
||||
shareController.completionWithItemsHandler =
|
||||
^(NSString *activityType, BOOL completed, __unused NSArray *returnedItems, NSError *activityError) {
|
||||
if (activityError) {
|
||||
if (activityError != nullptr) {
|
||||
failureCallback(@[ RCTJSErrorFromNSError(activityError) ]);
|
||||
} else if (completed || activityType == nil) {
|
||||
successCallback(@[ @(completed), RCTNullIfNil(activityType) ]);
|
||||
|
||||
@@ -20,9 +20,14 @@
|
||||
- (UIWindow *)alertWindow
|
||||
{
|
||||
if (_alertWindow == nil) {
|
||||
_alertWindow = [[UIWindow alloc] initWithWindowScene:RCTKeyWindow().windowScene];
|
||||
UIWindowScene *scene = RCTKeyWindow().windowScene;
|
||||
if (scene != nil) {
|
||||
_alertWindow = [[UIWindow alloc] initWithWindowScene:scene];
|
||||
} else {
|
||||
_alertWindow = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
|
||||
}
|
||||
|
||||
if (_alertWindow) {
|
||||
if (_alertWindow != nullptr) {
|
||||
_alertWindow.rootViewController = [UIViewController new];
|
||||
_alertWindow.windowLevel = UIWindowLevelAlert + 1;
|
||||
}
|
||||
@@ -36,7 +41,7 @@
|
||||
UIUserInterfaceStyle style = self.overrideUserInterfaceStyle;
|
||||
if (style == UIUserInterfaceStyleUnspecified) {
|
||||
UIUserInterfaceStyle overriddenStyle = RCTKeyWindow().overrideUserInterfaceStyle;
|
||||
style = overriddenStyle ? overriddenStyle : UIUserInterfaceStyleUnspecified;
|
||||
style = (overriddenStyle != 0) ? overriddenStyle : UIUserInterfaceStyleUnspecified;
|
||||
}
|
||||
|
||||
self.overrideUserInterfaceStyle = style;
|
||||
|
||||
@@ -86,7 +86,7 @@ RCT_EXPORT_METHOD(alertWithArgs : (JS::NativeAlertManager::Args &)args callback
|
||||
UIKeyboardType keyboardType = [RCTConvert UIKeyboardType:args.keyboardType()];
|
||||
UIUserInterfaceStyle userInterfaceStyle = [RCTConvert UIUserInterfaceStyle:args.userInterfaceStyle()];
|
||||
|
||||
if (!title && !message) {
|
||||
if ((title == nullptr) && (message == nullptr)) {
|
||||
RCTLogError(@"Must specify either an alert title, or message, or both");
|
||||
return;
|
||||
}
|
||||
@@ -193,7 +193,7 @@ RCT_EXPORT_METHOD(alertWithArgs : (JS::NativeAlertManager::Args &)args callback
|
||||
}
|
||||
}
|
||||
|
||||
if (!self->_alertControllers) {
|
||||
if (self->_alertControllers == nullptr) {
|
||||
self->_alertControllers = [NSHashTable weakObjectsHashTable];
|
||||
}
|
||||
[self->_alertControllers addObject:alertController];
|
||||
|
||||
@@ -47,7 +47,7 @@ NSString *const RCTShowDevMenuNotification = @"RCTShowDevMenuNotification";
|
||||
|
||||
- (instancetype)initWithTitleBlock:(RCTDevMenuItemTitleBlock)titleBlock handler:(dispatch_block_t)handler
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
if ((self = [super init]) != nullptr) {
|
||||
_titleBlock = [titleBlock copy];
|
||||
_handler = [handler copy];
|
||||
}
|
||||
@@ -72,14 +72,14 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
||||
|
||||
- (void)callHandler
|
||||
{
|
||||
if (_handler) {
|
||||
if (_handler != nullptr) {
|
||||
_handler();
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)title
|
||||
{
|
||||
if (_titleBlock) {
|
||||
if (_titleBlock != nullptr) {
|
||||
return _titleBlock();
|
||||
}
|
||||
return nil;
|
||||
@@ -120,7 +120,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
if ((self = [super init]) != nullptr) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(showOnShake)
|
||||
name:RCTShowDevMenuNotification
|
||||
@@ -214,7 +214,7 @@ RCT_EXPORT_MODULE()
|
||||
if (_actionSheet.isBeingPresented || _actionSheet.beingDismissed) {
|
||||
return;
|
||||
}
|
||||
if (_actionSheet) {
|
||||
if (_actionSheet != nullptr) {
|
||||
[_actionSheet dismissViewControllerAnimated:YES
|
||||
completion:^(void) {
|
||||
self->_actionSheet = nil;
|
||||
@@ -379,7 +379,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
RCT_EXPORT_METHOD(show)
|
||||
{
|
||||
if (_actionSheet || RCTRunningInAppExtension()) {
|
||||
if ((_actionSheet != nullptr) || RCTRunningInAppExtension()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ RCT_EXPORT_METHOD(show)
|
||||
- (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *__nullable)item
|
||||
{
|
||||
return ^(__unused UIAlertAction *action) {
|
||||
if (item) {
|
||||
if (item != nullptr) {
|
||||
[item callHandler];
|
||||
}
|
||||
|
||||
|
||||
@@ -71,12 +71,14 @@ RCT_EXPORT_MODULE()
|
||||
{
|
||||
[_callableJSModules invokeModule:@"RCTNativeAppEventEmitter"
|
||||
method:@"emit"
|
||||
withArgs:body ? @[ name, body ] : @[ name ]];
|
||||
withArgs:(body != nullptr) ? @[ name, body ] : @[ name ]];
|
||||
}
|
||||
|
||||
- (void)sendDeviceEventWithName:(NSString *)name body:(id)body
|
||||
{
|
||||
[_callableJSModules invokeModule:@"RCTDeviceEventEmitter" method:@"emit" withArgs:body ? @[ name, body ] : @[ name ]];
|
||||
[_callableJSModules invokeModule:@"RCTDeviceEventEmitter"
|
||||
method:@"emit"
|
||||
withArgs:(body != nullptr) ? @[ name, body ] : @[ name ]];
|
||||
}
|
||||
|
||||
- (void)sendTextEventWithType:(RCTTextEventType)type
|
||||
@@ -91,13 +93,13 @@ RCT_EXPORT_MODULE()
|
||||
@"eventCount" : @(eventCount),
|
||||
}];
|
||||
|
||||
if (text) {
|
||||
if (text != nullptr) {
|
||||
// We copy the string here because if it's a mutable string it may get released before we dispatch the event on a
|
||||
// different thread, causing a crash.
|
||||
body[@"text"] = [text copy];
|
||||
}
|
||||
|
||||
if (key) {
|
||||
if (key != nullptr) {
|
||||
if (key.length == 0) {
|
||||
key = @"Backspace"; // backspace
|
||||
} else {
|
||||
@@ -142,7 +144,7 @@ RCT_EXPORT_MODULE()
|
||||
if (event.canCoalesce) {
|
||||
eventID = RCTGetEventID(event.viewTag, event.eventName, event.coalescingKey);
|
||||
id<RCTEvent> previousEvent = _events[eventID];
|
||||
if (previousEvent) {
|
||||
if (previousEvent != nullptr) {
|
||||
event = [previousEvent coalesceWithEvent:event];
|
||||
} else {
|
||||
[_eventQueue addObject:eventID];
|
||||
@@ -173,13 +175,13 @@ RCT_EXPORT_MODULE()
|
||||
[_eventQueueLock unlock];
|
||||
|
||||
if (scheduleEventsDispatch) {
|
||||
if (_bridge) {
|
||||
if (_bridge != nullptr) {
|
||||
[_bridge
|
||||
dispatchBlock:^{
|
||||
[self flushEventsQueue];
|
||||
}
|
||||
queue:RCTJSThread];
|
||||
} else if (_dispatchToJSThread) {
|
||||
} else if (_dispatchToJSThread != nullptr) {
|
||||
_dispatchToJSThread(^{
|
||||
[self flushEventsQueue];
|
||||
});
|
||||
@@ -236,7 +238,7 @@ RCT_EXPORT_MODULE()
|
||||
{
|
||||
NSDictionary *userInfo = notification.userInfo;
|
||||
id<RCTEvent> event = [userInfo objectForKey:@"event"];
|
||||
if (event) {
|
||||
if (event != nullptr) {
|
||||
[self notifyObserversOfEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RCTExceptionsManagerDelegate>)delegate
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
if ((self = [self init]) != nullptr) {
|
||||
_delegate = delegate;
|
||||
}
|
||||
return self;
|
||||
@@ -46,7 +46,7 @@ RCT_EXPORT_MODULE()
|
||||
[redbox showErrorMessage:message withStack:stack errorCookie:(int)exceptionId];
|
||||
}
|
||||
|
||||
if (_delegate) {
|
||||
if (_delegate != nullptr) {
|
||||
[_delegate handleSoftJSExceptionWithMessage:message
|
||||
stack:stack
|
||||
exceptionId:[NSNumber numberWithDouble:exceptionId]
|
||||
@@ -64,7 +64,7 @@ RCT_EXPORT_MODULE()
|
||||
[redbox showErrorMessage:message withStack:stack errorCookie:(int)exceptionId];
|
||||
}
|
||||
|
||||
if (_delegate) {
|
||||
if (_delegate != nullptr) {
|
||||
[_delegate handleFatalJSExceptionWithMessage:message
|
||||
stack:stack
|
||||
exceptionId:[NSNumber numberWithDouble:exceptionId]
|
||||
@@ -107,13 +107,13 @@ RCT_EXPORT_METHOD(reportException : (JS::NativeExceptionsManager::ExceptionData
|
||||
{
|
||||
NSMutableDictionary<NSString *, id> *mutableErrorData = [NSMutableDictionary new];
|
||||
mutableErrorData[@"message"] = data.message();
|
||||
if (data.originalMessage()) {
|
||||
if (data.originalMessage() != nullptr) {
|
||||
mutableErrorData[@"originalMessage"] = data.originalMessage();
|
||||
}
|
||||
if (data.name()) {
|
||||
if (data.name() != nullptr) {
|
||||
mutableErrorData[@"name"] = data.name();
|
||||
}
|
||||
if (data.componentStack()) {
|
||||
if (data.componentStack() != nullptr) {
|
||||
mutableErrorData[@"componentStack"] = data.componentStack();
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ RCT_EXPORT_METHOD(reportException : (JS::NativeExceptionsManager::ExceptionData
|
||||
mutableErrorData[@"id"] = @(data.id_());
|
||||
mutableErrorData[@"isFatal"] = @(data.isFatal());
|
||||
|
||||
if (data.extraData()) {
|
||||
if (data.extraData() != nullptr) {
|
||||
mutableErrorData[@"extraData"] = data.extraData();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame color:(UIColor *)color
|
||||
{
|
||||
if ((self = [super initWithFrame:frame])) {
|
||||
if ((self = [super initWithFrame:frame]) != nullptr) {
|
||||
_frameCount = -1;
|
||||
_prevTime = -1;
|
||||
_maxFPS = 0;
|
||||
@@ -64,7 +64,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
|
||||
|
||||
- (CAShapeLayer *)graph
|
||||
{
|
||||
if (!_graph) {
|
||||
if (_graph == nullptr) {
|
||||
_graph = [CAShapeLayer new];
|
||||
_graph.frame = self.bounds;
|
||||
_graph.backgroundColor = [_color colorWithAlphaComponent:0.2].CGColor;
|
||||
@@ -76,7 +76,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
|
||||
|
||||
- (UILabel *)label
|
||||
{
|
||||
if (!_label) {
|
||||
if (_label == nullptr) {
|
||||
_label = [[UILabel alloc] initWithFrame:self.bounds];
|
||||
_label.font = [UIFont boldSystemFontOfSize:13];
|
||||
_label.textAlignment = NSTextAlignmentCenter;
|
||||
|
||||
@@ -45,23 +45,23 @@ RCT_EXPORT_METHOD(show)
|
||||
__weak RCTLogBox *weakSelf = self;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
__strong RCTLogBox *strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
if (strongSelf == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (strongSelf->_view) {
|
||||
if (strongSelf->_view != nullptr) {
|
||||
[strongSelf->_view show];
|
||||
return;
|
||||
}
|
||||
|
||||
if (strongSelf->_bridgelessSurfacePresenter) {
|
||||
if (strongSelf->_bridgelessSurfacePresenter != nullptr) {
|
||||
strongSelf->_view = [[RCTLogBoxView alloc] initWithWindow:RCTKeyWindow()
|
||||
surfacePresenter:strongSelf->_bridgelessSurfacePresenter];
|
||||
[strongSelf->_view show];
|
||||
}
|
||||
#ifndef RCT_FIT_RM_OLD_RUNTIME
|
||||
else if (strongSelf->_bridge && strongSelf->_bridge.valid) {
|
||||
if (strongSelf->_bridge.surfacePresenter) {
|
||||
else if ((strongSelf->_bridge != nullptr) && strongSelf->_bridge.valid) {
|
||||
if (strongSelf->_bridge.surfacePresenter != nullptr) {
|
||||
strongSelf->_view = [[RCTLogBoxView alloc] initWithWindow:RCTKeyWindow()
|
||||
surfacePresenter:strongSelf->_bridge.surfacePresenter];
|
||||
} else {
|
||||
@@ -80,7 +80,7 @@ RCT_EXPORT_METHOD(hide)
|
||||
__weak RCTLogBox *weakSelf = self;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
__strong RCTLogBox *strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
if (strongSelf == nullptr) {
|
||||
return;
|
||||
}
|
||||
[strongSelf->_view setHidden:YES];
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if ((self = [super initWithFrame:frame])) {
|
||||
if ((self = [super initWithFrame:frame]) != nullptr) {
|
||||
self.windowLevel = UIWindowLevelStatusBar - 1;
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ RCT_EXPORT_MODULE()
|
||||
#if __has_include(<React/RCTDevMenu.h>)
|
||||
- (RCTDevMenuItem *)devMenuItem
|
||||
{
|
||||
if (!_devMenuItem) {
|
||||
if (_devMenuItem == nullptr) {
|
||||
__weak __typeof__(self) weakSelf = self;
|
||||
__weak RCTDevSettings *devSettings = [self->_moduleRegistry moduleForName:"DevSettings"];
|
||||
if (devSettings.isPerfMonitorShown) {
|
||||
@@ -161,7 +161,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIPanGestureRecognizer *)gestureRecognizer
|
||||
{
|
||||
if (!_gestureRecognizer) {
|
||||
if (_gestureRecognizer == nullptr) {
|
||||
_gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(gesture:)];
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (UIView *)container
|
||||
{
|
||||
if (!_container) {
|
||||
if (_container == nullptr) {
|
||||
UIEdgeInsets safeInsets = RCTKeyWindow().safeAreaInsets;
|
||||
|
||||
_container =
|
||||
@@ -188,7 +188,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (UILabel *)memory
|
||||
{
|
||||
if (!_memory) {
|
||||
if (_memory == nullptr) {
|
||||
_memory = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 44, RCTPerfMonitorBarHeight)];
|
||||
_memory.font = [UIFont systemFontOfSize:12];
|
||||
_memory.numberOfLines = 3;
|
||||
@@ -200,7 +200,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (UILabel *)heap
|
||||
{
|
||||
if (!_heap) {
|
||||
if (_heap == nullptr) {
|
||||
_heap = [[UILabel alloc] initWithFrame:CGRectMake(44, 0, 44, RCTPerfMonitorBarHeight)];
|
||||
_heap.font = [UIFont systemFontOfSize:12];
|
||||
_heap.numberOfLines = 3;
|
||||
@@ -212,7 +212,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (UILabel *)views
|
||||
{
|
||||
if (!_views) {
|
||||
if (_views == nullptr) {
|
||||
_views = [[UILabel alloc] initWithFrame:CGRectMake(88, 0, 44, RCTPerfMonitorBarHeight)];
|
||||
_views.font = [UIFont systemFontOfSize:12];
|
||||
_views.numberOfLines = 3;
|
||||
@@ -224,7 +224,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (RCTFPSGraph *)uiGraph
|
||||
{
|
||||
if (!_uiGraph) {
|
||||
if (_uiGraph == nullptr) {
|
||||
_uiGraph = [[RCTFPSGraph alloc] initWithFrame:CGRectMake(134, 14, 40, 30) color:[UIColor lightGrayColor]];
|
||||
}
|
||||
return _uiGraph;
|
||||
@@ -232,7 +232,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (RCTFPSGraph *)jsGraph
|
||||
{
|
||||
if (!_jsGraph) {
|
||||
if (_jsGraph == nullptr) {
|
||||
_jsGraph = [[RCTFPSGraph alloc] initWithFrame:CGRectMake(178, 14, 40, 30) color:[UIColor lightGrayColor]];
|
||||
}
|
||||
return _jsGraph;
|
||||
@@ -240,7 +240,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (UILabel *)uiGraphLabel
|
||||
{
|
||||
if (!_uiGraphLabel) {
|
||||
if (_uiGraphLabel == nullptr) {
|
||||
_uiGraphLabel = [[UILabel alloc] initWithFrame:CGRectMake(134, 3, 40, 10)];
|
||||
_uiGraphLabel.font = [UIFont systemFontOfSize:11];
|
||||
_uiGraphLabel.textAlignment = NSTextAlignmentCenter;
|
||||
@@ -252,7 +252,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (UILabel *)jsGraphLabel
|
||||
{
|
||||
if (!_jsGraphLabel) {
|
||||
if (_jsGraphLabel == nullptr) {
|
||||
_jsGraphLabel = [[UILabel alloc] initWithFrame:CGRectMake(178, 3, 38, 10)];
|
||||
_jsGraphLabel.font = [UIFont systemFontOfSize:11];
|
||||
_jsGraphLabel.textAlignment = NSTextAlignmentCenter;
|
||||
@@ -264,7 +264,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (UITableView *)metrics
|
||||
{
|
||||
if (!_metrics) {
|
||||
if (_metrics == nullptr) {
|
||||
_metrics = [[UITableView alloc] initWithFrame:CGRectMake(
|
||||
0,
|
||||
RCTPerfMonitorBarHeight,
|
||||
@@ -281,7 +281,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)show
|
||||
{
|
||||
if (_container) {
|
||||
if (_container != nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)hide
|
||||
{
|
||||
if (!_container) {
|
||||
if (_container == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ RCT_EXPORT_MODULE()
|
||||
dispatch_io_set_low_water(_io, 20);
|
||||
|
||||
dispatch_io_read(_io, 0, SIZE_MAX, _queue, ^(__unused bool done, dispatch_data_t data, __unused int error) {
|
||||
if (!data) {
|
||||
if (data == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ RCT_EXPORT_MODULE()
|
||||
GCRegex = [NSRegularExpression regularExpressionWithPattern:pattern options:0 error:nil];
|
||||
});
|
||||
|
||||
if (_remaining) {
|
||||
if (_remaining != nullptr) {
|
||||
log = [_remaining stringByAppendingString:log];
|
||||
_remaining = nil;
|
||||
}
|
||||
@@ -404,7 +404,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
for (NSString *line in lines) {
|
||||
NSTextCheckingResult *match = [GCRegex firstMatchInString:line options:0 range:NSMakeRange(0, line.length)];
|
||||
if (match) {
|
||||
if (match != nullptr) {
|
||||
NSString *heapSizeStr = [line substringWithRange:[match rangeAtIndex:2]];
|
||||
_heapSize = [heapSizeStr integerValue];
|
||||
}
|
||||
@@ -417,7 +417,7 @@ RCT_EXPORT_MODULE()
|
||||
NSUInteger viewCount = views.count;
|
||||
NSUInteger visibleViewCount = 0;
|
||||
for (UIView *view in views.allValues) {
|
||||
if (view.window || view.superview.window) {
|
||||
if ((view.window != nullptr) || (view.superview.window != nullptr)) {
|
||||
visibleViewCount++;
|
||||
}
|
||||
}
|
||||
@@ -436,7 +436,7 @@ RCT_EXPORT_MODULE()
|
||||
__weak __typeof__(self) weakSelf = self;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
__strong __typeof__(weakSelf) strongSelf = weakSelf;
|
||||
if (strongSelf && strongSelf->_container.superview) {
|
||||
if ((strongSelf != nullptr) && (strongSelf->_container.superview != nullptr)) {
|
||||
[strongSelf updateStats];
|
||||
}
|
||||
});
|
||||
@@ -512,7 +512,7 @@ RCT_EXPORT_MODULE()
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:RCTPerfMonitorCellIdentifier
|
||||
forIndexPath:indexPath];
|
||||
|
||||
if (!cell) {
|
||||
if (cell == nullptr) {
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:RCTPerfMonitorCellIdentifier];
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ void RCTMessageThread::runSync(std::function<void()> func)
|
||||
void RCTMessageThread::tryFunc(const std::function<void()> &func)
|
||||
{
|
||||
NSError *error = tryAndReturnError(func);
|
||||
if (error) {
|
||||
if (error != nullptr) {
|
||||
m_errorBlock(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class RCTObjcExecutor : public JSExecutor {
|
||||
: m_jse(jse), m_errorBlock(errorBlock), m_delegate(std::move(delegate)), m_jsThread(std::move(jsThread))
|
||||
{
|
||||
m_jsCallback = ^(id json, NSError *error) {
|
||||
if (error) {
|
||||
if (error != nullptr) {
|
||||
// Do not use "m_errorBlock" here as the bridge might be in the middle
|
||||
// of invalidation as a result of error handling and "this" can be
|
||||
// already deallocated.
|
||||
@@ -81,7 +81,7 @@ class RCTObjcExecutor : public JSExecutor {
|
||||
onComplete:^(NSError *error) {
|
||||
RCTProfileEndFlowEvent();
|
||||
|
||||
if (error) {
|
||||
if (error != nullptr) {
|
||||
m_errorBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ using namespace facebook::react;
|
||||
|
||||
- (instancetype)initWithCxxMethod:(const CxxModule::Method &)method
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
if ((self = [super init]) != nullptr) {
|
||||
_method = std::make_unique<CxxModule::Method>(method);
|
||||
}
|
||||
return self;
|
||||
|
||||
@@ -76,7 +76,7 @@ folly::dynamic RCTNativeModule::getConstants()
|
||||
void RCTNativeModule::invoke(unsigned int methodId, folly::dynamic &¶ms, int callId)
|
||||
{
|
||||
id<RCTBridgeMethod> method = m_moduleData.methods[methodId];
|
||||
if (method) {
|
||||
if (method != nullptr) {
|
||||
RCT_PROFILE_BEGIN_EVENT(
|
||||
RCTProfileTagAlways,
|
||||
@"[RCTNativeModule invoke]",
|
||||
@@ -119,13 +119,13 @@ void RCTNativeModule::invoke(unsigned int methodId, folly::dynamic &¶ms, int
|
||||
if (isSyncModule) {
|
||||
block();
|
||||
BridgeNativeModulePerfLogger::syncMethodCallReturnConversionEnd(moduleName, methodName);
|
||||
} else if (queue) {
|
||||
} else if (queue != nullptr) {
|
||||
BridgeNativeModulePerfLogger::asyncMethodCallDispatch(moduleName, methodName);
|
||||
dispatch_async(queue, block);
|
||||
}
|
||||
|
||||
#ifdef RCT_DEV
|
||||
if (!queue) {
|
||||
if (queue == nullptr) {
|
||||
RCTLog(
|
||||
@"Attempted to invoke `%u` (method ID) on `%@` (NativeModule name) without a method queue.",
|
||||
methodId,
|
||||
@@ -153,7 +153,7 @@ static MethodCallResult invokeInner(
|
||||
int callId,
|
||||
SchedulingContext context)
|
||||
{
|
||||
if (!bridge || !bridge.valid || !moduleData) {
|
||||
if ((bridge == nullptr) || !bridge.valid || (moduleData == nullptr)) {
|
||||
if (context == Sync) {
|
||||
/**
|
||||
* NOTE: moduleName and methodName are "". This shouldn't be an issue because there can only be one ongoing sync
|
||||
@@ -166,7 +166,7 @@ static MethodCallResult invokeInner(
|
||||
}
|
||||
|
||||
id<RCTBridgeMethod> method = moduleData.methods[methodId];
|
||||
if (RCT_DEBUG && !method) {
|
||||
if (RCT_DEBUG && (method == nullptr)) {
|
||||
RCTLogError(@"Unknown methodID: %ud for module: %@", methodId, moduleData.name);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,14 +24,14 @@ static NSString *getServerHost(NSURL *bundleURL)
|
||||
{
|
||||
NSNumber *port = @8081;
|
||||
NSString *portStr = [[[NSProcessInfo processInfo] environment] objectForKey:@"RCT_METRO_PORT"];
|
||||
if (portStr && [portStr length] > 0) {
|
||||
if ((portStr != nullptr) && [portStr length] > 0) {
|
||||
port = [NSNumber numberWithInt:[portStr intValue]];
|
||||
}
|
||||
if ([bundleURL port]) {
|
||||
if ([bundleURL port] != nullptr) {
|
||||
port = [bundleURL port];
|
||||
}
|
||||
NSString *host = [bundleURL host];
|
||||
if (!host) {
|
||||
if (host == nullptr) {
|
||||
host = @"localhost";
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ static void sendEventToAllConnections(NSString *event)
|
||||
|
||||
NSString *key = [inspectorURL absoluteString];
|
||||
id<RCTInspectorPackagerConnectionProtocol> connection = socketConnections[key];
|
||||
if (!connection || !connection.isConnected) {
|
||||
if ((connection == nullptr) || !connection.isConnected) {
|
||||
connection = [[RCTCxxInspectorPackagerConnection alloc] initWithURL:inspectorURL];
|
||||
|
||||
socketConnections[key] = connection;
|
||||
|
||||
@@ -21,7 +21,7 @@ using ListenerBlock = void (^)(RCTInspectorNetworkListener *);
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
if (self != nullptr) {
|
||||
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||
self.session = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:nil];
|
||||
self.executorsByTaskId = [NSMutableDictionary new];
|
||||
@@ -63,7 +63,7 @@ using ListenerBlock = void (^)(RCTInspectorNetworkListener *);
|
||||
- (void)withListenerForTask:(NSURLSessionTask *)task execute:(ListenerBlock)block
|
||||
{
|
||||
void (^executor)(ListenerBlock) = self.executorsByTaskId[@(task.taskIdentifier)];
|
||||
if (executor) {
|
||||
if (executor != nullptr) {
|
||||
executor(block);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
if (_alertWindow == nil) {
|
||||
_alertWindow = [[UIWindow alloc] initWithWindowScene:RCTKeyWindow().windowScene];
|
||||
|
||||
if (_alertWindow) {
|
||||
if (_alertWindow != nullptr) {
|
||||
_alertWindow.rootViewController = [UIViewController new];
|
||||
_alertWindow.windowLevel = UIWindowLevelAlert + 1;
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (!(self = [super init])) {
|
||||
if ((self = [super init]) == nullptr) {
|
||||
return nil;
|
||||
}
|
||||
_touchHandler = [RCTSurfaceTouchHandler new];
|
||||
@@ -61,7 +61,7 @@
|
||||
{
|
||||
UIInterfaceOrientationMask appSupportedOrientationsMask =
|
||||
[RCTSharedApplication() supportedInterfaceOrientationsForWindow:RCTKeyWindow()];
|
||||
if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) {
|
||||
if ((_supportedInterfaceOrientations & appSupportedOrientationsMask) == 0u) {
|
||||
RCTLogError(
|
||||
@"Modal was presented with 0x%x orientations mask but the application only supports 0x%x."
|
||||
@"Add more interface orientations to your app's Info.plist to fix this."
|
||||
|
||||
+6
-2
@@ -106,6 +106,7 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
||||
BOOL _shouldAnimatePresentation;
|
||||
BOOL _shouldPresent;
|
||||
BOOL _isPresented;
|
||||
BOOL _modalInPresentation;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
@@ -115,6 +116,7 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
||||
_shouldAnimatePresentation = YES;
|
||||
|
||||
_isPresented = NO;
|
||||
_modalInPresentation = YES;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -126,7 +128,7 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
||||
_viewController = [RCTFabricModalHostViewController new];
|
||||
_viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
|
||||
_viewController.delegate = self;
|
||||
_viewController.modalInPresentation = YES;
|
||||
_viewController.modalInPresentation = _modalInPresentation;
|
||||
}
|
||||
return _viewController;
|
||||
}
|
||||
@@ -152,6 +154,7 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
||||
if (shouldBePresented) {
|
||||
[self saveAccessibilityFocusedView];
|
||||
self.viewController.presentationController.delegate = self;
|
||||
self.viewController.modalInPresentation = _modalInPresentation;
|
||||
|
||||
_isPresented = YES;
|
||||
[self presentViewController:self.viewController
|
||||
@@ -276,7 +279,8 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
||||
self.viewController.modalPresentationStyle = presentationConfiguration(newProps);
|
||||
|
||||
if (oldViewProps.allowSwipeDismissal != newProps.allowSwipeDismissal) {
|
||||
self.viewController.modalInPresentation = !newProps.allowSwipeDismissal;
|
||||
_modalInPresentation = !newProps.allowSwipeDismissal;
|
||||
self.viewController.modalInPresentation = _modalInPresentation;
|
||||
}
|
||||
|
||||
_shouldPresent = newProps.visible;
|
||||
|
||||
@@ -132,18 +132,18 @@ static Class<RCTComponentViewProtocol> RCTComponentViewClassWithName(const char
|
||||
|
||||
// Fallback 1: Call provider function for component view class.
|
||||
Class<RCTComponentViewProtocol> klass = RCTComponentViewClassWithName(name.c_str());
|
||||
if (klass) {
|
||||
if (klass != nullptr) {
|
||||
[self registerComponentViewClass:klass];
|
||||
return;
|
||||
}
|
||||
|
||||
// Fallback 2: Ask the provider and check in the dictionary provided
|
||||
if (self.thirdPartyFabricComponentsProvider) {
|
||||
if (self.thirdPartyFabricComponentsProvider != nullptr) {
|
||||
// Test whether a provider has been passed to avoid potentially expensive conversions
|
||||
// between C++ and ObjC strings.
|
||||
NSString *objcName = [NSString stringWithCString:name.c_str() encoding:NSUTF8StringEncoding];
|
||||
klass = self.thirdPartyFabricComponentsProvider.thirdPartyFabricComponents[objcName];
|
||||
if (klass) {
|
||||
if (klass != nullptr) {
|
||||
[self registerComponentViewClass:klass];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ PlatformRunLoopObserver::PlatformRunLoopObserver(
|
||||
mainRunLoopObserver_ = CFRunLoopObserverCreateWithHandler(
|
||||
NULL /* allocator */,
|
||||
toCFRunLoopActivity(activities_) /* activities */,
|
||||
true /* repeats */,
|
||||
1u /* repeats */,
|
||||
0 /* order */,
|
||||
^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
|
||||
auto strongOwner = owner.lock();
|
||||
|
||||
@@ -50,7 +50,7 @@ static CGRect insetRect(CGRect rect, CGFloat left, CGFloat top, CGFloat right, C
|
||||
static CGColorRef colorRefFromSharedColor(const SharedColor &color)
|
||||
{
|
||||
CGColorRef colorRef = RCTUIColorFromSharedColor(color).CGColor;
|
||||
return colorRef ? colorRef : [UIColor blackColor].CGColor;
|
||||
return (colorRef != nullptr) ? colorRef : [UIColor blackColor].CGColor;
|
||||
}
|
||||
|
||||
static CALayer *initBoxShadowLayer(const BoxShadow &shadow, CGSize layerSize)
|
||||
|
||||
@@ -32,7 +32,7 @@ std::unique_ptr<IWebSocket> RCTCxxInspectorPackagerConnectionDelegate::connectWe
|
||||
std::weak_ptr<IWebSocketDelegate> delegate)
|
||||
{
|
||||
auto *adapter = [[RCTCxxInspectorWebSocketAdapter alloc] initWithURL:url delegate:delegate];
|
||||
if (!adapter) {
|
||||
if (adapter == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_unique<WebSocket>(adapter);
|
||||
|
||||
@@ -34,7 +34,7 @@ NSString *NSStringFromUTF8StringView(std::string_view view)
|
||||
@implementation RCTCxxInspectorWebSocketAdapter
|
||||
- (instancetype)initWithURL:(const std::string &)url delegate:(std::weak_ptr<IWebSocketDelegate>)delegate
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
if ((self = [super init]) != nullptr) {
|
||||
_delegate = delegate;
|
||||
_webSocket = [[SRWebSocket alloc] initWithURL:[NSURL URLWithString:NSStringFromUTF8StringView(url)]];
|
||||
_webSocket.delegate = self;
|
||||
@@ -49,7 +49,7 @@ NSString *NSStringFromUTF8StringView(std::string_view view)
|
||||
NSString *messageStr = NSStringFromUTF8StringView(message);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
RCTCxxInspectorWebSocketAdapter *strongSelf = weakSelf;
|
||||
if (strongSelf) {
|
||||
if (strongSelf != nullptr) {
|
||||
[strongSelf->_webSocket sendString:messageStr error:NULL];
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ static SEL selectorForType(NSString *type)
|
||||
bridge:(RCTBridge *)bridge
|
||||
eventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
if ((self = [super init]) != nullptr) {
|
||||
_bridge = bridge;
|
||||
_eventDispatcher = eventDispatcher;
|
||||
_managerClass = managerClass;
|
||||
@@ -71,12 +71,12 @@ static SEL selectorForType(NSString *type)
|
||||
|
||||
- (RCTViewManager *)manager
|
||||
{
|
||||
if (!_manager && [self isBridgeMode]) {
|
||||
if ((_manager == nullptr) && [self isBridgeMode]) {
|
||||
_manager = [_bridge moduleForClass:_managerClass];
|
||||
} else if (!_manager && !_bridgelessViewManager) {
|
||||
} else if ((_manager == nullptr) && (_bridgelessViewManager == nullptr)) {
|
||||
_bridgelessViewManager = [_bridge moduleForClass:_managerClass];
|
||||
}
|
||||
return _manager ? _manager : _bridgelessViewManager;
|
||||
return (_manager != nullptr) ? _manager : _bridgelessViewManager;
|
||||
}
|
||||
|
||||
RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
||||
@@ -106,7 +106,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
||||
{
|
||||
json = RCTNilIfNull(json);
|
||||
if (!isShadowView) {
|
||||
if (!json && !_defaultView) {
|
||||
if ((json == nullptr) && (_defaultView == nullptr)) {
|
||||
// Only create default view if json is null
|
||||
_defaultView = [self createViewWithTag:nil rootTag:nil];
|
||||
}
|
||||
@@ -130,11 +130,11 @@ static RCTPropBlock createEventSetter(
|
||||
eventHandler = ^(NSDictionary *event) {
|
||||
// The component no longer exists, we shouldn't send the event
|
||||
id<RCTComponent> strongTarget = weakTarget;
|
||||
if (!strongTarget) {
|
||||
if (strongTarget == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (eventInterceptor) {
|
||||
if (eventInterceptor != nullptr) {
|
||||
eventInterceptor(propName, event, strongTarget.reactTag);
|
||||
} else {
|
||||
RCTComponentEvent *componentEvent = [[RCTComponentEvent alloc] initWithName:propName
|
||||
@@ -158,13 +158,13 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
__block NSMutableData *defaultValue = nil;
|
||||
|
||||
return ^(id target, id json) {
|
||||
if (!target) {
|
||||
if (target == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get default value
|
||||
if (!defaultValue) {
|
||||
if (!json) {
|
||||
if (defaultValue == nullptr) {
|
||||
if (json == nullptr) {
|
||||
// We only set the defaultValue when we first pass a non-null
|
||||
// value, so if the first value sent for a prop is null, it's
|
||||
// a no-op (we'd be resetting it to its default when its
|
||||
@@ -186,10 +186,10 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
// Get value
|
||||
BOOL freeValueOnCompletion = NO;
|
||||
void *value = defaultValue.mutableBytes;
|
||||
if (json) {
|
||||
if (json != nullptr) {
|
||||
freeValueOnCompletion = YES;
|
||||
value = malloc(typeSignature.methodReturnLength);
|
||||
if (!value) {
|
||||
if (value == nullptr) {
|
||||
// CWE - 391 : Unchecked error condition
|
||||
// https://www.cvedetails.com/cwe-details/391/Unchecked-Error-Condition.html
|
||||
// https://eli.thegreenplace.net/2009/10/30/handling-out-of-memory-conditions-in-c
|
||||
@@ -201,7 +201,7 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
}
|
||||
|
||||
// Set value
|
||||
if (!targetInvocation) {
|
||||
if (targetInvocation == nullptr) {
|
||||
NSMethodSignature *signature = [target methodSignatureForSelector:setter];
|
||||
targetInvocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
targetInvocation.selector = setter;
|
||||
@@ -252,7 +252,7 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
// Disect keypath
|
||||
NSString *key = name;
|
||||
NSArray<NSString *> *parts = [keyPath componentsSeparatedByString:@"."];
|
||||
if (parts) {
|
||||
if (parts != nullptr) {
|
||||
key = parts.lastObject;
|
||||
parts = [parts subarrayWithRange:(NSRange){0, parts.count - 1}];
|
||||
}
|
||||
@@ -275,7 +275,7 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
} else {
|
||||
// Ordinary property handlers
|
||||
NSMethodSignature *typeSignature = [[RCTConvert class] methodSignatureForSelector:type];
|
||||
if (!typeSignature) {
|
||||
if (typeSignature == nullptr) {
|
||||
RCTLogError(@"No +[RCTConvert %@] function found.", NSStringFromSelector(type));
|
||||
return ^(__unused id<RCTComponent> view, __unused id json) {
|
||||
};
|
||||
@@ -347,7 +347,7 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
{
|
||||
RCTPropBlockDictionary *propBlocks = isShadowView ? _shadowPropBlocks : _viewPropBlocks;
|
||||
RCTPropBlock propBlock = propBlocks[name];
|
||||
if (!propBlock) {
|
||||
if (propBlock == nullptr) {
|
||||
propBlock = [self createPropBlock:name isShadowView:isShadowView];
|
||||
|
||||
#if RCT_DEBUG
|
||||
@@ -381,7 +381,7 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
|
||||
- (void)setProps:(NSDictionary<NSString *, id> *)props forView:(id<RCTComponent>)view isShadowView:(BOOL)isShadowView
|
||||
{
|
||||
if (!view) {
|
||||
if (view == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -467,13 +467,13 @@ static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, S
|
||||
|
||||
// We need to handle both propConfig_* and propConfigShadow_* methods
|
||||
const char *underscorePos = strchr(selectorName + strlen("propConfig"), '_');
|
||||
if (!underscorePos) {
|
||||
if (underscorePos == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *name = @(underscorePos + 1);
|
||||
NSString *type = ((NSArray<NSString *> * (*)(id, SEL)) objc_msgSend)(managerClass, selector)[0];
|
||||
if (RCT_DEBUG && propTypes[name] && ![propTypes[name] isEqualToString:type]) {
|
||||
if (RCT_DEBUG && (propTypes[name] != nullptr) && ![propTypes[name] isEqualToString:type]) {
|
||||
RCTLogError(
|
||||
@"Property '%@' of component '%@' redefined from '%@' "
|
||||
"to '%@'",
|
||||
|
||||
+12
-3
@@ -65,6 +65,7 @@ import com.facebook.react.fabric.mounting.mountitems.BatchMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.DispatchCommandMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.MountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.MountItemFactory;
|
||||
import com.facebook.react.fabric.mounting.mountitems.PrefetchResourcesMountItem;
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
|
||||
import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlags;
|
||||
import com.facebook.react.internal.interop.InteropEventEmitter;
|
||||
@@ -984,9 +985,17 @@ public class FabricUIManager
|
||||
* by an ImageView.
|
||||
*/
|
||||
@UnstableReactNativeAPI
|
||||
public void experimental_prefetchResources(String componentName, ReadableMapBuffer params) {
|
||||
mMountingManager.experimental_prefetchResources(
|
||||
mReactApplicationContext, componentName, params);
|
||||
public void experimental_prefetchResources(
|
||||
int surfaceId, String componentName, ReadableMapBuffer params) {
|
||||
if (ReactNativeFeatureFlags.enableImagePrefetchingOnUiThreadAndroid()) {
|
||||
mMountItemDispatcher.addMountItem(
|
||||
new PrefetchResourcesMountItem(surfaceId, componentName, params));
|
||||
} else {
|
||||
SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId);
|
||||
if (surfaceMountingManager != null) {
|
||||
surfaceMountingManager.experimental_prefetchResources(surfaceId, componentName, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setBinding(FabricUIManagerBinding binding) {
|
||||
|
||||
-23
@@ -19,8 +19,6 @@ import com.facebook.react.bridge.ReadableMap
|
||||
import com.facebook.react.bridge.RetryableMountingLayerException
|
||||
import com.facebook.react.bridge.UiThreadUtil.assertOnUiThread
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
||||
import com.facebook.react.common.mapbuffer.MapBuffer
|
||||
import com.facebook.react.fabric.events.EventEmitterWrapper
|
||||
import com.facebook.react.fabric.mounting.mountitems.MountItem
|
||||
import com.facebook.react.touch.JSResponderHandler
|
||||
@@ -325,27 +323,6 @@ internal class MountingManager(
|
||||
attachmentsPositions,
|
||||
)
|
||||
|
||||
/**
|
||||
* This prefetch method is experimental, do not use it for production code. it will most likely
|
||||
* change or be removed in the future.
|
||||
*
|
||||
* @param reactContext
|
||||
* @param componentName
|
||||
* @param params prefetch request params defined in C++
|
||||
*/
|
||||
@Suppress("FunctionName")
|
||||
@AnyThread
|
||||
@UnstableReactNativeAPI
|
||||
fun experimental_prefetchResources(
|
||||
reactContext: ReactContext?,
|
||||
componentName: String?,
|
||||
params: MapBuffer?,
|
||||
) {
|
||||
viewManagerRegistry
|
||||
.get(checkNotNull(componentName))
|
||||
.experimental_prefetchResources(reactContext, params)
|
||||
}
|
||||
|
||||
fun enqueuePendingEvent(
|
||||
surfaceId: Int,
|
||||
reactTag: Int,
|
||||
|
||||
+22
@@ -10,6 +10,7 @@ package com.facebook.react.fabric.mounting;
|
||||
import static com.facebook.infer.annotation.ThreadConfined.ANY;
|
||||
import static com.facebook.infer.annotation.ThreadConfined.UI;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
@@ -30,7 +31,9 @@ import com.facebook.react.bridge.RetryableMountingLayerException;
|
||||
import com.facebook.react.bridge.SoftAssertions;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.common.annotations.UnstableReactNativeAPI;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.common.mapbuffer.MapBuffer;
|
||||
import com.facebook.react.fabric.events.EventEmitterWrapper;
|
||||
import com.facebook.react.fabric.mounting.MountingManager.MountItemExecutor;
|
||||
import com.facebook.react.fabric.mounting.mountitems.MountItem;
|
||||
@@ -696,6 +699,25 @@ public class SurfaceMountingManager {
|
||||
.updateProperties(view, viewState.mCurrentProps);
|
||||
}
|
||||
|
||||
/**
|
||||
* This prefetch method is experimental, do not use it for production code. it will most likely
|
||||
* change or be removed in the future.
|
||||
*
|
||||
* @param surfaceId surface ID
|
||||
* @param componentName
|
||||
* @param params prefetch request params defined in C++
|
||||
*/
|
||||
@SuppressLint("FunctionName")
|
||||
@AnyThread
|
||||
@UnstableReactNativeAPI
|
||||
public void experimental_prefetchResources(
|
||||
int surfaceId, String componentName, MapBuffer params) {
|
||||
mViewManagerRegistry
|
||||
.get(componentName)
|
||||
.experimental_prefetchResources(
|
||||
surfaceId, Assertions.assertNotNull(mThemedReactContext), params);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void receiveCommand(int reactTag, int commandId, ReadableArray commandArgs) {
|
||||
if (isStopped()) {
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.fabric.mounting.mountitems
|
||||
|
||||
import com.facebook.react.common.annotations.FrameworkAPI
|
||||
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
||||
import com.facebook.react.common.mapbuffer.ReadableMapBuffer
|
||||
import com.facebook.react.fabric.mounting.MountingManager
|
||||
|
||||
internal class PrefetchResourcesMountItem(
|
||||
private val surfaceId: Int,
|
||||
private val componentName: String,
|
||||
private val params: ReadableMapBuffer,
|
||||
) : MountItem {
|
||||
|
||||
@OptIn(UnstableReactNativeAPI::class, FrameworkAPI::class)
|
||||
override fun execute(mountingManager: MountingManager) {
|
||||
mountingManager
|
||||
.getSurfaceManager(surfaceId)
|
||||
?.experimental_prefetchResources(
|
||||
surfaceId,
|
||||
componentName,
|
||||
params,
|
||||
)
|
||||
}
|
||||
|
||||
override fun getSurfaceId(): Int = surfaceId
|
||||
|
||||
override fun toString(): String = "PrefetchResourcesMountItem"
|
||||
}
|
||||
+7
-13
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<34c12f5a31aab5bfb874953f1beefef1>>
|
||||
* @generated SignedSource<<a59b42b84160c18d214f8b2be76bc743>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -174,6 +174,12 @@ public object ReactNativeFeatureFlags {
|
||||
@JvmStatic
|
||||
public fun enableImagePrefetchingAndroid(): Boolean = accessor.enableImagePrefetchingAndroid()
|
||||
|
||||
/**
|
||||
* When enabled, Android will initiate image prefetch requested on ImageShadowNode::layout on the UI thread
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun enableImagePrefetchingOnUiThreadAndroid(): Boolean = accessor.enableImagePrefetchingOnUiThreadAndroid()
|
||||
|
||||
/**
|
||||
* Dispatches state updates for content offset changes synchronously on the main thread.
|
||||
*/
|
||||
@@ -222,12 +228,6 @@ public object ReactNativeFeatureFlags {
|
||||
@JvmStatic
|
||||
public fun enableNetworkEventReporting(): Boolean = accessor.enableNetworkEventReporting()
|
||||
|
||||
/**
|
||||
* Use BackgroundDrawable and BorderDrawable instead of CSSBackgroundDrawable
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun enableNewBackgroundAndBorderDrawables(): Boolean = accessor.enableNewBackgroundAndBorderDrawables()
|
||||
|
||||
/**
|
||||
* Enables caching text layout artifacts for later reuse
|
||||
*/
|
||||
@@ -336,12 +336,6 @@ public object ReactNativeFeatureFlags {
|
||||
@JvmStatic
|
||||
public fun preventShadowTreeCommitExhaustion(): Boolean = accessor.preventShadowTreeCommitExhaustion()
|
||||
|
||||
/**
|
||||
* Releases the cached image data when it is consumed by the observers.
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun releaseImageDataWhenConsumed(): Boolean = accessor.releaseImageDataWhenConsumed()
|
||||
|
||||
/**
|
||||
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
|
||||
*/
|
||||
|
||||
+11
-21
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<392da016e0bf4193b72c44a508811e10>>
|
||||
* @generated SignedSource<<37203dffb9421d1036aaeaeaa7319e28>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -44,6 +44,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
|
||||
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
|
||||
private var enableImagePrefetchingAndroidCache: Boolean? = null
|
||||
private var enableImagePrefetchingOnUiThreadAndroidCache: Boolean? = null
|
||||
private var enableImmediateUpdateModeForContentOffsetChangesCache: Boolean? = null
|
||||
private var enableInteropViewManagerClassLookUpOptimizationIOSCache: Boolean? = null
|
||||
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
|
||||
@@ -52,7 +53,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
|
||||
private var enableNativeCSSParsingCache: Boolean? = null
|
||||
private var enableNetworkEventReportingCache: Boolean? = null
|
||||
private var enableNewBackgroundAndBorderDrawablesCache: Boolean? = null
|
||||
private var enablePreparedTextLayoutCache: Boolean? = null
|
||||
private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null
|
||||
private var enableResourceTimingAPICache: Boolean? = null
|
||||
@@ -71,7 +71,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
private var perfMonitorV2EnabledCache: Boolean? = null
|
||||
private var preparedTextCacheSizeCache: Double? = null
|
||||
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
|
||||
private var releaseImageDataWhenConsumedCache: Boolean? = null
|
||||
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
|
||||
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
|
||||
private var sweepActiveTouchOnChildNativeGesturesAndroidCache: Boolean? = null
|
||||
@@ -306,6 +305,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableImagePrefetchingOnUiThreadAndroid(): Boolean {
|
||||
var cached = enableImagePrefetchingOnUiThreadAndroidCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.enableImagePrefetchingOnUiThreadAndroid()
|
||||
enableImagePrefetchingOnUiThreadAndroidCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean {
|
||||
var cached = enableImmediateUpdateModeForContentOffsetChangesCache
|
||||
if (cached == null) {
|
||||
@@ -378,15 +386,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableNewBackgroundAndBorderDrawables(): Boolean {
|
||||
var cached = enableNewBackgroundAndBorderDrawablesCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.enableNewBackgroundAndBorderDrawables()
|
||||
enableNewBackgroundAndBorderDrawablesCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enablePreparedTextLayout(): Boolean {
|
||||
var cached = enablePreparedTextLayoutCache
|
||||
if (cached == null) {
|
||||
@@ -549,15 +548,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun releaseImageDataWhenConsumed(): Boolean {
|
||||
var cached = releaseImageDataWhenConsumedCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.releaseImageDataWhenConsumed()
|
||||
releaseImageDataWhenConsumedCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
|
||||
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
|
||||
if (cached == null) {
|
||||
|
||||
+3
-5
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<a0453230524ebca2bfb8fad656a6f54a>>
|
||||
* @generated SignedSource<<9c0acc876e3205fe2ea181e71eb512c9>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -76,6 +76,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableImagePrefetchingAndroid(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableImagePrefetchingOnUiThreadAndroid(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean
|
||||
@@ -92,8 +94,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableNetworkEventReporting(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableNewBackgroundAndBorderDrawables(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enablePreparedTextLayout(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enablePropsUpdateReconciliationAndroid(): Boolean
|
||||
@@ -130,8 +130,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun preventShadowTreeCommitExhaustion(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun releaseImageDataWhenConsumed(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun skipActivityIdentityAssertionOnHostPause(): Boolean
|
||||
|
||||
+3
-5
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<719706a983a073b6c286c49d993f7f80>>
|
||||
* @generated SignedSource<<05bfed9fc7131062c8b16246986fc999>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -71,6 +71,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
||||
|
||||
override fun enableImagePrefetchingAndroid(): Boolean = false
|
||||
|
||||
override fun enableImagePrefetchingOnUiThreadAndroid(): Boolean = false
|
||||
|
||||
override fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean = false
|
||||
|
||||
override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean = false
|
||||
@@ -87,8 +89,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
||||
|
||||
override fun enableNetworkEventReporting(): Boolean = false
|
||||
|
||||
override fun enableNewBackgroundAndBorderDrawables(): Boolean = true
|
||||
|
||||
override fun enablePreparedTextLayout(): Boolean = false
|
||||
|
||||
override fun enablePropsUpdateReconciliationAndroid(): Boolean = false
|
||||
@@ -125,8 +125,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
||||
|
||||
override fun preventShadowTreeCommitExhaustion(): Boolean = false
|
||||
|
||||
override fun releaseImageDataWhenConsumed(): Boolean = false
|
||||
|
||||
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = false
|
||||
|
||||
override fun skipActivityIdentityAssertionOnHostPause(): Boolean = false
|
||||
|
||||
+12
-23
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<594815ba6a984c460ab8bddd91c5cae2>>
|
||||
* @generated SignedSource<<9a18369464f81c3d03f2702716dfdb29>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -48,6 +48,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
|
||||
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
|
||||
private var enableImagePrefetchingAndroidCache: Boolean? = null
|
||||
private var enableImagePrefetchingOnUiThreadAndroidCache: Boolean? = null
|
||||
private var enableImmediateUpdateModeForContentOffsetChangesCache: Boolean? = null
|
||||
private var enableInteropViewManagerClassLookUpOptimizationIOSCache: Boolean? = null
|
||||
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
|
||||
@@ -56,7 +57,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
|
||||
private var enableNativeCSSParsingCache: Boolean? = null
|
||||
private var enableNetworkEventReportingCache: Boolean? = null
|
||||
private var enableNewBackgroundAndBorderDrawablesCache: Boolean? = null
|
||||
private var enablePreparedTextLayoutCache: Boolean? = null
|
||||
private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null
|
||||
private var enableResourceTimingAPICache: Boolean? = null
|
||||
@@ -75,7 +75,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
private var perfMonitorV2EnabledCache: Boolean? = null
|
||||
private var preparedTextCacheSizeCache: Double? = null
|
||||
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
|
||||
private var releaseImageDataWhenConsumedCache: Boolean? = null
|
||||
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
|
||||
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
|
||||
private var sweepActiveTouchOnChildNativeGesturesAndroidCache: Boolean? = null
|
||||
@@ -334,6 +333,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableImagePrefetchingOnUiThreadAndroid(): Boolean {
|
||||
var cached = enableImagePrefetchingOnUiThreadAndroidCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.enableImagePrefetchingOnUiThreadAndroid()
|
||||
accessedFeatureFlags.add("enableImagePrefetchingOnUiThreadAndroid")
|
||||
enableImagePrefetchingOnUiThreadAndroidCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean {
|
||||
var cached = enableImmediateUpdateModeForContentOffsetChangesCache
|
||||
if (cached == null) {
|
||||
@@ -414,16 +423,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableNewBackgroundAndBorderDrawables(): Boolean {
|
||||
var cached = enableNewBackgroundAndBorderDrawablesCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.enableNewBackgroundAndBorderDrawables()
|
||||
accessedFeatureFlags.add("enableNewBackgroundAndBorderDrawables")
|
||||
enableNewBackgroundAndBorderDrawablesCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enablePreparedTextLayout(): Boolean {
|
||||
var cached = enablePreparedTextLayoutCache
|
||||
if (cached == null) {
|
||||
@@ -604,16 +603,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun releaseImageDataWhenConsumed(): Boolean {
|
||||
var cached = releaseImageDataWhenConsumedCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.releaseImageDataWhenConsumed()
|
||||
accessedFeatureFlags.add("releaseImageDataWhenConsumed")
|
||||
releaseImageDataWhenConsumedCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
|
||||
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
|
||||
if (cached == null) {
|
||||
|
||||
+3
-5
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<dfbd5e84392f1fda0e68324582c328b2>>
|
||||
* @generated SignedSource<<845b2ee5edc9aedbdbd052d9a930f666>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -71,6 +71,8 @@ public interface ReactNativeFeatureFlagsProvider {
|
||||
|
||||
@DoNotStrip public fun enableImagePrefetchingAndroid(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableImagePrefetchingOnUiThreadAndroid(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean
|
||||
@@ -87,8 +89,6 @@ public interface ReactNativeFeatureFlagsProvider {
|
||||
|
||||
@DoNotStrip public fun enableNetworkEventReporting(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableNewBackgroundAndBorderDrawables(): Boolean
|
||||
|
||||
@DoNotStrip public fun enablePreparedTextLayout(): Boolean
|
||||
|
||||
@DoNotStrip public fun enablePropsUpdateReconciliationAndroid(): Boolean
|
||||
@@ -125,8 +125,6 @@ public interface ReactNativeFeatureFlagsProvider {
|
||||
|
||||
@DoNotStrip public fun preventShadowTreeCommitExhaustion(): Boolean
|
||||
|
||||
@DoNotStrip public fun releaseImageDataWhenConsumed(): Boolean
|
||||
|
||||
@DoNotStrip public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
|
||||
|
||||
@DoNotStrip public fun skipActivityIdentityAssertionOnHostPause(): Boolean
|
||||
|
||||
+7
@@ -18,6 +18,7 @@ import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.common.SystemClock.currentTimeMillis
|
||||
import com.facebook.react.common.SystemClock.nanoTime
|
||||
import com.facebook.react.common.SystemClock.uptimeMillis
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager
|
||||
import com.facebook.react.jstasks.HeadlessJsTaskContext
|
||||
import com.facebook.react.jstasks.HeadlessJsTaskEventListener
|
||||
@@ -110,6 +111,7 @@ public open class JavaTimerManager(
|
||||
clearChoreographerIdleCallback()
|
||||
}
|
||||
|
||||
@LegacyArchitecture
|
||||
private fun maybeSetChoreographerIdleCallback() {
|
||||
synchronized(idleCallbackGuard) {
|
||||
if (sendIdleEvents) {
|
||||
@@ -118,6 +120,7 @@ public open class JavaTimerManager(
|
||||
}
|
||||
}
|
||||
|
||||
@LegacyArchitecture
|
||||
private fun maybeIdleCallback() {
|
||||
if (isPaused.get() && !isRunningTasks.get()) {
|
||||
clearFrameCallback()
|
||||
@@ -145,6 +148,7 @@ public open class JavaTimerManager(
|
||||
}
|
||||
}
|
||||
|
||||
@LegacyArchitecture
|
||||
private fun setChoreographerIdleCallback() {
|
||||
if (!frameIdleCallbackPosted) {
|
||||
reactChoreographer.postFrameCallback(
|
||||
@@ -155,6 +159,7 @@ public open class JavaTimerManager(
|
||||
}
|
||||
}
|
||||
|
||||
@LegacyArchitecture
|
||||
private fun clearChoreographerIdleCallback() {
|
||||
if (frameIdleCallbackPosted) {
|
||||
reactChoreographer.removeFrameCallback(
|
||||
@@ -235,6 +240,7 @@ public open class JavaTimerManager(
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
@LegacyArchitecture
|
||||
public open fun setSendIdleEvents(sendIdleEvents: Boolean) {
|
||||
synchronized(idleCallbackGuard) { this.sendIdleEvents = sendIdleEvents }
|
||||
UiThreadUtil.runOnUiThread {
|
||||
@@ -328,6 +334,7 @@ public open class JavaTimerManager(
|
||||
}
|
||||
}
|
||||
|
||||
@LegacyArchitecture
|
||||
private inner class IdleCallbackRunnable(private val frameStartTime: Long) : Runnable {
|
||||
@Volatile private var isCancelled = false
|
||||
|
||||
|
||||
+2
-2
@@ -230,8 +230,8 @@ internal class ImageLoaderModule : NativeImageLoaderAndroidSpec, LifecycleEventL
|
||||
override fun doInBackgroundGuarded(vararg params: Void) {
|
||||
val result = buildReadableMap {
|
||||
val imagePipeline: ImagePipeline = this@ImageLoaderModule.imagePipeline
|
||||
repeat(uris.size()) {
|
||||
val uriString = uris.getString(it)
|
||||
repeat(uris.size()) { index ->
|
||||
val uriString = uris.getString(index)
|
||||
if (!uriString.isNullOrEmpty()) {
|
||||
val uri = Uri.parse(uriString)
|
||||
if (imagePipeline.isInBitmapMemoryCache(uri)) {
|
||||
|
||||
+9
-4
@@ -7,15 +7,20 @@
|
||||
|
||||
package com.facebook.react.runtime
|
||||
|
||||
import com.facebook.jni.HybridData
|
||||
import com.facebook.jni.annotations.DoNotStripAny
|
||||
import com.facebook.jni.HybridClassBase
|
||||
import com.facebook.jni.annotations.DoNotStrip
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.bridge.WritableNativeArray
|
||||
import com.facebook.react.modules.core.JavaScriptTimerExecutor
|
||||
import com.facebook.soloader.SoLoader
|
||||
|
||||
@DoNotStripAny
|
||||
internal class JSTimerExecutor(private val mHybridData: HybridData) : JavaScriptTimerExecutor {
|
||||
@DoNotStrip
|
||||
internal class JSTimerExecutor() : HybridClassBase(), JavaScriptTimerExecutor {
|
||||
init {
|
||||
initHybrid()
|
||||
}
|
||||
|
||||
private external fun initHybrid()
|
||||
|
||||
private external fun callTimers(timerIDs: WritableNativeArray)
|
||||
|
||||
|
||||
+76
-91
@@ -128,12 +128,12 @@ public class ReactHostImpl(
|
||||
private var reactInstance: ReactInstance? = null
|
||||
|
||||
private val bridgelessReactContextRef = BridgelessAtomicRef<BridgelessReactContext>()
|
||||
private val id = counter.getAndIncrement()
|
||||
|
||||
private val activity = AtomicReference<Activity?>()
|
||||
private val lastUsedActivityRef = AtomicReference(WeakReference<Activity?>(null))
|
||||
private val bridgelessReactStateTracker = BridgelessReactStateTracker(ReactBuildConfig.DEBUG)
|
||||
private val reactLifecycleStateManager = ReactLifecycleStateManager(bridgelessReactStateTracker)
|
||||
private val id = counter.getAndIncrement()
|
||||
private val stateTracker = ReactHostStateTracker(id)
|
||||
private val reactLifecycleStateManager = ReactLifecycleStateManager(stateTracker)
|
||||
private var memoryPressureListener: MemoryPressureListener? = null
|
||||
private var defaultHardwareBackBtnHandler: DefaultHardwareBackBtnHandler? = null
|
||||
|
||||
@@ -178,11 +178,11 @@ public class ReactHostImpl(
|
||||
/** Initialize and run a React Native surface in a background without mounting real views. */
|
||||
internal fun prerenderSurface(surface: ReactSurfaceImpl): TaskInterface<Void> {
|
||||
val method = "prerenderSurface(surfaceId = ${surface.surfaceID})"
|
||||
log(method, "Schedule")
|
||||
stateTracker.enterState(method, "Schedule")
|
||||
|
||||
attachSurface(surface)
|
||||
return callAfterGetOrCreateReactInstance(method, bgExecutor) { reactInstance: ReactInstance ->
|
||||
log(method, "Execute")
|
||||
stateTracker.enterState(method, "Execute")
|
||||
reactInstance.prerenderSurface(surface)
|
||||
}
|
||||
}
|
||||
@@ -195,11 +195,11 @@ public class ReactHostImpl(
|
||||
*/
|
||||
internal fun startSurface(surface: ReactSurfaceImpl): TaskInterface<Void> {
|
||||
val method = "startSurface(surfaceId = ${surface.surfaceID})"
|
||||
log(method, "Schedule")
|
||||
stateTracker.enterState(method, "Schedule")
|
||||
|
||||
attachSurface(surface)
|
||||
return callAfterGetOrCreateReactInstance(method, bgExecutor) { reactInstance: ReactInstance ->
|
||||
log(method, "Execute")
|
||||
stateTracker.enterState(method, "Execute")
|
||||
reactInstance.startSurface(surface)
|
||||
}
|
||||
}
|
||||
@@ -212,11 +212,11 @@ public class ReactHostImpl(
|
||||
*/
|
||||
internal fun stopSurface(surface: ReactSurfaceImpl): TaskInterface<Void> {
|
||||
val method = "stopSurface(surfaceId = ${surface.surfaceID})"
|
||||
log(method, "Schedule")
|
||||
stateTracker.enterState(method, "Schedule")
|
||||
|
||||
detachSurface(surface)
|
||||
return callWithExistingReactInstance(method, bgExecutor) { reactInstance: ReactInstance ->
|
||||
log(method, "Execute")
|
||||
stateTracker.enterState(method, "Execute")
|
||||
reactInstance.stopSurface(surface)
|
||||
}
|
||||
.makeVoid()
|
||||
@@ -238,8 +238,7 @@ public class ReactHostImpl(
|
||||
|
||||
@ThreadConfined(ThreadConfined.UI)
|
||||
override fun onHostResume(activity: Activity?) {
|
||||
val method = "onHostResume(activity)"
|
||||
log(method)
|
||||
stateTracker.enterState("onHostResume(activity)")
|
||||
|
||||
currentActivity = activity
|
||||
|
||||
@@ -249,8 +248,7 @@ public class ReactHostImpl(
|
||||
|
||||
@ThreadConfined(ThreadConfined.UI)
|
||||
override fun onHostLeaveHint(activity: Activity?) {
|
||||
val method = "onUserLeaveHint(activity)"
|
||||
log(method)
|
||||
stateTracker.enterState("onUserLeaveHint(activity)")
|
||||
|
||||
currentReactContext?.onUserLeaveHint(activity)
|
||||
}
|
||||
@@ -258,7 +256,7 @@ public class ReactHostImpl(
|
||||
@ThreadConfined(ThreadConfined.UI)
|
||||
override fun onHostPause(activity: Activity?) {
|
||||
val method = "onHostPause(activity)"
|
||||
log(method)
|
||||
stateTracker.enterState(method)
|
||||
|
||||
val currentActivity = this.currentActivity
|
||||
if (currentActivity != null) {
|
||||
@@ -269,7 +267,7 @@ public class ReactHostImpl(
|
||||
val isNotSameActivityMessage =
|
||||
"Pausing an activity that is not the current activity, this is incorrect! Current activity: $currentActivityClass Paused activity: $activityClass"
|
||||
if (ReactNativeFeatureFlags.skipActivityIdentityAssertionOnHostPause()) {
|
||||
log(method, isNotSameActivityMessage)
|
||||
FLog.w(TAG, method, isNotSameActivityMessage)
|
||||
} else {
|
||||
Assertions.assertCondition(isSameActivity, isNotSameActivityMessage)
|
||||
}
|
||||
@@ -284,8 +282,7 @@ public class ReactHostImpl(
|
||||
/** To be called when the host activity is paused. */
|
||||
@ThreadConfined(ThreadConfined.UI)
|
||||
override fun onHostPause() {
|
||||
val method = "onHostPause()"
|
||||
log(method)
|
||||
stateTracker.enterState("onHostPause()")
|
||||
|
||||
maybeEnableDevSupport(false)
|
||||
defaultHardwareBackBtnHandler = null
|
||||
@@ -295,8 +292,7 @@ public class ReactHostImpl(
|
||||
/** To be called when the host activity is destroyed. */
|
||||
@ThreadConfined(ThreadConfined.UI)
|
||||
override fun onHostDestroy() {
|
||||
val method = "onHostDestroy()"
|
||||
log(method)
|
||||
stateTracker.enterState("onHostDestroy()")
|
||||
|
||||
maybeEnableDevSupport(false)
|
||||
moveToHostDestroy(currentReactContext)
|
||||
@@ -304,8 +300,7 @@ public class ReactHostImpl(
|
||||
|
||||
@ThreadConfined(ThreadConfined.UI)
|
||||
override fun onHostDestroy(activity: Activity?) {
|
||||
val method = "onHostDestroy(activity)"
|
||||
log(method)
|
||||
stateTracker.enterState("onHostDestroy(activity)")
|
||||
|
||||
val currentActivity = this.currentActivity
|
||||
|
||||
@@ -383,7 +378,7 @@ public class ReactHostImpl(
|
||||
{
|
||||
val reloadTask =
|
||||
(destroyTask?.let { destroyTask ->
|
||||
log(
|
||||
stateTracker.enterState(
|
||||
"reload()",
|
||||
"Waiting for destroy to finish, before reloading React Native.",
|
||||
)
|
||||
@@ -485,7 +480,7 @@ public class ReactHostImpl(
|
||||
{
|
||||
val reloadTask = reloadTask
|
||||
if (reloadTask != null) {
|
||||
log(
|
||||
stateTracker.enterState(
|
||||
"destroy()",
|
||||
"Reloading React Native. Waiting for reload to finish before destroying React Native.",
|
||||
)
|
||||
@@ -671,20 +666,20 @@ public class ReactHostImpl(
|
||||
|
||||
internal fun loadBundle(bundleLoader: JSBundleLoader): Task<Boolean> {
|
||||
val method = "loadBundle()"
|
||||
log(method, "Schedule")
|
||||
stateTracker.enterState(method, "Schedule")
|
||||
|
||||
return callWithExistingReactInstance(method) { reactInstance: ReactInstance ->
|
||||
log(method, "Execute")
|
||||
stateTracker.enterState(method, "Execute")
|
||||
reactInstance.loadJSBundle(bundleLoader)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun registerSegment(segmentId: Int, path: String, callback: Callback?): Task<Boolean> {
|
||||
val method = "registerSegment(segmentId = \"$segmentId\", path = \"$path\")"
|
||||
log(method, "Schedule")
|
||||
stateTracker.enterState(method, "Schedule")
|
||||
|
||||
return callWithExistingReactInstance(method) { reactInstance: ReactInstance ->
|
||||
log(method, "Execute")
|
||||
stateTracker.enterState(method, "Execute")
|
||||
reactInstance.registerSegment(segmentId, path)
|
||||
checkNotNull(callback).invoke()
|
||||
}
|
||||
@@ -692,7 +687,7 @@ public class ReactHostImpl(
|
||||
|
||||
internal fun handleHostException(e: Exception) {
|
||||
val method = "handleHostException(message = \"${e.message}\")"
|
||||
log(method)
|
||||
stateTracker.enterState(method)
|
||||
|
||||
if (useDevSupport) {
|
||||
devSupportManager.handleException(e)
|
||||
@@ -722,12 +717,12 @@ public class ReactHostImpl(
|
||||
}
|
||||
|
||||
internal fun attachSurface(surface: ReactSurfaceImpl) {
|
||||
log("attachSurface(surfaceId = ${surface.surfaceID})")
|
||||
stateTracker.enterState("attachSurface(surfaceId = ${surface.surfaceID})")
|
||||
synchronized(attachedSurfaces) { attachedSurfaces.add(surface) }
|
||||
}
|
||||
|
||||
internal fun detachSurface(surface: ReactSurfaceImpl) {
|
||||
log("detachSurface(surfaceId = ${surface.surfaceID})")
|
||||
stateTracker.enterState("detachSurface(surfaceId = ${surface.surfaceID})")
|
||||
synchronized(attachedSurfaces) { attachedSurfaces.remove(surface) }
|
||||
}
|
||||
|
||||
@@ -757,8 +752,7 @@ public class ReactHostImpl(
|
||||
return it
|
||||
}
|
||||
|
||||
val method = "getOrCreateStartTask()"
|
||||
log(method, "Schedule")
|
||||
stateTracker.enterState("getOrCreateStartTask()", "Schedule")
|
||||
if (ReactBuildConfig.DEBUG) {
|
||||
Assertions.assertCondition(
|
||||
ReactNativeNewArchitectureFeatureFlags.enableBridgelessArchitecture(),
|
||||
@@ -820,7 +814,7 @@ public class ReactHostImpl(
|
||||
throwable: Throwable? = null,
|
||||
) {
|
||||
val method = "raiseSoftException($callingMethod)"
|
||||
log(method, message)
|
||||
stateTracker.enterState(method, message)
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
ReactNoCrashSoftException("$method: $message", throwable),
|
||||
@@ -875,14 +869,6 @@ public class ReactHostImpl(
|
||||
executor,
|
||||
)
|
||||
|
||||
private fun getOrCreateReactContext(): BridgelessReactContext {
|
||||
val method = "getOrCreateReactContext()"
|
||||
return bridgelessReactContextRef.getOrCreate {
|
||||
log(method, "Creating BridgelessReactContext")
|
||||
BridgelessReactContext(context, this)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Entrypoint to create the ReactInstance.
|
||||
*
|
||||
@@ -903,14 +889,14 @@ public class ReactHostImpl(
|
||||
): Task<ReactInstance> {
|
||||
val method = "waitThenCallGetOrCreateReactInstanceTaskWithRetries"
|
||||
reloadTask?.let { task ->
|
||||
log(method, "React Native is reloading. Return reload task.")
|
||||
stateTracker.enterState(method, "React Native is reloading. Return reload task.")
|
||||
return task
|
||||
}
|
||||
|
||||
destroyTask?.let { task ->
|
||||
val shouldTryAgain = tryNum < maxTries
|
||||
if (shouldTryAgain) {
|
||||
log(
|
||||
stateTracker.enterState(
|
||||
method,
|
||||
"React Native is tearing down.Wait for teardown to finish, before trying again (try count = $tryNum).",
|
||||
)
|
||||
@@ -938,10 +924,10 @@ public class ReactHostImpl(
|
||||
@ThreadConfined("ReactHost")
|
||||
private fun getOrCreateReactInstanceTask(): Task<ReactInstance> {
|
||||
val method = "getOrCreateReactInstanceTask()"
|
||||
log(method)
|
||||
stateTracker.enterState(method)
|
||||
|
||||
return createReactInstanceTaskRef.getOrCreate {
|
||||
log(method, "Start")
|
||||
stateTracker.enterState(method, "Start")
|
||||
Assertions.assertCondition(
|
||||
!hostInvalidated,
|
||||
"Cannot start a new ReactInstance on an invalidated ReactHost",
|
||||
@@ -956,10 +942,14 @@ public class ReactHostImpl(
|
||||
jsBundleLoader.onSuccess(
|
||||
{ task ->
|
||||
val bundleLoader = checkNotNull(task.getResult())
|
||||
val reactContext = getOrCreateReactContext()
|
||||
val reactContext =
|
||||
bridgelessReactContextRef.getOrCreate {
|
||||
stateTracker.enterState(method, "Creating BridgelessReactContext")
|
||||
BridgelessReactContext(context, this)
|
||||
}
|
||||
reactContext.jsExceptionHandler = devSupportManager
|
||||
|
||||
log(method, "Creating ReactInstance")
|
||||
stateTracker.enterState(method, "Creating ReactInstance")
|
||||
val instance =
|
||||
ReactInstance(
|
||||
reactContext,
|
||||
@@ -980,10 +970,13 @@ public class ReactHostImpl(
|
||||
// as TurboModuleManager will handle any concurrent access
|
||||
instance.initializeEagerTurboModules()
|
||||
|
||||
log(method, "Loading JS Bundle")
|
||||
stateTracker.enterState(method, "Loading JS Bundle")
|
||||
instance.loadJSBundle(bundleLoader)
|
||||
|
||||
log(method, "Calling DevSupportManagerBase.onNewReactContextCreated(reactContext)")
|
||||
stateTracker.enterState(
|
||||
method,
|
||||
"DevSupportManager.onNewReactContextCreated()",
|
||||
)
|
||||
devSupportManager.onNewReactContextCreated(reactContext)
|
||||
|
||||
reactContext.runOnJSQueueThread {
|
||||
@@ -1040,7 +1033,7 @@ public class ReactHostImpl(
|
||||
reactLifecycleStateManager.resumeReactContextIfHostResumed(reactContext, currentActivity)
|
||||
}
|
||||
|
||||
log(method, "Executing ReactInstanceEventListeners")
|
||||
stateTracker.enterState(method, "Executing ReactInstanceEventListeners")
|
||||
for (listener in reactInstanceEventListeners) {
|
||||
listener.onReactContextInitialized(reactContext)
|
||||
}
|
||||
@@ -1053,8 +1046,7 @@ public class ReactHostImpl(
|
||||
|
||||
private val jsBundleLoader: Task<JSBundleLoader>
|
||||
get() {
|
||||
val method = "getJSBundleLoader()"
|
||||
log(method)
|
||||
stateTracker.enterState("getJSBundleLoader()")
|
||||
|
||||
if (useDevSupport && allowPackagerServerAccess) {
|
||||
return isMetroRunning.onSuccessTask(
|
||||
@@ -1093,13 +1085,13 @@ public class ReactHostImpl(
|
||||
private val isMetroRunning: Task<Boolean>
|
||||
get() {
|
||||
val method = "isMetroRunning()"
|
||||
log(method)
|
||||
stateTracker.enterState(method)
|
||||
|
||||
val taskCompletionSource = TaskCompletionSource<Boolean>()
|
||||
val asyncDevSupportManager = devSupportManager
|
||||
|
||||
asyncDevSupportManager.isPackagerRunning { packagerIsRunning: Boolean ->
|
||||
log(method, "Async result = $packagerIsRunning")
|
||||
stateTracker.enterState(method, "Async result = $packagerIsRunning")
|
||||
taskCompletionSource.setResult(packagerIsRunning)
|
||||
}
|
||||
|
||||
@@ -1108,7 +1100,7 @@ public class ReactHostImpl(
|
||||
|
||||
private fun loadJSBundleFromMetro(): Task<JSBundleLoader> {
|
||||
val method = "loadJSBundleFromMetro()"
|
||||
log(method)
|
||||
stateTracker.enterState(method)
|
||||
|
||||
val taskCompletionSource = TaskCompletionSource<JSBundleLoader>()
|
||||
val asyncDevSupportManager = devSupportManager as DevSupportManagerBase
|
||||
@@ -1121,7 +1113,7 @@ public class ReactHostImpl(
|
||||
bundleURL,
|
||||
object : BundleLoadCallback {
|
||||
override fun onSuccess() {
|
||||
log(method, "Creating BundleLoader")
|
||||
stateTracker.enterState(method, "Creating BundleLoader")
|
||||
val bundleLoader =
|
||||
JSBundleLoader.createCachedBundleFromNetworkLoader(
|
||||
bundleURL,
|
||||
@@ -1139,16 +1131,8 @@ public class ReactHostImpl(
|
||||
return taskCompletionSource.task
|
||||
}
|
||||
|
||||
private fun log(method: String, message: String) {
|
||||
bridgelessReactStateTracker.enterState("ReactHost{$id}.$method: $message")
|
||||
}
|
||||
|
||||
private fun log(method: String) {
|
||||
bridgelessReactStateTracker.enterState("ReactHost{$id}.$method")
|
||||
}
|
||||
|
||||
private fun stopAttachedSurfaces(method: String, reactInstance: ReactInstance) {
|
||||
log(method, "Stopping all React Native surfaces")
|
||||
stateTracker.enterState(method, "Stopping all React Native surfaces")
|
||||
synchronized(attachedSurfaces) {
|
||||
for (surface in attachedSurfaces) {
|
||||
reactInstance.stopSurface(surface)
|
||||
@@ -1158,7 +1142,7 @@ public class ReactHostImpl(
|
||||
}
|
||||
|
||||
private fun startAttachedSurfaces(method: String, reactInstance: ReactInstance) {
|
||||
log(method, "Restarting previously running React Native Surfaces")
|
||||
stateTracker.enterState(method, "Restarting previously running React Native Surfaces")
|
||||
synchronized(attachedSurfaces) {
|
||||
for (surface in attachedSurfaces) {
|
||||
reactInstance.startSurface(surface)
|
||||
@@ -1225,7 +1209,7 @@ public class ReactHostImpl(
|
||||
@ThreadConfined("ReactHost")
|
||||
private fun getOrCreateReloadTask(reason: String): Task<ReactInstance> {
|
||||
val method = "getOrCreateReloadTask()"
|
||||
log(method)
|
||||
stateTracker.enterState(method)
|
||||
|
||||
// Log how React Native is destroyed
|
||||
// TODO(T136397487): Remove after Venice is shipped to 100%
|
||||
@@ -1239,11 +1223,11 @@ public class ReactHostImpl(
|
||||
|
||||
// When using the immediate executor, we want to avoid scheduling any further work immediately
|
||||
// when destruction is kicked off.
|
||||
log(method, "Resetting createReactInstance task ref")
|
||||
stateTracker.enterState(method, "Resetting createReactInstance task ref")
|
||||
return createReactInstanceTaskRef.andReset
|
||||
.continueWithTask(
|
||||
{ task ->
|
||||
log(method, "Starting React Native reload")
|
||||
stateTracker.enterState(method, "Starting React Native reload")
|
||||
val reactInstance = taskUnwrapper(task, "1: Starting reload")
|
||||
|
||||
unregisterInstanceFromInspector(reactInstance)
|
||||
@@ -1257,7 +1241,7 @@ public class ReactHostImpl(
|
||||
reactContext != null &&
|
||||
reactLifecycleStateManager.lifecycleState == LifecycleState.RESUMED
|
||||
) {
|
||||
log(method, "Calling ReactContext.onHostPause()")
|
||||
stateTracker.enterState(method, "Calling ReactContext.onHostPause()")
|
||||
reactContext.onHostPause()
|
||||
}
|
||||
Task.forResult(reactInstance)
|
||||
@@ -1284,21 +1268,24 @@ public class ReactHostImpl(
|
||||
}
|
||||
|
||||
memoryPressureListener?.let { listener ->
|
||||
log(method, "Removing memory pressure listener")
|
||||
stateTracker.enterState(method, "Removing memory pressure listener")
|
||||
memoryPressureRouter.removeMemoryPressureListener(listener)
|
||||
}
|
||||
|
||||
val reactContext = bridgelessReactContextRef.value
|
||||
if (reactContext != null) {
|
||||
log(method, "Resetting ReactContext ref")
|
||||
stateTracker.enterState(method, "Resetting ReactContext ref")
|
||||
bridgelessReactContextRef.reset()
|
||||
|
||||
log(method, "Destroying ReactContext")
|
||||
stateTracker.enterState(method, "Destroying ReactContext")
|
||||
reactContext.destroy()
|
||||
}
|
||||
|
||||
if (useDevSupport && reactContext != null) {
|
||||
log(method, "Calling DevSupportManager.onReactInstanceDestroyed(reactContext)")
|
||||
stateTracker.enterState(
|
||||
method,
|
||||
"Calling DevSupportManager.onReactInstanceDestroyed(reactContext)",
|
||||
)
|
||||
devSupportManager.onReactInstanceDestroyed(reactContext)
|
||||
}
|
||||
task
|
||||
@@ -1311,14 +1298,14 @@ public class ReactHostImpl(
|
||||
if (reactInstance == null) {
|
||||
raiseSoftException(method, "Skipping ReactInstance.destroy(): ReactInstance null")
|
||||
} else {
|
||||
log(method, "Resetting ReactInstance ptr")
|
||||
stateTracker.enterState(method, "Resetting ReactInstance ptr")
|
||||
this.reactInstance = null
|
||||
|
||||
log(method, "Destroying ReactInstance")
|
||||
stateTracker.enterState(method, "Destroying ReactInstance")
|
||||
reactInstance.destroy()
|
||||
}
|
||||
|
||||
log(method, "Resetting start task ref")
|
||||
stateTracker.enterState(method, "Resetting start task ref")
|
||||
startTask = null
|
||||
|
||||
// Kickstart a new ReactInstance create
|
||||
@@ -1355,7 +1342,7 @@ public class ReactHostImpl(
|
||||
)
|
||||
}
|
||||
|
||||
log(method, "Resetting reload task ref")
|
||||
stateTracker.enterState(method, "Resetting reload task ref")
|
||||
reloadTask = null
|
||||
task
|
||||
},
|
||||
@@ -1377,7 +1364,7 @@ public class ReactHostImpl(
|
||||
@ThreadConfined("ReactHost")
|
||||
private fun getOrCreateDestroyTask(reason: String, ex: Exception?): Task<Void> {
|
||||
val method = "getOrCreateDestroyTask()"
|
||||
log(method)
|
||||
stateTracker.enterState(method)
|
||||
|
||||
// Log how React Native is destroyed
|
||||
// TODO(T136397487): Remove after Venice is shipped to 100%
|
||||
@@ -1391,11 +1378,11 @@ public class ReactHostImpl(
|
||||
|
||||
// When using the immediate executor, we want to avoid scheduling any further work immediately
|
||||
// when destruction is kicked off.
|
||||
log(method, "Resetting createReactInstance task ref")
|
||||
stateTracker.enterState(method, "Resetting createReactInstance task ref")
|
||||
return createReactInstanceTaskRef.andReset
|
||||
.continueWithTask(
|
||||
{ task: Task<ReactInstance> ->
|
||||
log(method, "Starting React Native destruction")
|
||||
stateTracker.enterState(method, "Starting React Native destruction")
|
||||
val reactInstance = taskUnwrapper(task, "1: Starting destroy")
|
||||
|
||||
unregisterInstanceFromInspector(reactInstance)
|
||||
@@ -1410,7 +1397,7 @@ public class ReactHostImpl(
|
||||
|
||||
// Step 1: Destroy DevSupportManager
|
||||
if (useDevSupport) {
|
||||
log(method, "DevSupportManager cleanup")
|
||||
stateTracker.enterState(method, "DevSupportManager cleanup")
|
||||
// TODO(T137233065): Disable DevSupportManager here
|
||||
devSupportManager.stopInspector()
|
||||
}
|
||||
@@ -1421,7 +1408,7 @@ public class ReactHostImpl(
|
||||
}
|
||||
|
||||
// Step 2: Move React Native to onHostDestroy()
|
||||
log(method, "Move ReactHost to onHostDestroy()")
|
||||
stateTracker.enterState(method, "Move ReactHost to onHostDestroy()")
|
||||
reactLifecycleStateManager.moveToOnHostDestroy(reactContext)
|
||||
Task.forResult<ReactInstance>(reactInstance)
|
||||
},
|
||||
@@ -1454,14 +1441,14 @@ public class ReactHostImpl(
|
||||
}
|
||||
|
||||
// Step 4: De-register the memory pressure listener
|
||||
log(method, "Destroying MemoryPressureRouter")
|
||||
stateTracker.enterState(method, "Destroying MemoryPressureRouter")
|
||||
memoryPressureRouter.destroy(context)
|
||||
|
||||
if (reactContext != null) {
|
||||
log(method, "Resetting ReactContext ref")
|
||||
stateTracker.enterState(method, "Resetting ReactContext ref")
|
||||
bridgelessReactContextRef.reset()
|
||||
|
||||
log(method, "Destroying ReactContext")
|
||||
stateTracker.enterState(method, "Destroying ReactContext")
|
||||
reactContext.destroy()
|
||||
}
|
||||
|
||||
@@ -1480,17 +1467,15 @@ public class ReactHostImpl(
|
||||
if (reactInstance == null) {
|
||||
raiseSoftException(method, "Skipping ReactInstance.destroy(): ReactInstance null")
|
||||
} else {
|
||||
log(method, "Resetting ReactInstance ptr")
|
||||
stateTracker.enterState(method, "Resetting ReactInstance ptr")
|
||||
this.reactInstance = null
|
||||
|
||||
log(method, "Destroying ReactInstance")
|
||||
stateTracker.enterState(method, "Destroying ReactInstance")
|
||||
reactInstance.destroy()
|
||||
}
|
||||
|
||||
log(method, "Resetting start task ref")
|
||||
stateTracker.enterState(method, "Resetting start/destroy task ref")
|
||||
startTask = null
|
||||
|
||||
log(method, "Resetting destroy task ref")
|
||||
destroyTask = null
|
||||
task
|
||||
},
|
||||
|
||||
+6
-7
@@ -8,15 +8,14 @@
|
||||
package com.facebook.react.runtime
|
||||
|
||||
import com.facebook.common.logging.FLog
|
||||
import java.util.Collections
|
||||
|
||||
internal class BridgelessReactStateTracker(private val shouldTrackStates: Boolean) {
|
||||
private val states = Collections.synchronizedList(mutableListOf<String>())
|
||||
internal class ReactHostStateTracker(private val id: Int) {
|
||||
|
||||
fun enterState(state: String) {
|
||||
FLog.w(TAG, state)
|
||||
if (shouldTrackStates) {
|
||||
states.add(state)
|
||||
fun enterState(method: String, message: String? = null) {
|
||||
if (message == null) {
|
||||
FLog.w(TAG, "ReactHost{%d}.%s", id, method)
|
||||
} else {
|
||||
FLog.w(TAG, "ReactHost{%d}.%s: %s", id, method, message)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -76,7 +76,6 @@ import java.util.ArrayList
|
||||
import java.util.HashMap
|
||||
import java.util.HashSet
|
||||
import kotlin.collections.Collection
|
||||
import kotlin.jvm.JvmStatic
|
||||
|
||||
/**
|
||||
* A replacement for [com.facebook.react.bridge.CatalystInstance] responsible for creating and
|
||||
@@ -126,7 +125,7 @@ internal class ReactInstance(
|
||||
ReactChoreographer.initialize(AndroidChoreographerProvider.getInstance())
|
||||
devSupportManager.startInspector()
|
||||
|
||||
val jsTimerExecutor = createJSTimerExecutor()
|
||||
val jsTimerExecutor = JSTimerExecutor()
|
||||
javaTimerManager =
|
||||
JavaTimerManager(
|
||||
context,
|
||||
@@ -182,7 +181,6 @@ internal class ReactInstance(
|
||||
getJSCallInvokerHolder(),
|
||||
getNativeMethodCallInvokerHolder(),
|
||||
)
|
||||
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT)
|
||||
|
||||
// Set up Fabric
|
||||
@@ -633,7 +631,5 @@ internal class ReactInstance(
|
||||
SystraceMessage.endSection(Systrace.TRACE_TAG_REACT).flush()
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic @DoNotStrip private external fun createJSTimerExecutor(): JSTimerExecutor
|
||||
}
|
||||
}
|
||||
|
||||
+9
-11
@@ -13,9 +13,7 @@ import com.facebook.infer.annotation.ThreadConfined.UI
|
||||
import com.facebook.react.bridge.ReactContext
|
||||
import com.facebook.react.common.LifecycleState
|
||||
|
||||
internal class ReactLifecycleStateManager(
|
||||
private val bridgelessReactStateTracker: BridgelessReactStateTracker
|
||||
) {
|
||||
internal class ReactLifecycleStateManager(private val stateTracker: ReactHostStateTracker) {
|
||||
private var state: LifecycleState = LifecycleState.BEFORE_CREATE
|
||||
|
||||
val lifecycleState: LifecycleState
|
||||
@@ -24,7 +22,7 @@ internal class ReactLifecycleStateManager(
|
||||
@ThreadConfined(UI)
|
||||
fun resumeReactContextIfHostResumed(currentContext: ReactContext, activity: Activity?) {
|
||||
if (state == LifecycleState.RESUMED) {
|
||||
bridgelessReactStateTracker.enterState("ReactContext.onHostResume()")
|
||||
stateTracker.enterState("ReactContext.onHostResume()")
|
||||
currentContext.onHostResume(activity)
|
||||
}
|
||||
}
|
||||
@@ -36,7 +34,7 @@ internal class ReactLifecycleStateManager(
|
||||
}
|
||||
|
||||
currentContext?.let { context ->
|
||||
bridgelessReactStateTracker.enterState("ReactContext.onHostResume()")
|
||||
stateTracker.enterState("ReactContext.onHostResume()")
|
||||
context.onHostResume(activity)
|
||||
}
|
||||
state = LifecycleState.RESUMED
|
||||
@@ -48,13 +46,13 @@ internal class ReactLifecycleStateManager(
|
||||
when (state) {
|
||||
LifecycleState.BEFORE_CREATE -> {
|
||||
// TODO: Investigate if we can remove this transition.
|
||||
bridgelessReactStateTracker.enterState("ReactContext.onHostResume()")
|
||||
stateTracker.enterState("ReactContext.onHostResume()")
|
||||
it.onHostResume(activity)
|
||||
bridgelessReactStateTracker.enterState("ReactContext.onHostPause()")
|
||||
stateTracker.enterState("ReactContext.onHostPause()")
|
||||
it.onHostPause()
|
||||
}
|
||||
LifecycleState.RESUMED -> {
|
||||
bridgelessReactStateTracker.enterState("ReactContext.onHostPause()")
|
||||
stateTracker.enterState("ReactContext.onHostPause()")
|
||||
it.onHostPause()
|
||||
}
|
||||
else -> {
|
||||
@@ -71,13 +69,13 @@ internal class ReactLifecycleStateManager(
|
||||
currentContext?.let {
|
||||
when (state) {
|
||||
LifecycleState.BEFORE_RESUME -> {
|
||||
bridgelessReactStateTracker.enterState("ReactContext.onHostDestroy()")
|
||||
stateTracker.enterState("ReactContext.onHostDestroy()")
|
||||
it.onHostDestroy()
|
||||
}
|
||||
LifecycleState.RESUMED -> {
|
||||
bridgelessReactStateTracker.enterState("ReactContext.onHostPause()")
|
||||
stateTracker.enterState("ReactContext.onHostPause()")
|
||||
it.onHostPause()
|
||||
bridgelessReactStateTracker.enterState("ReactContext.onHostDestroy()")
|
||||
stateTracker.enterState("ReactContext.onHostDestroy()")
|
||||
it.onHostDestroy()
|
||||
}
|
||||
else -> {
|
||||
|
||||
+52
-144
@@ -19,14 +19,12 @@ import android.widget.ImageView
|
||||
import androidx.annotation.ColorInt
|
||||
import com.facebook.react.bridge.ReadableArray
|
||||
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
|
||||
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
||||
import com.facebook.react.uimanager.PixelUtil.pxToDp
|
||||
import com.facebook.react.uimanager.common.UIManagerType
|
||||
import com.facebook.react.uimanager.common.ViewUtil
|
||||
import com.facebook.react.uimanager.drawable.BackgroundDrawable
|
||||
import com.facebook.react.uimanager.drawable.BorderDrawable
|
||||
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable
|
||||
import com.facebook.react.uimanager.drawable.CompositeBackgroundDrawable
|
||||
import com.facebook.react.uimanager.drawable.InsetBoxShadowDrawable
|
||||
import com.facebook.react.uimanager.drawable.MIN_INSET_BOX_SHADOW_SDK_VERSION
|
||||
@@ -59,11 +57,7 @@ public object BackgroundStyleApplicator {
|
||||
return
|
||||
}
|
||||
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
ensureBackgroundDrawable(view).backgroundColor = color ?: Color.TRANSPARENT
|
||||
} else {
|
||||
ensureCSSBackground(view).color = color ?: Color.TRANSPARENT
|
||||
}
|
||||
ensureBackgroundDrawable(view).backgroundColor = color ?: Color.TRANSPARENT
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -71,21 +65,13 @@ public object BackgroundStyleApplicator {
|
||||
view: View,
|
||||
backgroundImageLayers: List<BackgroundImageLayer>?,
|
||||
): Unit {
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
ensureBackgroundDrawable(view).backgroundImageLayers = backgroundImageLayers
|
||||
} else {
|
||||
ensureCSSBackground(view).setBackgroundImage(backgroundImageLayers)
|
||||
}
|
||||
ensureBackgroundDrawable(view).backgroundImageLayers = backgroundImageLayers
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ColorInt
|
||||
public fun getBackgroundColor(view: View): Int? {
|
||||
return if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
getBackground(view)?.backgroundColor
|
||||
} else {
|
||||
getCSSBackground(view)?.color
|
||||
}
|
||||
return getBackground(view)?.backgroundColor
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -94,16 +80,12 @@ public object BackgroundStyleApplicator {
|
||||
composite.borderInsets = composite.borderInsets ?: BorderInsets()
|
||||
composite.borderInsets?.setBorderWidth(edge, width)
|
||||
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
ensureBorderDrawable(view).setBorderWidth(edge.toSpacingType(), width?.dpToPx() ?: Float.NaN)
|
||||
composite.background?.borderInsets = composite.borderInsets
|
||||
composite.border?.borderInsets = composite.borderInsets
|
||||
ensureBorderDrawable(view).setBorderWidth(edge.toSpacingType(), width?.dpToPx() ?: Float.NaN)
|
||||
composite.background?.borderInsets = composite.borderInsets
|
||||
composite.border?.borderInsets = composite.borderInsets
|
||||
|
||||
composite.background?.invalidateSelf()
|
||||
composite.border?.invalidateSelf()
|
||||
} else {
|
||||
ensureCSSBackground(view).setBorderWidth(edge.toSpacingType(), width?.dpToPx() ?: Float.NaN)
|
||||
}
|
||||
composite.background?.invalidateSelf()
|
||||
composite.border?.invalidateSelf()
|
||||
|
||||
composite.borderInsets = composite.borderInsets ?: BorderInsets()
|
||||
composite.borderInsets?.setBorderWidth(edge, width)
|
||||
@@ -117,32 +99,23 @@ public object BackgroundStyleApplicator {
|
||||
|
||||
@JvmStatic
|
||||
public fun getBorderWidth(view: View, edge: LogicalEdge): Float? {
|
||||
return if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
val width = getBorder(view)?.borderWidth?.getRaw(edge.toSpacingType())
|
||||
if (width == null || width.isNaN()) null else width.pxToDp()
|
||||
val width = getBorder(view)?.borderWidth?.getRaw(edge.toSpacingType())
|
||||
if (width == null || width.isNaN()) {
|
||||
return null
|
||||
} else {
|
||||
val width = getCSSBackground(view)?.getBorderWidth(edge.toSpacingType())
|
||||
if (width == null || width.isNaN()) null else width.pxToDp()
|
||||
return width.pxToDp()
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun setBorderColor(view: View, edge: LogicalEdge, @ColorInt color: Int?): Unit {
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
ensureBorderDrawable(view).setBorderColor(edge, color)
|
||||
} else {
|
||||
ensureCSSBackground(view).setBorderColor(edge.toSpacingType(), color)
|
||||
}
|
||||
ensureBorderDrawable(view).setBorderColor(edge, color)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ColorInt
|
||||
public fun getBorderColor(view: View, edge: LogicalEdge): Int? {
|
||||
return if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
getBorder(view)?.getBorderColor(edge)
|
||||
} else {
|
||||
getCSSBackground(view)?.getBorderColor(edge.toSpacingType())
|
||||
}
|
||||
return getBorder(view)?.getBorderColor(edge)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -156,19 +129,14 @@ public object BackgroundStyleApplicator {
|
||||
compositeBackgroundDrawable.borderRadius ?: BorderRadiusStyle()
|
||||
compositeBackgroundDrawable.borderRadius?.set(corner, radius)
|
||||
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
if (view is ImageView) {
|
||||
ensureBackgroundDrawable(view)
|
||||
}
|
||||
compositeBackgroundDrawable.background?.borderRadius =
|
||||
compositeBackgroundDrawable.borderRadius
|
||||
compositeBackgroundDrawable.border?.borderRadius = compositeBackgroundDrawable.borderRadius
|
||||
|
||||
compositeBackgroundDrawable.background?.invalidateSelf()
|
||||
compositeBackgroundDrawable.border?.invalidateSelf()
|
||||
} else {
|
||||
ensureCSSBackground(view).setBorderRadius(corner, radius)
|
||||
if (view is ImageView) {
|
||||
ensureBackgroundDrawable(view)
|
||||
}
|
||||
compositeBackgroundDrawable.background?.borderRadius = compositeBackgroundDrawable.borderRadius
|
||||
compositeBackgroundDrawable.border?.borderRadius = compositeBackgroundDrawable.borderRadius
|
||||
|
||||
compositeBackgroundDrawable.background?.invalidateSelf()
|
||||
compositeBackgroundDrawable.border?.invalidateSelf()
|
||||
|
||||
if (Build.VERSION.SDK_INT >= MIN_OUTSET_BOX_SHADOW_SDK_VERSION) {
|
||||
for (shadow in
|
||||
@@ -191,29 +159,17 @@ public object BackgroundStyleApplicator {
|
||||
@JvmStatic
|
||||
public fun getBorderRadius(view: View, corner: BorderRadiusProp): LengthPercentage? {
|
||||
|
||||
return if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
getCompositeBackgroundDrawable(view)?.borderRadius?.get(corner)
|
||||
} else {
|
||||
getCSSBackground(view)?.borderRadius?.get(corner)
|
||||
}
|
||||
return getCompositeBackgroundDrawable(view)?.borderRadius?.get(corner)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun setBorderStyle(view: View, borderStyle: BorderStyle?) {
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
ensureBorderDrawable(view).borderStyle = borderStyle
|
||||
} else {
|
||||
ensureCSSBackground(view).borderStyle = borderStyle
|
||||
}
|
||||
ensureBorderDrawable(view).borderStyle = borderStyle
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun getBorderStyle(view: View): BorderStyle? {
|
||||
return if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
getBorder(view)?.borderStyle
|
||||
} else {
|
||||
getCSSBackground(view)?.borderStyle
|
||||
}
|
||||
return getBorder(view)?.borderStyle
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -342,71 +298,44 @@ public object BackgroundStyleApplicator {
|
||||
|
||||
@JvmStatic
|
||||
public fun setFeedbackUnderlay(view: View, drawable: Drawable?) {
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
|
||||
ensureCompositeBackgroundDrawable(view).withNewFeedbackUnderlay(drawable)
|
||||
} else {
|
||||
view.background = ensureCompositeBackgroundDrawable(view).withNewFeedbackUnderlay(drawable)
|
||||
}
|
||||
ensureCompositeBackgroundDrawable(view).withNewFeedbackUnderlay(drawable)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun clipToPaddingBox(view: View, canvas: Canvas) {
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
val drawingRect = Rect()
|
||||
view.getDrawingRect(drawingRect)
|
||||
val drawingRect = Rect()
|
||||
view.getDrawingRect(drawingRect)
|
||||
|
||||
val composite = getCompositeBackgroundDrawable(view)
|
||||
if (composite == null) {
|
||||
canvas.clipRect(drawingRect)
|
||||
return
|
||||
}
|
||||
val composite = getCompositeBackgroundDrawable(view)
|
||||
if (composite == null) {
|
||||
canvas.clipRect(drawingRect)
|
||||
return
|
||||
}
|
||||
|
||||
val paddingBoxRect = RectF()
|
||||
val paddingBoxRect = RectF()
|
||||
|
||||
val computedBorderInsets =
|
||||
composite.borderInsets?.resolve(composite.layoutDirection, view.context)
|
||||
val computedBorderInsets =
|
||||
composite.borderInsets?.resolve(composite.layoutDirection, view.context)
|
||||
|
||||
paddingBoxRect.left = composite.bounds.left + (computedBorderInsets?.left?.dpToPx() ?: 0f)
|
||||
paddingBoxRect.top = composite.bounds.top + (computedBorderInsets?.top?.dpToPx() ?: 0f)
|
||||
paddingBoxRect.right = composite.bounds.right - (computedBorderInsets?.right?.dpToPx() ?: 0f)
|
||||
paddingBoxRect.bottom =
|
||||
composite.bounds.bottom - (computedBorderInsets?.bottom?.dpToPx() ?: 0f)
|
||||
paddingBoxRect.left = composite.bounds.left + (computedBorderInsets?.left?.dpToPx() ?: 0f)
|
||||
paddingBoxRect.top = composite.bounds.top + (computedBorderInsets?.top?.dpToPx() ?: 0f)
|
||||
paddingBoxRect.right = composite.bounds.right - (computedBorderInsets?.right?.dpToPx() ?: 0f)
|
||||
paddingBoxRect.bottom = composite.bounds.bottom - (computedBorderInsets?.bottom?.dpToPx() ?: 0f)
|
||||
|
||||
if (composite.borderRadius?.hasRoundedBorders() == true) {
|
||||
val paddingBoxPath =
|
||||
createPaddingBoxPath(
|
||||
view,
|
||||
composite,
|
||||
paddingBoxRect,
|
||||
computedBorderInsets,
|
||||
)
|
||||
if (composite.borderRadius?.hasRoundedBorders() == true) {
|
||||
val paddingBoxPath =
|
||||
createPaddingBoxPath(
|
||||
view,
|
||||
composite,
|
||||
paddingBoxRect,
|
||||
computedBorderInsets,
|
||||
)
|
||||
|
||||
paddingBoxPath.offset(drawingRect.left.toFloat(), drawingRect.top.toFloat())
|
||||
canvas.clipPath(paddingBoxPath)
|
||||
} else {
|
||||
paddingBoxRect.offset(drawingRect.left.toFloat(), drawingRect.top.toFloat())
|
||||
canvas.clipRect(paddingBoxRect)
|
||||
}
|
||||
paddingBoxPath.offset(drawingRect.left.toFloat(), drawingRect.top.toFloat())
|
||||
canvas.clipPath(paddingBoxPath)
|
||||
} else {
|
||||
val drawingRect = Rect()
|
||||
view.getDrawingRect(drawingRect)
|
||||
|
||||
val cssBackground = getCSSBackground(view)
|
||||
if (cssBackground == null) {
|
||||
canvas.clipRect(drawingRect)
|
||||
return
|
||||
}
|
||||
|
||||
val paddingBoxPath = cssBackground.paddingBoxPath
|
||||
if (paddingBoxPath != null) {
|
||||
paddingBoxPath.offset(drawingRect.left.toFloat(), drawingRect.top.toFloat())
|
||||
canvas.clipPath(paddingBoxPath)
|
||||
} else {
|
||||
val paddingBoxRect = cssBackground.paddingBoxRect
|
||||
paddingBoxRect.offset(drawingRect.left.toFloat(), drawingRect.top.toFloat())
|
||||
canvas.clipRect(paddingBoxRect)
|
||||
}
|
||||
paddingBoxRect.offset(drawingRect.left.toFloat(), drawingRect.top.toFloat())
|
||||
canvas.clipRect(paddingBoxRect)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,19 +360,6 @@ public object BackgroundStyleApplicator {
|
||||
private fun getCompositeBackgroundDrawable(view: View): CompositeBackgroundDrawable? =
|
||||
view.background as? CompositeBackgroundDrawable
|
||||
|
||||
private fun ensureCSSBackground(view: View): CSSBackgroundDrawable {
|
||||
val compositeBackgroundDrawable = ensureCompositeBackgroundDrawable(view)
|
||||
var cssBackground = compositeBackgroundDrawable.cssBackground
|
||||
|
||||
return if (cssBackground != null) {
|
||||
return cssBackground
|
||||
} else {
|
||||
cssBackground = CSSBackgroundDrawable(view.context)
|
||||
view.background = compositeBackgroundDrawable.withNewCssBackground(cssBackground)
|
||||
cssBackground
|
||||
}
|
||||
}
|
||||
|
||||
private fun ensureBackgroundDrawable(view: View): BackgroundDrawable {
|
||||
val compositeBackgroundDrawable = ensureCompositeBackgroundDrawable(view)
|
||||
var background = compositeBackgroundDrawable.background
|
||||
@@ -462,9 +378,6 @@ public object BackgroundStyleApplicator {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCSSBackground(view: View): CSSBackgroundDrawable? =
|
||||
getCompositeBackgroundDrawable(view)?.cssBackground
|
||||
|
||||
private fun getBackground(view: View): BackgroundDrawable? =
|
||||
getCompositeBackgroundDrawable(view)?.background
|
||||
|
||||
@@ -492,12 +405,7 @@ public object BackgroundStyleApplicator {
|
||||
val compositeBackgroundDrawable = ensureCompositeBackgroundDrawable(view)
|
||||
var outline = compositeBackgroundDrawable.outline
|
||||
if (outline == null) {
|
||||
val borderRadius =
|
||||
if (ReactNativeFeatureFlags.enableNewBackgroundAndBorderDrawables()) {
|
||||
compositeBackgroundDrawable.borderRadius
|
||||
} else {
|
||||
ensureCSSBackground(view).borderRadius
|
||||
}
|
||||
val borderRadius = compositeBackgroundDrawable.borderRadius
|
||||
|
||||
outline =
|
||||
OutlineDrawable(
|
||||
|
||||
+3
-1
@@ -487,11 +487,13 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
* <p>Subclasses can override this method to implement custom resource prefetching for the
|
||||
* ViewManager.
|
||||
*
|
||||
* @param surfaceId surface ID
|
||||
* @param reactContext {@link com.facebook.react.bridge.ReactContext} used for the view.
|
||||
* @param params {@link MapBuffer} prefetch request params defined in C++
|
||||
*/
|
||||
@UnstableReactNativeAPI
|
||||
public void experimental_prefetchResources(ReactContext reactContext, MapBuffer params) {
|
||||
public void experimental_prefetchResources(
|
||||
int surfaceId, ReactContext reactContext, MapBuffer params) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
-1474
File diff suppressed because it is too large
Load Diff
-32
@@ -35,14 +35,6 @@ internal class CompositeBackgroundDrawable(
|
||||
/** Non-inset box shadows */
|
||||
val outerShadows: List<Drawable> = emptyList(),
|
||||
|
||||
/**
|
||||
* CSS background layer and border rendering
|
||||
*
|
||||
* TODO: we should extract path logic from here, and fast-path to using simpler drawables like
|
||||
* ColorDrawable in the common cases
|
||||
*/
|
||||
val cssBackground: CSSBackgroundDrawable? = null,
|
||||
|
||||
/** Background rendering Layer */
|
||||
val background: BackgroundDrawable? = null,
|
||||
|
||||
@@ -68,7 +60,6 @@ internal class CompositeBackgroundDrawable(
|
||||
createLayersArray(
|
||||
originalBackground,
|
||||
outerShadows,
|
||||
cssBackground,
|
||||
background,
|
||||
border,
|
||||
feedbackUnderlay,
|
||||
@@ -84,28 +75,11 @@ internal class CompositeBackgroundDrawable(
|
||||
setPaddingMode(LayerDrawable.PADDING_MODE_STACK)
|
||||
}
|
||||
|
||||
fun withNewCssBackground(cssBackground: CSSBackgroundDrawable?): CompositeBackgroundDrawable {
|
||||
return CompositeBackgroundDrawable(
|
||||
context,
|
||||
originalBackground,
|
||||
outerShadows,
|
||||
cssBackground,
|
||||
background,
|
||||
border,
|
||||
feedbackUnderlay,
|
||||
innerShadows,
|
||||
outline,
|
||||
borderInsets,
|
||||
borderRadius,
|
||||
)
|
||||
}
|
||||
|
||||
fun withNewBackground(background: BackgroundDrawable?): CompositeBackgroundDrawable {
|
||||
return CompositeBackgroundDrawable(
|
||||
context,
|
||||
originalBackground,
|
||||
outerShadows,
|
||||
cssBackground,
|
||||
background,
|
||||
border,
|
||||
feedbackUnderlay,
|
||||
@@ -124,7 +98,6 @@ internal class CompositeBackgroundDrawable(
|
||||
context,
|
||||
originalBackground,
|
||||
outerShadows,
|
||||
cssBackground,
|
||||
background,
|
||||
border,
|
||||
feedbackUnderlay,
|
||||
@@ -140,7 +113,6 @@ internal class CompositeBackgroundDrawable(
|
||||
context,
|
||||
originalBackground,
|
||||
outerShadows,
|
||||
cssBackground,
|
||||
background,
|
||||
border,
|
||||
feedbackUnderlay,
|
||||
@@ -156,7 +128,6 @@ internal class CompositeBackgroundDrawable(
|
||||
context,
|
||||
originalBackground,
|
||||
outerShadows,
|
||||
cssBackground,
|
||||
background,
|
||||
border,
|
||||
feedbackUnderlay,
|
||||
@@ -172,7 +143,6 @@ internal class CompositeBackgroundDrawable(
|
||||
context,
|
||||
originalBackground,
|
||||
outerShadows,
|
||||
cssBackground,
|
||||
background,
|
||||
border,
|
||||
newUnderlay,
|
||||
@@ -230,7 +200,6 @@ internal class CompositeBackgroundDrawable(
|
||||
private fun createLayersArray(
|
||||
originalBackground: Drawable?,
|
||||
outerShadows: List<Drawable>,
|
||||
cssBackground: CSSBackgroundDrawable?,
|
||||
background: BackgroundDrawable?,
|
||||
border: BorderDrawable?,
|
||||
feedbackUnderlay: Drawable?,
|
||||
@@ -240,7 +209,6 @@ internal class CompositeBackgroundDrawable(
|
||||
val layers = mutableListOf<Drawable?>()
|
||||
originalBackground?.let { layers.add(it) }
|
||||
layers.addAll(outerShadows.asReversed())
|
||||
cssBackground?.let { layers.add(it) }
|
||||
background?.let { layers.add(it) }
|
||||
border?.let { layers.add(it) }
|
||||
feedbackUnderlay?.let { layers.add(it) }
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ lastResort(const char* tag, const char* msg, const char* arg = nullptr) {
|
||||
}
|
||||
#else
|
||||
std::cerr << msg;
|
||||
if (arg) {
|
||||
if (arg != nullptr) {
|
||||
std::cerr << ": " << arg;
|
||||
}
|
||||
std::cerr << std::endl;
|
||||
|
||||
+3
-2
@@ -60,7 +60,8 @@ static std::unordered_map<int, std::string> responseBuffers;
|
||||
|
||||
/* static */ jboolean JInspectorNetworkReporter::isDebuggingEnabled(
|
||||
jni::alias_ref<jclass> /*unused*/) {
|
||||
return NetworkReporter::getInstance().isDebuggingEnabled();
|
||||
return static_cast<jboolean>(
|
||||
NetworkReporter::getInstance().isDebuggingEnabled());
|
||||
}
|
||||
|
||||
/* static */ void JInspectorNetworkReporter::reportRequestStart(
|
||||
@@ -138,7 +139,7 @@ static std::unordered_map<int, std::string> responseBuffers;
|
||||
jint requestId,
|
||||
jboolean cancelled) {
|
||||
NetworkReporter::getInstance().reportRequestFailed(
|
||||
std::to_string(requestId), cancelled);
|
||||
std::to_string(requestId), cancelled != 0u);
|
||||
}
|
||||
|
||||
/* static */ void JInspectorNetworkReporter::maybeStoreResponseBodyImpl(
|
||||
|
||||
+15
-29
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<16b12024bb363358ef09b9a42cb2fc97>>
|
||||
* @generated SignedSource<<d1dda9d6cd1c0179472fcc0631e46fcd>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -183,6 +183,12 @@ class ReactNativeFeatureFlagsJavaProvider
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool enableImagePrefetchingOnUiThreadAndroid() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableImagePrefetchingOnUiThreadAndroid");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool enableImmediateUpdateModeForContentOffsetChanges() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableImmediateUpdateModeForContentOffsetChanges");
|
||||
@@ -231,12 +237,6 @@ class ReactNativeFeatureFlagsJavaProvider
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool enableNewBackgroundAndBorderDrawables() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableNewBackgroundAndBorderDrawables");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool enablePreparedTextLayout() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enablePreparedTextLayout");
|
||||
@@ -345,12 +345,6 @@ class ReactNativeFeatureFlagsJavaProvider
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool releaseImageDataWhenConsumed() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("releaseImageDataWhenConsumed");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool shouldPressibilityUseW3CPointerEventsForHover() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldPressibilityUseW3CPointerEventsForHover");
|
||||
@@ -577,6 +571,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableImagePrefetchingAndroid(
|
||||
return ReactNativeFeatureFlags::enableImagePrefetchingAndroid();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::enableImagePrefetchingOnUiThreadAndroid(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::enableImagePrefetchingOnUiThreadAndroid();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::enableImmediateUpdateModeForContentOffsetChanges(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::enableImmediateUpdateModeForContentOffsetChanges();
|
||||
@@ -617,11 +616,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableNetworkEventReporting(
|
||||
return ReactNativeFeatureFlags::enableNetworkEventReporting();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::enableNewBackgroundAndBorderDrawables(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::enableNewBackgroundAndBorderDrawables();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::enablePreparedTextLayout(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::enablePreparedTextLayout();
|
||||
@@ -712,11 +706,6 @@ bool JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion(
|
||||
return ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::releaseImageDataWhenConsumed(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::releaseImageDataWhenConsumed();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
|
||||
@@ -905,6 +894,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
||||
makeNativeMethod(
|
||||
"enableImagePrefetchingAndroid",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableImagePrefetchingAndroid),
|
||||
makeNativeMethod(
|
||||
"enableImagePrefetchingOnUiThreadAndroid",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableImagePrefetchingOnUiThreadAndroid),
|
||||
makeNativeMethod(
|
||||
"enableImmediateUpdateModeForContentOffsetChanges",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableImmediateUpdateModeForContentOffsetChanges),
|
||||
@@ -929,9 +921,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
||||
makeNativeMethod(
|
||||
"enableNetworkEventReporting",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableNetworkEventReporting),
|
||||
makeNativeMethod(
|
||||
"enableNewBackgroundAndBorderDrawables",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableNewBackgroundAndBorderDrawables),
|
||||
makeNativeMethod(
|
||||
"enablePreparedTextLayout",
|
||||
JReactNativeFeatureFlagsCxxInterop::enablePreparedTextLayout),
|
||||
@@ -986,9 +975,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
||||
makeNativeMethod(
|
||||
"preventShadowTreeCommitExhaustion",
|
||||
JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion),
|
||||
makeNativeMethod(
|
||||
"releaseImageDataWhenConsumed",
|
||||
JReactNativeFeatureFlagsCxxInterop::releaseImageDataWhenConsumed),
|
||||
makeNativeMethod(
|
||||
"shouldPressibilityUseW3CPointerEventsForHover",
|
||||
JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover),
|
||||
|
||||
+4
-7
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<54118ccd475a8bf1d7db83304b1f17d0>>
|
||||
* @generated SignedSource<<31298767c1dd669d2a755e67edacc911>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -102,6 +102,9 @@ class JReactNativeFeatureFlagsCxxInterop
|
||||
static bool enableImagePrefetchingAndroid(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool enableImagePrefetchingOnUiThreadAndroid(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool enableImmediateUpdateModeForContentOffsetChanges(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
@@ -126,9 +129,6 @@ class JReactNativeFeatureFlagsCxxInterop
|
||||
static bool enableNetworkEventReporting(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool enableNewBackgroundAndBorderDrawables(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool enablePreparedTextLayout(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
@@ -183,9 +183,6 @@ class JReactNativeFeatureFlagsCxxInterop
|
||||
static bool preventShadowTreeCommitExhaustion(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool releaseImageDataWhenConsumed(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool shouldPressibilityUseW3CPointerEventsForHover(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
void JJSTimerExecutor::initHybrid(
|
||||
jni::alias_ref<JJSTimerExecutor::jhybridobject> jobj) {
|
||||
setCxxInstance(jobj);
|
||||
}
|
||||
|
||||
void JJSTimerExecutor::setTimerManager(
|
||||
std::weak_ptr<TimerManager> timerManager) {
|
||||
timerManager_ = timerManager;
|
||||
@@ -28,6 +33,7 @@ void JJSTimerExecutor::callTimers(WritableNativeArray* timerIDs) {
|
||||
void JJSTimerExecutor::registerNatives() {
|
||||
registerHybrid({
|
||||
makeNativeMethod("callTimers", JJSTimerExecutor::callTimers),
|
||||
makeNativeMethod("initHybrid", JJSTimerExecutor::initHybrid),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -17,18 +17,20 @@ namespace facebook::react {
|
||||
|
||||
class JJSTimerExecutor : public jni::HybridClass<JJSTimerExecutor> {
|
||||
public:
|
||||
JJSTimerExecutor() = default;
|
||||
|
||||
constexpr static auto kJavaDescriptor =
|
||||
"Lcom/facebook/react/runtime/JSTimerExecutor;";
|
||||
|
||||
static void registerNatives();
|
||||
|
||||
static void initHybrid(jni::alias_ref<jhybridobject> jobj);
|
||||
|
||||
void setTimerManager(std::weak_ptr<TimerManager> timerManager);
|
||||
|
||||
void callTimers(WritableNativeArray* timerIDs);
|
||||
|
||||
private:
|
||||
JJSTimerExecutor() = default;
|
||||
|
||||
friend HybridBase;
|
||||
|
||||
std::weak_ptr<TimerManager> timerManager_;
|
||||
|
||||
@@ -168,12 +168,6 @@ JReactInstance::getNativeMethodCallInvokerHolder() {
|
||||
return nativeMethodCallInvokerHolder_;
|
||||
}
|
||||
|
||||
jni::global_ref<JJSTimerExecutor::javaobject>
|
||||
JReactInstance::createJSTimerExecutor(
|
||||
jni::alias_ref<jhybridobject> /* unused */) {
|
||||
return jni::make_global(JJSTimerExecutor::newObjectCxxArgs());
|
||||
}
|
||||
|
||||
void JReactInstance::callFunctionOnModule(
|
||||
const std::string& moduleName,
|
||||
const std::string& methodName,
|
||||
@@ -217,8 +211,6 @@ void JReactInstance::unregisterFromInspector() {
|
||||
void JReactInstance::registerNatives() {
|
||||
registerHybrid({
|
||||
makeNativeMethod("initHybrid", JReactInstance::initHybrid),
|
||||
makeNativeMethod(
|
||||
"createJSTimerExecutor", JReactInstance::createJSTimerExecutor),
|
||||
makeNativeMethod(
|
||||
"loadJSBundleFromAssets", JReactInstance::loadJSBundleFromAssets),
|
||||
makeNativeMethod(
|
||||
|
||||
@@ -50,12 +50,6 @@ class JReactInstance : public jni::HybridClass<JReactInstance> {
|
||||
jni::alias_ref<JReactHostInspectorTarget::javaobject>
|
||||
jReactHostInspectorTarget);
|
||||
|
||||
/*
|
||||
* Instantiates and returns an instance of `JSTimerExecutor`.
|
||||
*/
|
||||
static jni::global_ref<JJSTimerExecutor::javaobject> createJSTimerExecutor(
|
||||
jni::alias_ref<jhybridobject> /* unused */);
|
||||
|
||||
static void registerNatives();
|
||||
|
||||
void loadJSBundleFromAssets(
|
||||
|
||||
@@ -320,7 +320,7 @@ std::string JSStringToSTLString(JSStringRef str) {
|
||||
buffer = heapBuffer.get();
|
||||
}
|
||||
size_t actualBytes = JSStringGetUTF8CString(str, buffer, maxBytes);
|
||||
if (!actualBytes) {
|
||||
if (actualBytes == 0u) {
|
||||
// Happens if maxBytes == 0 (never the case here) or if str contains
|
||||
// invalid UTF-16 data, since JSStringGetUTF8CString attempts a strict
|
||||
// conversion.
|
||||
@@ -437,7 +437,7 @@ jsi::Value JSCRuntime::evaluateJavaScript(
|
||||
JSValueRef res =
|
||||
JSEvaluateScript(ctx_, sourceRef, nullptr, sourceURLRef, 0, &exc);
|
||||
JSStringRelease(sourceRef);
|
||||
if (sourceURLRef) {
|
||||
if (sourceURLRef != nullptr) {
|
||||
JSStringRelease(sourceURLRef);
|
||||
}
|
||||
checkException(res, exc);
|
||||
@@ -597,7 +597,7 @@ void JSCRuntime::JSCObjectValue::invalidate() noexcept {
|
||||
|
||||
jsi::Runtime::PointerValue* JSCRuntime::cloneSymbol(
|
||||
const jsi::Runtime::PointerValue* pv) {
|
||||
if (!pv) {
|
||||
if (pv == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
const JSCSymbolValue* symbol = static_cast<const JSCSymbolValue*>(pv);
|
||||
@@ -611,7 +611,7 @@ jsi::Runtime::PointerValue* JSCRuntime::cloneBigInt(
|
||||
|
||||
jsi::Runtime::PointerValue* JSCRuntime::cloneString(
|
||||
const jsi::Runtime::PointerValue* pv) {
|
||||
if (!pv) {
|
||||
if (pv == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
const JSCStringValue* string = static_cast<const JSCStringValue*>(pv);
|
||||
@@ -620,7 +620,7 @@ jsi::Runtime::PointerValue* JSCRuntime::cloneString(
|
||||
|
||||
jsi::Runtime::PointerValue* JSCRuntime::cloneObject(
|
||||
const jsi::Runtime::PointerValue* pv) {
|
||||
if (!pv) {
|
||||
if (pv == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
const JSCObjectValue* object = static_cast<const JSCObjectValue*>(pv);
|
||||
@@ -632,7 +632,7 @@ jsi::Runtime::PointerValue* JSCRuntime::cloneObject(
|
||||
|
||||
jsi::Runtime::PointerValue* JSCRuntime::clonePropNameID(
|
||||
const jsi::Runtime::PointerValue* pv) {
|
||||
if (!pv) {
|
||||
if (pv == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
const JSCStringValue* string = static_cast<const JSCStringValue*>(pv);
|
||||
@@ -914,7 +914,7 @@ JSClassRef getNativeStateClass() {
|
||||
} // namespace
|
||||
|
||||
JSValueRef JSCRuntime::getNativeStateSymbol() {
|
||||
if (!nativeStateSymbol_) {
|
||||
if (nativeStateSymbol_ == nullptr) {
|
||||
JSStringRef symbolName =
|
||||
JSStringCreateWithUTF8CString("__internal_nativeState");
|
||||
JSValueRef symbol = JSValueMakeSymbol(ctx_, symbolName);
|
||||
@@ -1182,7 +1182,7 @@ jsi::Function JSCRuntime::createFunctionFromHostFunction(
|
||||
kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum |
|
||||
kJSPropertyAttributeDontDelete,
|
||||
&exc);
|
||||
if (exc) {
|
||||
if (exc != nullptr) {
|
||||
// Silently fail to set length
|
||||
exc = nullptr;
|
||||
}
|
||||
@@ -1198,7 +1198,7 @@ jsi::Function JSCRuntime::createFunctionFromHostFunction(
|
||||
kJSPropertyAttributeDontDelete,
|
||||
&exc);
|
||||
JSStringRelease(name);
|
||||
if (exc) {
|
||||
if (exc != nullptr) {
|
||||
// Silently fail to set name
|
||||
exc = nullptr;
|
||||
}
|
||||
@@ -1211,7 +1211,7 @@ jsi::Function JSCRuntime::createFunctionFromHostFunction(
|
||||
abort();
|
||||
}
|
||||
JSObjectRef funcCtor = JSValueToObject(ctx, value, &exc);
|
||||
if (!funcCtor) {
|
||||
if (funcCtor == nullptr) {
|
||||
// We can't do anything if Function is not an object
|
||||
return;
|
||||
}
|
||||
@@ -1439,7 +1439,7 @@ JSStringRef getEmptyString() {
|
||||
|
||||
jsi::Runtime::PointerValue* JSCRuntime::makeStringValue(
|
||||
JSStringRef stringRef) const {
|
||||
if (!stringRef) {
|
||||
if (stringRef == nullptr) {
|
||||
stringRef = getEmptyString();
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
@@ -1463,7 +1463,7 @@ jsi::PropNameID JSCRuntime::createPropNameID(JSStringRef str) {
|
||||
|
||||
jsi::Runtime::PointerValue* JSCRuntime::makeObjectValue(
|
||||
JSObjectRef objectRef) const {
|
||||
if (!objectRef) {
|
||||
if (objectRef == nullptr) {
|
||||
objectRef = JSObjectMake(ctx_, nullptr, nullptr);
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
|
||||
@@ -516,6 +516,10 @@ class RuntimeDecorator : public Base, private jsi::Instrumentation {
|
||||
.writeBasicBlockProfileTraceToFile(fileName);
|
||||
}
|
||||
|
||||
void dumpOpcodeStats(std::ostream& os) const override {
|
||||
const_cast<Plain&>(plain()).instrumentation().dumpOpcodeStats(os);
|
||||
}
|
||||
|
||||
/// Dump external profiler symbols to the given file name.
|
||||
void dumpProfilerSymbolsToFile(const std::string& fileName) const override {
|
||||
const_cast<Plain&>(plain()).instrumentation().dumpProfilerSymbolsToFile(
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <jsi/jsi.h>
|
||||
|
||||
struct SHUnit;
|
||||
struct SHRuntime;
|
||||
using SHUnitCreator = SHUnit* (*)();
|
||||
namespace hermes::vm {
|
||||
class GCExecTrace;
|
||||
}
|
||||
|
||||
namespace facebook::hermes {
|
||||
|
||||
namespace sampling_profiler {
|
||||
class Profile;
|
||||
}
|
||||
|
||||
namespace debugger {
|
||||
class Debugger;
|
||||
}
|
||||
|
||||
/// Interface for Hermes-specific runtime methods.The actual implementations of
|
||||
/// the pure virtual methods are provided by Hermes API.
|
||||
class JSI_EXPORT IHermes : public jsi::ICast {
|
||||
public:
|
||||
static constexpr jsi::UUID uuid{
|
||||
0xe85cfa22,
|
||||
0xdfae,
|
||||
0x11ef,
|
||||
0xa6f7,
|
||||
0x325096b39f47};
|
||||
|
||||
struct DebugFlags {
|
||||
// Looking for the .lazy flag? It's no longer necessary.
|
||||
// Source is evaluated lazily by default. See
|
||||
// RuntimeConfig::CompilationMode.
|
||||
};
|
||||
|
||||
/// Evaluate the given code in an unoptimized form, used for debugging.
|
||||
/// This will be no-op if the implementation does not have debugger enabled.
|
||||
virtual void debugJavaScript(
|
||||
const std::string& src,
|
||||
const std::string& sourceURL,
|
||||
const DebugFlags& debugFlags) = 0;
|
||||
|
||||
/// Return a ICast pointer to an object that be cast into the interface
|
||||
/// IHermesRootAPI. This root API object has static lifetime.
|
||||
virtual ICast* getHermesRootAPI() = 0;
|
||||
|
||||
/// Dump sampled stack trace for a given runtime to a data structure that can
|
||||
/// be used by third parties.
|
||||
virtual sampling_profiler::Profile dumpSampledTraceToProfile() = 0;
|
||||
|
||||
/// Serialize the sampled stack to the format expected by DevTools'
|
||||
/// Profiler.stop return type.
|
||||
virtual void sampledTraceToStreamInDevToolsFormat(std::ostream& stream) = 0;
|
||||
|
||||
/// Resets the timezone offset cache used by Hermes for performance
|
||||
/// optimization. Hermes maintains a cached timezone offset to accelerate date
|
||||
/// and time calculations. However, this cache does not automatically detect
|
||||
/// changes to the system timezone. When the system timezone changes, the
|
||||
/// integration layer (e.g., React Native) must call this method to invalidate
|
||||
/// the cache and ensure correct time calculations.
|
||||
///
|
||||
/// \note Call this method immediately after detecting any timezone change in
|
||||
/// the integrator.
|
||||
virtual void resetTimezoneCache() = 0;
|
||||
|
||||
/// Load a new segment into the Runtime.
|
||||
/// The \param context must be a valid RequireContext retrieved from JS
|
||||
/// using `require.context`.
|
||||
virtual void loadSegment(
|
||||
std::unique_ptr<const jsi::Buffer> buffer,
|
||||
const jsi::Value& context) = 0;
|
||||
|
||||
/// Gets a guaranteed unique id for an Object (or, respectively, String
|
||||
/// or PropNameId), which is assigned at allocation time and is
|
||||
/// static throughout that object's (or string's, or PropNameID's)
|
||||
/// lifetime.
|
||||
virtual uint64_t getUniqueID(const jsi::Object& o) const = 0;
|
||||
virtual uint64_t getUniqueID(const jsi::BigInt& s) const = 0;
|
||||
virtual uint64_t getUniqueID(const jsi::String& s) const = 0;
|
||||
virtual uint64_t getUniqueID(const jsi::PropNameID& pni) const = 0;
|
||||
virtual uint64_t getUniqueID(const jsi::Symbol& sym) const = 0;
|
||||
|
||||
/// Same as the other \c getUniqueID, except it can return 0 for some values.
|
||||
/// 0 means there is no ID associated with the value.
|
||||
virtual uint64_t getUniqueID(const jsi::Value& val) const = 0;
|
||||
|
||||
/// From an ID retrieved from \p getUniqueID, go back to the object.
|
||||
/// NOTE: This is much slower in general than the reverse operation, and takes
|
||||
/// up more memory. Don't use this unless it's absolutely necessary.
|
||||
/// \return a jsi::Object if a matching object is found, else returns null.
|
||||
virtual jsi::Value getObjectForID(uint64_t id) = 0;
|
||||
|
||||
/// Get a structure representing the execution history (currently just of
|
||||
/// GC, but will be generalized as necessary), to aid in debugging
|
||||
/// non-deterministic execution.
|
||||
virtual const ::hermes::vm::GCExecTrace& getGCExecTrace() const = 0;
|
||||
|
||||
/// Get IO tracking (aka HBC page access) info as a JSON string.
|
||||
/// See hermes::vm::Runtime::getIOTrackingInfoJSON() for conditions
|
||||
/// needed for there to be useful output.
|
||||
virtual std::string getIOTrackingInfoJSON() = 0;
|
||||
|
||||
/// \return a reference to the Debugger for this Runtime.
|
||||
virtual debugger::Debugger& getDebugger() = 0;
|
||||
|
||||
/// Register this runtime and thread for sampling profiler. Before using the
|
||||
/// runtime on another thread, invoke this function again from the new thread
|
||||
/// to make the sampling profiler target the new thread (and forget the old
|
||||
/// thread).
|
||||
virtual void registerForProfiling() = 0;
|
||||
/// Unregister this runtime for sampling profiler.
|
||||
virtual void unregisterForProfiling() = 0;
|
||||
|
||||
/// Define methods to interrupt JS execution and set time limits.
|
||||
/// All JS compiled to bytecode via prepareJS, or evaluateJS, will support
|
||||
/// interruption and time limit monitoring if the runtime is configured with
|
||||
/// AsyncBreakCheckInEval. If JS prepared in other ways is executed, care must
|
||||
/// be taken to ensure that it is compiled in a mode that supports it (i.e.,
|
||||
/// the emitted code contains async break checks).
|
||||
|
||||
/// Asynchronously terminates the current execution. This can be called on
|
||||
/// any thread.
|
||||
virtual void asyncTriggerTimeout() = 0;
|
||||
|
||||
/// Register this runtime for execution time limit monitoring, with a time
|
||||
/// limit of \p timeoutInMs milliseconds.
|
||||
/// See compilation notes above.
|
||||
virtual void watchTimeLimit(uint32_t timeoutInMs) = 0;
|
||||
/// Unregister this runtime for execution time limit monitoring.
|
||||
virtual void unwatchTimeLimit() = 0;
|
||||
|
||||
/// Same as \c evaluate JavaScript but with a source map, which will be
|
||||
/// applied to exception traces and debug information.
|
||||
///
|
||||
/// This is an experimental Hermes-specific API. In the future it may be
|
||||
/// renamed, moved or combined with another API, but the provided
|
||||
/// functionality will continue to be available in some form.
|
||||
virtual jsi::Value evaluateJavaScriptWithSourceMap(
|
||||
const std::shared_ptr<const jsi::Buffer>& buffer,
|
||||
const std::shared_ptr<const jsi::Buffer>& sourceMapBuf,
|
||||
const std::string& sourceURL) = 0;
|
||||
|
||||
/// Associate the SHUnit returned by \p shUnitCreator with this runtime and
|
||||
/// run its initialization code. The unit will be freed when the runtime is
|
||||
/// destroyed.
|
||||
virtual jsi::Value evaluateSHUnit(SHUnitCreator shUnitCreator) = 0;
|
||||
|
||||
/// Retrieve the underlying SHRuntime.
|
||||
virtual SHRuntime* getSHRuntime() noexcept = 0;
|
||||
|
||||
/// Returns the underlying low level Hermes VM runtime instance.
|
||||
/// This function is considered unsafe and unstable.
|
||||
/// Direct use of a vm::Runtime should be avoided as the lower level APIs are
|
||||
/// unsafe and they can change without notice.
|
||||
virtual void* getVMRuntimeUnsafe() const = 0;
|
||||
|
||||
protected:
|
||||
~IHermes() = default;
|
||||
};
|
||||
|
||||
/// Interface for provide Hermes backend specific methods.
|
||||
class IHermesSHUnit : public jsi::ICast {
|
||||
public:
|
||||
static constexpr jsi::UUID uuid{
|
||||
0x52a2d522,
|
||||
0xcbc6,
|
||||
0x4236,
|
||||
0x8d5d,
|
||||
0x2636c320ed65,
|
||||
};
|
||||
|
||||
/// Get the unit creating function pointer which can be passed to
|
||||
/// evaluateSHUnit() for evaluation.
|
||||
virtual SHUnitCreator getSHUnitCreator() const = 0;
|
||||
|
||||
protected:
|
||||
~IHermesSHUnit() = default;
|
||||
};
|
||||
} // namespace facebook::hermes
|
||||
@@ -121,6 +121,9 @@ class JSI_EXPORT Instrumentation {
|
||||
virtual void writeBasicBlockProfileTraceToFile(
|
||||
const std::string& fileName) const = 0;
|
||||
|
||||
/// Write the opcode stats to the given stream.
|
||||
virtual void dumpOpcodeStats(std::ostream& os) const = 0;
|
||||
|
||||
/// Dump external profiler symbols to the given file name.
|
||||
virtual void dumpProfilerSymbolsToFile(const std::string& fileName) const = 0;
|
||||
};
|
||||
|
||||
@@ -334,6 +334,10 @@ Instrumentation& Runtime::instrumentation() {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
void dumpOpcodeStats(std::ostream&) const override {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
void dumpProfilerSymbolsToFile(const std::string&) const override {
|
||||
std::abort();
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ Pod::Spec.new do |s|
|
||||
add_dependency(s, "React-jsinspectornetwork", :framework_name => 'jsinspector_modernnetwork')
|
||||
add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
|
||||
s.dependency "React-perflogger", version
|
||||
add_dependency(s, "React-oscompat")
|
||||
|
||||
if use_hermes()
|
||||
s.dependency "hermes-engine"
|
||||
end
|
||||
|
||||
@@ -94,4 +94,4 @@ class EnableExecutorFromThis : public std::enable_shared_from_this<Self> {
|
||||
VoidExecutor baseExecutor_;
|
||||
};
|
||||
|
||||
}; // namespace facebook::react::jsinspector_modern
|
||||
} // namespace facebook::react::jsinspector_modern
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@ class InspectorPackagerConnectionTestBase : public testing::Test {
|
||||
auto pages = getInspectorInstance().getPages();
|
||||
int liveConnectionCount = 0;
|
||||
for (size_t i = 0; i != localConnections_.objectsVended(); ++i) {
|
||||
if (localConnections_[i]) {
|
||||
if (localConnections_[i] != nullptr) {
|
||||
liveConnectionCount++;
|
||||
// localConnections_[i] is a strict mock and will complain when we
|
||||
// removePage if the call is unexpected.
|
||||
@@ -69,7 +69,7 @@ class InspectorPackagerConnectionTestBase : public testing::Test {
|
||||
for (auto& page : pages) {
|
||||
getInspectorInstance().removePage(page.id);
|
||||
}
|
||||
if (!pages.empty() && liveConnectionCount) {
|
||||
if (!pages.empty() && (liveConnectionCount != 0)) {
|
||||
if (!::testing::Test::HasFailure()) {
|
||||
FAIL()
|
||||
<< "Test case ended with " << liveConnectionCount
|
||||
|
||||
@@ -65,12 +65,12 @@ class JsiIntegrationPortableTestBase : public ::testing::Test,
|
||||
|
||||
~JsiIntegrationPortableTestBase() override {
|
||||
toPage_.reset();
|
||||
if (runtimeTarget_) {
|
||||
if (runtimeTarget_ != nullptr) {
|
||||
EXPECT_TRUE(instance_);
|
||||
instance_->unregisterRuntime(*runtimeTarget_);
|
||||
runtimeTarget_ = nullptr;
|
||||
}
|
||||
if (instance_) {
|
||||
if (instance_ != nullptr) {
|
||||
page_->unregisterInstance(*instance_);
|
||||
instance_ = nullptr;
|
||||
}
|
||||
@@ -108,12 +108,12 @@ class JsiIntegrationPortableTestBase : public ::testing::Test,
|
||||
}
|
||||
|
||||
void reload() {
|
||||
if (runtimeTarget_) {
|
||||
if (runtimeTarget_ != nullptr) {
|
||||
ASSERT_TRUE(instance_);
|
||||
instance_->unregisterRuntime(*runtimeTarget_);
|
||||
runtimeTarget_ = nullptr;
|
||||
}
|
||||
if (instance_) {
|
||||
if (instance_ != nullptr) {
|
||||
page_->unregisterInstance(*instance_);
|
||||
instance_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ void PerformanceTracer::enqueueTraceEventsFromPerformanceTracerEvent(
|
||||
|
||||
events.emplace_back(TraceEvent{
|
||||
.id = eventId,
|
||||
.name = std::move(event.name),
|
||||
.name = event.name,
|
||||
.cat = "blink.user_timing",
|
||||
.ph = 'b',
|
||||
.ts = event.start,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user