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

6 Коммитов

Автор SHA1 Сообщение Дата
David Vacca aba11daff8 Integrate global.__nativeComponentRegistry__hasComponent into NativeComponentRegistry.js
Summary:
This diff creates a new unstable method (unstable_hasComponent) to expose `global.__nativeComponentRegistry__hasComponent` into NativeComponentRegistry.js

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D26716903

fbshipit-source-id: 52ff63b2779f41770b292cfc0b9022b1669d59fe
2021-03-09 10:39:20 -08:00
David Vacca 769136ca3c Fix rendering of Text and TextInlineViews in Fabric + StaticViewConfigs enabled
Summary:
This diff fixes the render of Text and TextInlineViews when using Fabric + StaticViewConfigs enabled

Similar to Bridgeless mode, we want TextNativeComponent to render "createReactNativeComponentClass('RCTVirtualText..." instead of NativeText.

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Text/TextNativeComponent.js?commit=f044696a1a273dec1fac227898f5603682d4b19d&lines=59

UIManager.hasViewManagerConfig returns false for all components when using StaticViewConfigs enabled.
I'm changing this method to return true when the component is supported by static view configs:

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/RKJSModules/EntryPoints/Fb4aBundle.js?commit=4661488cc6aab5078dc6b2afcbb0624e887346d5&lines=81-94

This is correct because hasViewManagerConfig is a new method that's used ONLY in two callsites:

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Text/TextNativeComponent.js?lines=59

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Utilities/deprecatedPropType.js?lines=24

Although, this can fail if "hasViewManagerConfig" is started to be used as "feature detection" (see next diffs of the stack)

I'm open to other suggestions (please comment in the diff

My current plan is:

- Land this diff (or similar) to unblock static view configs experiment next week
- Include all codeGenNativeComponents into the list of static view configs
- Migrate callsites of getViewManagerConfig() -> hasNativeConfig() (only for components that have static view configs)
- Think/Discuss/Plan long term plan about feature detection

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D26427140

fbshipit-source-id: ce8bf00d6c9793ad17bdc65eb8476aaab63db066
2021-02-17 10:46:19 -08: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
Tim Yung f638aff434 RN: Add `NativeComponentRegistry.getWithFallback_DEPRECATED`
Summary:
Creates `NativeComponentRegistry.getWithFallback_DEPRECATED`. This is deprecated from inception because it exists only to support a pattern that should not be necessary.

For any given `NativeX` component, the JavaScript module that calls `NativeComponentRegistry.get('NativeX', …)` should only exist in the JavaScript bundle if the native binary actually supports that native component.

But in today's transitional state of the world, there are JavaScript modules that use `UIManager.getViewManagerConfig('NativeX')` as a means of feature detection.

The purpose of `NativeComponentRegistry.getWithFallback_DEPRECATED` is to bridge this transitional gap. Component should migrate toward initializing the `NativeComponentRegistry` with a runtime configuration provider that enumerates all supported native components. If the native component is not supported, it should return null.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D25109988

fbshipit-source-id: 76f7077904594ca63495d8338905c43712ea02e0
2020-11-20 18:53:14 -08:00
Tim Yung 6a547c6c57 RN: Create `NativeComponentRegistry`
Summary:
Creates `NativeComponentRegistry` which makes native component initialization more declarative and configurable through an optionally configurable provider.

The next diff converts `ScrollView` to use this new abstraction as a demonstration. The plan would be to use this to replace all current manual call sites of `registerGeneratedViewConfig`, and then the ones generated via the Babel plugin.

Migrating to this will not change any production behavior, but it will enable verification of `ViewConfig` in development.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25084468

fbshipit-source-id: 9c758ddc279bf937a401a868a066907a94098f37
2020-11-19 10:55:50 -08:00
Tim Yung de92e7405d RN: Refactor `ViewConfig` Inflation
Summary:
Refactors the conversion of a `PartialViewConfig` into a `ViewConfig` to a separate function so that it can be reused.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25084469

fbshipit-source-id: 8a7f53ff2c68860697c791c37a6abbfd3213a0f9
2020-11-19 02:52:00 -08:00