Граф коммитов

26 Коммитов

Автор SHA1 Сообщение Дата
Paige Sun 8a5ee96354 Remove log info when TurboModule cannot be found
Summary: Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D28749474

fbshipit-source-id: 28079904023f23e88b4f5bca45d7e600171e929e
2021-05-27 10:42:34 -07:00
Luna Wei 321de15803 Delete unused FlowFixMes in xplat/js/react-native-github
Summary:
Changelog:
[Internal] - Remove unused FlowFixMes

Reviewed By: kacieb

Differential Revision: D27445690

fbshipit-source-id: c1fbf4495ae020b30a458c2ef4870547fd5d5c6e
2021-03-31 18:21:47 -07:00
Paige Sun 9ebdf74708 Remove Unable to get TurboModule for DialogManagerAndroid warning for iOS
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
2021-03-26 23:48:28 -07:00
Paige Sun 3c4363d822 Clarify TurboModule cannot be found log
Reviewed By: JoshuaGross

Differential Revision: D27376177

fbshipit-source-id: 3e1a91ca7c11963874c029237bc2f45839fbbf6d
2021-03-26 21:11:47 -07:00
Paige Sun bfe3cd01bc Log info when TurboModule cannot be found
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
2021-03-25 16:08:38 -07:00
Micha Reiser 93377ff508 Remove "use strict" directive from ES Modules
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
2021-02-02 11:12:56 -08:00
Ramanpreet Nara 1f017617ac Stop passing in the schema from JavaScript
Summary:
This concludes the JavaScript clean for TurboModule JavaScript codegen teardown.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D25915168

fbshipit-source-id: 1decc394ff63b1d39d270fc048e817501ea388ea
2021-01-14 19:14:23 -08:00
Mike Vitousek 7f53bb95f7 Suppress errors and switch to new-generics in xplat
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
2020-11-20 00:50:30 -08:00
Ramanpreet Nara 9728d04f96 Fix "[TM][JS] Forward NativeModule schema to __turboModuleProxy"
Summary: Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D22888030

fbshipit-source-id: cb2b47f51f6ad5a7397045ffe5b81c9e1e396250
2020-08-04 15:49:52 -07:00
Ramanpreet Nara b5097c8dcd Back out "Back out "[TM][JS] Forward NativeModule schema to __turboModuleProxy""
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
2020-08-04 15:49:52 -07:00
Gijs Weterings f8f53e595c Back out "Forward NativeModule schema to __turboModuleProxy"
Summary:
Original commit changeset: aecaf9943f9b

Changelog: [Internal]

Reviewed By: jimmy623

Differential Revision: D22885708

fbshipit-source-id: 6839266653ad33ea8fb53c9f4664ed773c57443d
2020-08-01 06:25:26 -07:00
Ramanpreet Nara 3df6f5fb2c Forward NativeModule schema to __turboModuleProxy
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
2020-07-31 18:29:53 -07:00
Rubén Norte 4409642811 Migrate large amount of modules to flow strict and strict-local
Summary:
| Group | Before | After | Change |
| Untyped | 50 | 49 | -1 |
| flow | 197 | 155 | -42 |
| flow strict-local | 226 | 185 | -41 |
| flow strict | 33 | 117 | +84

Changelog: [Changed] Improved Flow typing of multiple modules (with migrations to `flow strict` and `flow strict-local`

Reviewed By: motiz88

Differential Revision: D22549140

fbshipit-source-id: ed29415332cfce15b244ee4dea9e13d035543175
2020-07-22 09:46:16 -07:00
Kevin Gozali fb627dac6a TM JS: Revert to import from TurboModuleRegistry.js
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
2019-11-08 11:44:16 -08:00
Kevin Gozali dd06f85bd0 TM JS: cleaned up TurboModuleRegistry types [2]
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
2019-11-04 18:51:05 -08:00
Emily Janzer c19c6cef3f Disable legacy native modules in bridgeless mode
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
2019-06-17 15:13:49 -07:00
Logan Daniels 7c005629ad Back out "[TM] Check TurboModules first in TurboModuleRegistry"
Summary:
`hg backout  D15703655`

possible cause of S180976

Reviewed By: shergin

Differential Revision: D15831550

fbshipit-source-id: 9080222c51e39f4432f4c081a8863dea2dcadec3
2019-06-14 13:57:30 -07:00
Emily Janzer bd2c57569b Use require for NativeModules
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
2019-06-12 16:18:36 -07:00
Emily Janzer 20102ef5b1 Check TurboModules first in TurboModuleRegistry
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
2019-06-10 12:05:01 -07:00
Tim Yung 8a014cdfb3 TurboModules: Improve Error Message
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
2019-06-05 17:35:01 -07:00
Tim Yung fc6bbe62b5 TurboModules: ES Module Cleanup
Summary: Minor cleanup of module conventions in `TurboModuleRegistry`.

Reviewed By: cpojer

Differential Revision: D15619210

fbshipit-source-id: 90a926f992333260eb8806b5708594c4a12e68fb
2019-06-04 02:08:20 -07:00
James Ide 0ee5f68929 Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749)
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
2019-05-08 08:48:59 -07:00
Ramanpreet Nara e1451caddd Only call __turboModuleProxy when it exists
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
2019-02-04 11:08:10 -08:00
Kevin Gozali 1bbb69355c TM: trimming down module dependencies when getting NativeModules
Summary: For now, do `require('NativeModules')` instead of `import {NativeModules} from 'react-native'`.

Reviewed By: mdvacca

Differential Revision: D13934066

fbshipit-source-id: 5188b11428a4dca8cecd1934e593d89a6e3fde2e
2019-02-01 17:43:09 -08:00
Kevin Gozali 1e6f5344d6 avoid double lookup of a nativemodule when resolving turbomodule
Summary: A simple optimization to not access `NativeModules` property twice.

Reviewed By: RSNara

Differential Revision: D13908128

fbshipit-source-id: d41cd5f855fb0176170d6bdc3ac93df5593eeca5
2019-01-31 16:58:58 -08:00
Kevin Gozali a3df286247 Move TurboModuleRegistry (JS) to github
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
2019-01-04 16:19:43 -08:00