Summary:
The import of DialogManagerAndroid in [Alert.js](https://fburl.com/diffusion/n57e4l50) causes "Unable to get iOS TurboModule for DialogManagerAndroid" log.
Don't call ` TurboModuleRegistry.get` on DialogManagerAndroid when the Platform is iOS.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D27376204
fbshipit-source-id: 948da5c162100ffe196d5e0a54dc8b85659239ae
Summary:
There are a surprisingly large number of nil modules in both bridge and bridgeless. So far, features may silently fail if a module is nil.
We can't log with with console.error or console.warn because many tests will break even though modules aren't used in the test.
Differential Revision: D27285601
fbshipit-source-id: 1467100f2a4c48e97de5dd6e846c26981c14f099
Summary:
ES Modules implicitly enable strict mode. Adding the "use strict" directive is, therefore, not required.
This diff removes all "use strict" directives from ES modules.
Changelog:
[Internal]
Reviewed By: motiz88
Differential Revision: D26172715
fbshipit-source-id: 57957bcbb672c4c3e62b1db633cf425c1c9d6430
Summary:
The Flow team has been building a new implementation of the system that typechecks the body of generic functions and classes. This system is more sound than the previous approach and detects errors that were uncaught previously. This diff turns on the new generic system by setting generate_tests=false in the .flowconfig, and suppresses newly discovered errors.
This diff modifies and re-signs some generated modules, because syncing from www pulled in a ton of other changes that have runtime differences, and I'm not equipped to verify that the changes are safe to land.
Changelog: [Internal]
Reviewed By: panagosg7
Differential Revision: D24801184
fbshipit-source-id: bb31fe4c5a4107d183649b436a548df5ff42e217
Summary:
**Note:** This is a carbon copy of D22832730 (3df6f5fb2c). The fixes are stacked on top of this diff, in D22888030.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D22888032
fbshipit-source-id: 2f1b7ecd39437a3c5ee9c3214419716fde2bbdff
Summary:
`babel-plugin-codegen` will run the NativeModules codegen on each NativeModule spec, and inline the generated schema into the spec's `TurboModuleRegistry.get(Enforcing)?` call. This diff will forward that schema to `__turboModuleProxy` function (i.e: the TurboModule C++ infra).
**Note:** Both this and D2280384 can't be landed until D22743294 (650c0f64f1) hits production (1-2 weeks).
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D22832730
fbshipit-source-id: aecaf9943f9b01be805ff6b90249a6cbc6abdd20
Summary:
Changelog: [Internal]
Reverting the import to the previous local module style since importing from react-native seems to introduce some perf regression. We'll revisit this later in the future.
Reviewed By: yungsters
Differential Revision: D18383893
fbshipit-source-id: f11d46a4545768f39199fd6fd22fcf14905d0a74
Summary:
Changelog: [Internal]
Moved the imports for `TurboModuleRegistry` and `TurboModule` from `react-native`. This was a jscodeshift with the script: P120688078
Reviewed By: yungsters
Differential Revision: D18262538
fbshipit-source-id: 48fac15229c897408928511c5ecbb42f17ec7b42
Summary: Requiring legacy native modules fails in bridgeless mode because they use the batched bridge, so we need to check for turbomodules first to avoid crashing. In D15703655 I reversed the order of this check for everyone, but this had some unintended side effects (everyone got turbomodules). This time I'm just using my flag to check for bridgeless mode so we can bail out of legacy native modules instead.
Reviewed By: fkgozali
Differential Revision: D15857106
fbshipit-source-id: 9d33161ae059e7a357f135c82b6865f4d2a57add
Summary:
Not totally sure if this is the best way to handle this. In Venice if a native module is missing I try to log the name of the module, but I noticed that the error I was getting was getting this:
{F161460962}
Presumably this is because importing from NativeModules looks for `__esModule`, but NativeModules uses `module.export`. So it's trying to access that property on my cpp proxy object, which doesn't exist...? Changing TurboModuleProxy to use `require` seems to fix the problem.
Reviewed By: fkgozali
Differential Revision: D15787508
fbshipit-source-id: 4b9df4e3c179117999fe6de6363edbef427a8263
Summary:
Reverse the order in which we look for modules in TurboModuleRegistry to check TurboModules first, and then fall back to legacy native modules. The main motivation for this is Venice, since requiring NativeModules.js fatals because there's no batched bridge. But we'll probably want to do this eventually anyway.
I ran a mobilelab for Marketplace home and am not seeing any significant difference in TTI.
Reviewed By: fkgozali
Differential Revision: D15703655
fbshipit-source-id: d65a4d7e09077474c30fb3938e38aee63bfa4eca
Summary: More verbose but descriptive error message when `TurboModule.getEnforcing` fails to find a native module.
Reviewed By: cpojer, gaearon
Differential Revision: D15619293
fbshipit-source-id: 0e8af4986d6ce9002966bb062766218ce9f89a13
Summary:
This is the next step in moving RN towards standard path-based requires. All the requires in `Libraries` have been rewritten to use relative requires with a few exceptions, namely, `vendor` and `Renderer/oss` since those need to be changed upstream. This commit uses relative requires instead of `react-native/...` so that if Facebook were to stop syncing out certain folders and therefore remove code from the react-native package, internal code at Facebook would not need to change.
See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail.
[General] [Changed] - Migrate "Libraries" from Haste to standard path-based requires
Pull Request resolved: https://github.com/facebook/react-native/pull/24749
Differential Revision: D15258017
Pulled By: cpojer
fbshipit-source-id: a1f480ea36c05c659b6f37c8f02f6f9216d5a323
Summary: `__turboModuleProxy` doesn't exist if you're not in the TurboModules QE. If such is the case, then we should just return null when `TurboModuleRegistry.get` is called.
Reviewed By: fkgozali
Differential Revision: D13937143
fbshipit-source-id: d3f11c52b7cbecaefba675d714f0d67236071389
Summary: For now, do `require('NativeModules')` instead of `import {NativeModules} from 'react-native'`.
Reviewed By: mdvacca
Differential Revision: D13934066
fbshipit-source-id: 5188b11428a4dca8cecd1934e593d89a6e3fde2e
Summary:
Moved the JS wrapper function to github. To access a TurboModule from JS:
```
export interface Spec extends TurboModule {
+func1: () => number,
}
const module = TurboModuleRegistry.get<Spec>('SampleTurboModule');
```
This assumes:
* the binding on the native side has been installed properly, i.e. `global.__turboModuleProxy` needs to be installed properly.
* the module `SampleTurboModule` is registered properly in native.
More instructions will be provided later.
Reviewed By: yungsters
Differential Revision: D13584561
fbshipit-source-id: 50d29d88787f8d9caa7a3ee0d54d378db866515c