@office-iss/react-native-win32 0.72.6 → 0.73.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flowconfig +15 -4
- package/CHANGELOG.json +531 -87
- package/CHANGELOG.md +213 -48
- package/IntegrationTests/PromiseTest.js +1 -0
- package/IntegrationTests/websocket_integration_test_server.js +1 -1
- package/Libraries/Animated/Animated.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +1 -1
- package/Libraries/Animated/NativeAnimatedHelper.js +14 -10
- package/Libraries/Animated/NativeAnimatedHelper.win32.js +16 -12
- package/Libraries/Animated/NativeAnimatedModule.js +6 -2
- package/Libraries/Animated/NativeAnimatedTurboModule.js +7 -4
- package/Libraries/Animated/animations/Animation.js +57 -3
- package/Libraries/Animated/animations/DecayAnimation.js +9 -0
- package/Libraries/Animated/animations/SpringAnimation.js +8 -0
- package/Libraries/Animated/animations/TimingAnimation.js +8 -0
- package/Libraries/Animated/components/AnimatedFlatList.js +2 -1
- package/Libraries/Animated/components/AnimatedScrollView.js +2 -0
- package/Libraries/Animated/components/AnimatedSectionList.js +2 -1
- package/Libraries/Animated/createAnimatedComponent.js +1 -0
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedObject.js +146 -0
- package/Libraries/Animated/nodes/AnimatedProps.js +19 -7
- package/Libraries/Animated/nodes/AnimatedStyle.js +29 -55
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -17
- package/Libraries/Animated/shouldUseTurboAnimatedModule.js +17 -0
- package/Libraries/Animated/useAnimatedProps.js +9 -10
- package/Libraries/AppState/AppState.d.ts +1 -1
- package/Libraries/AppState/NativeAppState.js +8 -4
- package/Libraries/BatchedBridge/MessageQueue.js +45 -36
- package/Libraries/Blob/Blob.js +6 -2
- package/Libraries/Blob/BlobManager.js +9 -10
- package/Libraries/Blob/BlobRegistry.js +14 -9
- package/Libraries/Blob/File.js +1 -1
- package/Libraries/Blob/FileReader.js +1 -2
- package/Libraries/Components/Button/ButtonWin32.Props.d.ts +1 -1
- package/Libraries/Components/Button/ButtonWin32.Props.js.map +1 -1
- package/Libraries/Components/Button/ButtonWin32.d.ts +1 -1
- package/Libraries/Components/Button/ButtonWin32.js +1 -4
- package/Libraries/Components/Button/ButtonWin32.js.map +1 -1
- package/Libraries/Components/Clipboard/Clipboard.d.ts +4 -4
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +3 -1
- package/Libraries/Components/EnterString.win32.d.ts +1 -1
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +26 -6
- package/Libraries/Components/Pressable/Pressable.js +3 -2
- package/Libraries/Components/Pressable/Pressable.win32.js +4 -3
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +1 -1
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +7 -7
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +7 -8
- package/Libraries/Components/ScrollView/ScrollView.js +3 -1
- package/Libraries/Components/ScrollView/ScrollView.win32.js +3 -1
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +39 -46
- package/Libraries/Components/Switch/Switch.js +1 -0
- package/Libraries/Components/Text/TextWin32.d.ts +1 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +49 -7
- package/Libraries/Components/TextInput/TextInput.flow.js +43 -10
- package/Libraries/Components/TextInput/TextInput.js +62 -10
- package/Libraries/Components/TextInput/TextInput.win32.js +953 -206
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +23 -0
- package/Libraries/Components/ToastAndroid/{ToastAndroid.ios.js → ToastAndroid.js} +9 -1
- package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +9 -1
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js +2 -2
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableOpacity.js +4 -1
- package/Libraries/Components/Touchable/TouchableWin32.d.ts +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -0
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +16 -6
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +9 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
- package/Libraries/Components/View/View.js +46 -32
- package/Libraries/Components/View/View.win32.js +37 -6
- package/Libraries/Components/View/ViewAccessibility.d.ts +8 -2
- package/Libraries/Components/View/ViewNativeComponent.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.js +18 -3
- package/Libraries/Components/View/ViewPropTypes.win32.js +30 -4
- package/Libraries/Components/View/ViewWin32.js +3 -2
- package/Libraries/Core/Devtools/loadBundleFromServer.js +152 -0
- package/Libraries/Core/Devtools/symbolicateStackTrace.js +2 -1
- package/Libraries/Core/ExceptionsManager.js +16 -7
- package/Libraries/Core/ExtendedError.js +12 -0
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/ReactNativeVersionCheck.js +0 -2
- package/Libraries/Core/ReactNativeVersionCheck.win32.js +0 -2
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +20 -0
- package/Libraries/Core/setUpDeveloperTools.js +5 -1
- package/Libraries/Core/setUpIntersectionObserver.js +16 -0
- package/Libraries/{Components/ProgressBarAndroid/ProgressBarAndroid.ios.js → Core/setUpMutationObserver.js} +6 -2
- package/Libraries/Core/setUpPerformance.js +6 -13
- package/Libraries/Core/setUpPerformanceObserver.js +16 -0
- package/Libraries/Core/setUpRegeneratorRuntime.js +4 -2
- package/Libraries/DOM/Nodes/ReactNativeElement.js +135 -18
- package/Libraries/DOM/Nodes/ReadOnlyCharacterData.js +72 -0
- package/Libraries/DOM/Nodes/ReadOnlyElement.js +209 -21
- package/Libraries/DOM/Nodes/ReadOnlyNode.js +206 -17
- package/Libraries/DOM/Nodes/ReadOnlyText.js +30 -0
- package/Libraries/DOM/Nodes/Utilities/Traversal.js +54 -0
- package/Libraries/EventEmitter/NativeEventEmitter.d.ts +0 -6
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +15 -4
- package/Libraries/Image/Image.android.js +8 -2
- package/Libraries/Image/Image.d.ts +1 -1
- package/Libraries/Image/Image.ios.js +4 -1
- package/Libraries/Image/Image.win32.js +6 -3
- package/Libraries/Image/ImageBackground.js +3 -0
- package/Libraries/Image/resolveAssetSource.win32.js +1 -1
- package/Libraries/Inspector/DevtoolsOverlay.js +6 -3
- package/Libraries/Inspector/NetworkOverlay.js +2 -2
- package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -5
- package/Libraries/Interaction/PanResponder.js +1 -4
- package/Libraries/IntersectionObserver/IntersectionObserver.js +252 -0
- package/Libraries/IntersectionObserver/IntersectionObserverEntry.js +140 -0
- package/Libraries/IntersectionObserver/IntersectionObserverManager.js +221 -0
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +41 -0
- package/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js +162 -0
- package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +2 -1
- package/Libraries/Lists/FlatList.js +15 -5
- package/Libraries/Lists/SectionList.js +4 -0
- package/Libraries/LogBox/Data/LogBoxLog.js +4 -1
- package/Libraries/LogBox/Data/LogBoxSymbolication.js +5 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +57 -20
- package/Libraries/LogBox/UI/AnsiHighlight.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +24 -31
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
- package/Libraries/LogBox/UI/LogBoxMessage.js +4 -7
- package/Libraries/MutationObserver/MutationObserver.js +184 -0
- package/Libraries/MutationObserver/MutationObserverManager.js +218 -0
- package/Libraries/MutationObserver/MutationRecord.js +82 -0
- package/Libraries/MutationObserver/NativeMutationObserver.js +58 -0
- package/Libraries/MutationObserver/__mocks__/NativeMutationObserver.js +327 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +18 -3
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +33 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +33 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +3 -5
- package/Libraries/NativeModules/specs/NativeSourceCode.js +6 -6
- package/Libraries/Network/RCTNetworking.android.js +2 -1
- package/Libraries/Network/XMLHttpRequest.js +1 -1
- package/Libraries/NewAppScreen/components/DebugInstructions.js +4 -4
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +9 -2
- package/Libraries/Performance/QuickPerformanceLogger.js +1 -1
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +1 -0
- package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +1 -0
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -1
- package/Libraries/Pressability/Pressability.js +28 -3
- package/Libraries/Pressability/Pressability.win32.js +30 -5
- package/Libraries/ReactNative/AppContainer.js +2 -3
- package/Libraries/ReactNative/AppRegistry.d.ts +0 -5
- package/Libraries/ReactNative/AppRegistry.js +66 -53
- package/Libraries/ReactNative/BridgelessUIManager.js +38 -9
- package/Libraries/ReactNative/FabricUIManager.js +143 -34
- package/Libraries/ReactNative/I18nManager.js +5 -11
- package/Libraries/ReactNative/NativeI18nManager.js +7 -5
- package/Libraries/ReactNative/PaperUIManager.win32.js +2 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +151 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +81 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +492 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +32 -0
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +19 -3
- package/Libraries/ReactNative/UIManager.js +8 -0
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +648 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +38 -2
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +27 -27
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +27 -27
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3 -3
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3 -3
- package/Libraries/Renderer/shims/ReactFabric.js +5 -6
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -3
- package/Libraries/Renderer/shims/ReactNative.js +2 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +35 -17
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -3
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -3
- package/Libraries/Settings/{Settings.android.js → Settings.js} +4 -4
- package/Libraries/Share/Share.d.ts +3 -9
- package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +9 -4
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +28 -13
- package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +14 -4
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js +1 -1
- package/Libraries/StyleSheet/PlatformColorValueTypesWin32.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheet.d.ts +10 -1
- package/Libraries/StyleSheet/StyleSheet.js +3 -0
- package/Libraries/StyleSheet/StyleSheet.win32.js +3 -0
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +31 -17
- package/Libraries/StyleSheet/StyleSheetTypes.js +90 -6
- package/Libraries/StyleSheet/flattenStyle.js +4 -0
- package/Libraries/StyleSheet/private/_TransformStyle.js +16 -2
- package/Libraries/StyleSheet/processColor.js +1 -2
- package/Libraries/StyleSheet/processTransformOrigin.js +136 -0
- package/Libraries/StyleSheet/splitLayoutProps.js +1 -0
- package/Libraries/Text/Text.d.ts +5 -5
- package/Libraries/Text/Text.js +17 -10
- package/Libraries/Text/Text.win32.js +354 -0
- package/Libraries/Text/TextProps.win32.js +281 -0
- package/Libraries/TurboModule/TurboModuleRegistry.js +47 -7
- package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
- package/Libraries/Types/CoreEventTypes.d.ts +5 -2
- package/Libraries/Utilities/GlobalPerformanceLogger.js +2 -12
- package/Libraries/Utilities/NativeDeviceInfo.js +8 -9
- package/Libraries/Utilities/NativePlatformConstantsAndroid.js +23 -18
- package/Libraries/Utilities/NativePlatformConstantsIOS.js +16 -13
- package/Libraries/Utilities/NativePlatformConstantsWin.js +13 -10
- package/Libraries/Utilities/PerformanceLoggerContext.js +1 -1
- package/Libraries/Utilities/Platform.android.js +12 -8
- package/Libraries/Utilities/Platform.d.ts +1 -0
- package/Libraries/Utilities/Platform.flow.js +84 -0
- package/Libraries/Utilities/Platform.flow.win32.js +111 -0
- package/Libraries/Utilities/Platform.ios.js +12 -8
- package/Libraries/Utilities/Platform.win32.js +12 -8
- package/Libraries/Utilities/PolyfillFunctions.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -2
- package/Libraries/Utilities/SceneTracker.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +63 -32
- package/Libraries/Utilities/useColorScheme.js +7 -8
- package/Libraries/WebPerformance/MemoryInfo.js +1 -1
- package/Libraries/WebPerformance/NativePerformance.js +3 -8
- package/Libraries/WebPerformance/NativePerformanceObserver.js +4 -0
- package/Libraries/WebPerformance/Performance.js +42 -15
- package/Libraries/WebPerformance/PerformanceEntry.js +14 -6
- package/Libraries/WebPerformance/PerformanceEventTiming.js +18 -1
- package/Libraries/WebPerformance/ReactNativeStartupTiming.js +40 -14
- package/Libraries/WebPerformance/__mocks__/NativePerformance.js +4 -2
- package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +21 -3
- package/Libraries/promiseRejectionTrackingOptions.js +1 -3
- package/Libraries/vendor/emitter/EventEmitter.js +20 -18
- package/flow/global.js +1 -3
- package/flow/jest.js +5 -1
- package/{Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js → jest/ReactNativeInternalFeatureFlagsMock.js} +2 -1
- package/jest/__tests__/setup-test.js +18 -0
- package/jest/mockModal.js +6 -4
- package/jest/setup.js +61 -30
- package/jest.config.js +1 -1
- package/just-task.js +1 -0
- package/overrides.json +51 -46
- package/package.json +35 -33
- package/src/Libraries/Components/Button/ButtonWin32.Props.ts +1 -1
- package/src/Libraries/Components/Button/ButtonWin32.tsx +0 -2
- package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +2 -2
- package/src/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
- package/src/Libraries/Components/View/ViewAccessibility.d.ts +8 -2
- package/src/Libraries/StyleSheet/PlatformColorValueTypesWin32.d.ts +1 -1
- package/types/experimental.d.ts +44 -0
- package/types/index.d.ts +2 -1
- package/types/modules/Devtools.d.ts +1 -0
- package/types/modules/globals.d.ts +16 -1
- package/IntegrationTests/BUCK +0 -32
- package/IntegrationTests/PropertiesUpdateTest.js +0 -29
- package/IntegrationTests/RCTRootViewIntegrationTestApp.js +0 -86
- package/IntegrationTests/ReactContentSizeUpdateTest.js +0 -89
- package/IntegrationTests/SizeFlexibilityUpdateTest.js +0 -106
- package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +0 -51
- package/Libraries/Components/TextInput/TextInput.Types.win32.js +0 -3
- package/Libraries/Components/TextInput/TextInput.Types.win32.js.map +0 -1
- package/Libraries/Utilities/AcessibilityMapping.js +0 -154
- package/Libraries/Utilities/AcessibilityMapping.win32.js +0 -156
- package/Libraries/Utilities/NativeDevSplitBundleLoader.js +0 -19
- package/Libraries/Utilities/useColorScheme.win32.js +0 -26
- package/flow/use-sync-external-store.js +0 -20
- package/flow-typed/npm/base64-js_v1.x.x.js +0 -12
- package/flow-typed/npm/glob_v7.x.x.js +0 -79
- package/flow-typed/npm/pretty-format_v26.x.x.js +0 -49
- package/flow-typed/npm/promise_v8.x.x.js +0 -30
- package/flow-typed/npm/react-dom_v17.x.x.js +0 -139
- package/flow-typed/npm/react-test-renderer_v16.x.x.js +0 -79
- package/flow-typed/npm/stacktrace-parser_v0.1.x.js +0 -17
- package/flow-typed/npm/yargs_v17.x.x.js +0 -341
- package/src/Libraries/Components/TextInput/TextInput.Types.win32.ts +0 -68
- /package/Libraries/{Renderer/public → ReactNative/ReactFabricPublicInstance}/ReactFabricPublicInstanceUtils.js +0 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @flow
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {AttributeConfiguration} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
|
+
|
|
13
|
+
import flattenStyle from '../../StyleSheet/flattenStyle';
|
|
14
|
+
import deepDiffer from '../../Utilities/differ/deepDiffer';
|
|
15
|
+
|
|
16
|
+
const emptyObject = {};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a payload that contains all the updates between two sets of props.
|
|
20
|
+
*
|
|
21
|
+
* These helpers are all encapsulated into a single module, because they use
|
|
22
|
+
* mutation as a performance optimization which leads to subtle shared
|
|
23
|
+
* dependencies between the code paths. To avoid this mutable state leaking
|
|
24
|
+
* across modules, I've kept them isolated to this module.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
type NestedNode = Array<NestedNode> | Object;
|
|
28
|
+
|
|
29
|
+
// Tracks removed keys
|
|
30
|
+
let removedKeys: {[string]: boolean} | null = null;
|
|
31
|
+
let removedKeyCount = 0;
|
|
32
|
+
|
|
33
|
+
const deepDifferOptions = {
|
|
34
|
+
unsafelyIgnoreFunctions: true,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
function defaultDiffer(prevProp: mixed, nextProp: mixed): boolean {
|
|
38
|
+
if (typeof nextProp !== 'object' || nextProp === null) {
|
|
39
|
+
// Scalars have already been checked for equality
|
|
40
|
+
return true;
|
|
41
|
+
} else {
|
|
42
|
+
// For objects and arrays, the default diffing algorithm is a deep compare
|
|
43
|
+
return deepDiffer(prevProp, nextProp, deepDifferOptions);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function restoreDeletedValuesInNestedArray(
|
|
48
|
+
updatePayload: Object,
|
|
49
|
+
node: NestedNode,
|
|
50
|
+
validAttributes: AttributeConfiguration,
|
|
51
|
+
) {
|
|
52
|
+
if (Array.isArray(node)) {
|
|
53
|
+
let i = node.length;
|
|
54
|
+
while (i-- && removedKeyCount > 0) {
|
|
55
|
+
restoreDeletedValuesInNestedArray(
|
|
56
|
+
updatePayload,
|
|
57
|
+
node[i],
|
|
58
|
+
validAttributes,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
} else if (node && removedKeyCount > 0) {
|
|
62
|
+
const obj = node;
|
|
63
|
+
for (const propKey in removedKeys) {
|
|
64
|
+
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
|
65
|
+
if (!removedKeys[propKey]) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
let nextProp = obj[propKey];
|
|
69
|
+
if (nextProp === undefined) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const attributeConfig = validAttributes[propKey];
|
|
74
|
+
if (!attributeConfig) {
|
|
75
|
+
continue; // not a valid native prop
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (typeof nextProp === 'function') {
|
|
79
|
+
// $FlowFixMe[incompatible-type] found when upgrading Flow
|
|
80
|
+
nextProp = true;
|
|
81
|
+
}
|
|
82
|
+
if (typeof nextProp === 'undefined') {
|
|
83
|
+
// $FlowFixMe[incompatible-type] found when upgrading Flow
|
|
84
|
+
nextProp = null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (typeof attributeConfig !== 'object') {
|
|
88
|
+
// case: !Object is the default case
|
|
89
|
+
updatePayload[propKey] = nextProp;
|
|
90
|
+
} else if (
|
|
91
|
+
typeof attributeConfig.diff === 'function' ||
|
|
92
|
+
typeof attributeConfig.process === 'function'
|
|
93
|
+
) {
|
|
94
|
+
// case: CustomAttributeConfiguration
|
|
95
|
+
const nextValue =
|
|
96
|
+
typeof attributeConfig.process === 'function'
|
|
97
|
+
? attributeConfig.process(nextProp)
|
|
98
|
+
: nextProp;
|
|
99
|
+
updatePayload[propKey] = nextValue;
|
|
100
|
+
}
|
|
101
|
+
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
|
102
|
+
removedKeys[propKey] = false;
|
|
103
|
+
removedKeyCount--;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function diffNestedArrayProperty(
|
|
109
|
+
updatePayload: null | Object,
|
|
110
|
+
prevArray: Array<NestedNode>,
|
|
111
|
+
nextArray: Array<NestedNode>,
|
|
112
|
+
validAttributes: AttributeConfiguration,
|
|
113
|
+
): null | Object {
|
|
114
|
+
const minLength =
|
|
115
|
+
prevArray.length < nextArray.length ? prevArray.length : nextArray.length;
|
|
116
|
+
let i;
|
|
117
|
+
for (i = 0; i < minLength; i++) {
|
|
118
|
+
// Diff any items in the array in the forward direction. Repeated keys
|
|
119
|
+
// will be overwritten by later values.
|
|
120
|
+
updatePayload = diffNestedProperty(
|
|
121
|
+
updatePayload,
|
|
122
|
+
prevArray[i],
|
|
123
|
+
nextArray[i],
|
|
124
|
+
validAttributes,
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
for (; i < prevArray.length; i++) {
|
|
128
|
+
// Clear out all remaining properties.
|
|
129
|
+
updatePayload = clearNestedProperty(
|
|
130
|
+
updatePayload,
|
|
131
|
+
prevArray[i],
|
|
132
|
+
validAttributes,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
for (; i < nextArray.length; i++) {
|
|
136
|
+
// Add all remaining properties.
|
|
137
|
+
updatePayload = addNestedProperty(
|
|
138
|
+
updatePayload,
|
|
139
|
+
nextArray[i],
|
|
140
|
+
validAttributes,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return updatePayload;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function diffNestedProperty(
|
|
147
|
+
updatePayload: null | Object,
|
|
148
|
+
prevProp: NestedNode,
|
|
149
|
+
nextProp: NestedNode,
|
|
150
|
+
validAttributes: AttributeConfiguration,
|
|
151
|
+
): null | Object {
|
|
152
|
+
if (!updatePayload && prevProp === nextProp) {
|
|
153
|
+
// If no properties have been added, then we can bail out quickly on object
|
|
154
|
+
// equality.
|
|
155
|
+
return updatePayload;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (!prevProp || !nextProp) {
|
|
159
|
+
if (nextProp) {
|
|
160
|
+
return addNestedProperty(updatePayload, nextProp, validAttributes);
|
|
161
|
+
}
|
|
162
|
+
if (prevProp) {
|
|
163
|
+
return clearNestedProperty(updatePayload, prevProp, validAttributes);
|
|
164
|
+
}
|
|
165
|
+
return updatePayload;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!Array.isArray(prevProp) && !Array.isArray(nextProp)) {
|
|
169
|
+
// Both are leaves, we can diff the leaves.
|
|
170
|
+
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
|
|
174
|
+
// Both are arrays, we can diff the arrays.
|
|
175
|
+
return diffNestedArrayProperty(
|
|
176
|
+
updatePayload,
|
|
177
|
+
prevProp,
|
|
178
|
+
nextProp,
|
|
179
|
+
validAttributes,
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (Array.isArray(prevProp)) {
|
|
184
|
+
return diffProperties(
|
|
185
|
+
updatePayload,
|
|
186
|
+
// $FlowFixMe - We know that this is always an object when the input is.
|
|
187
|
+
flattenStyle(prevProp),
|
|
188
|
+
// $FlowFixMe - We know that this isn't an array because of above flow.
|
|
189
|
+
nextProp,
|
|
190
|
+
validAttributes,
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return diffProperties(
|
|
195
|
+
updatePayload,
|
|
196
|
+
prevProp,
|
|
197
|
+
// $FlowFixMe - We know that this is always an object when the input is.
|
|
198
|
+
flattenStyle(nextProp),
|
|
199
|
+
validAttributes,
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* addNestedProperty takes a single set of props and valid attribute
|
|
205
|
+
* attribute configurations. It processes each prop and adds it to the
|
|
206
|
+
* updatePayload.
|
|
207
|
+
*/
|
|
208
|
+
function addNestedProperty(
|
|
209
|
+
updatePayload: null | Object,
|
|
210
|
+
nextProp: NestedNode,
|
|
211
|
+
validAttributes: AttributeConfiguration,
|
|
212
|
+
): $FlowFixMe {
|
|
213
|
+
if (!nextProp) {
|
|
214
|
+
return updatePayload;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (!Array.isArray(nextProp)) {
|
|
218
|
+
// Add each property of the leaf.
|
|
219
|
+
return addProperties(updatePayload, nextProp, validAttributes);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
for (let i = 0; i < nextProp.length; i++) {
|
|
223
|
+
// Add all the properties of the array.
|
|
224
|
+
updatePayload = addNestedProperty(
|
|
225
|
+
updatePayload,
|
|
226
|
+
nextProp[i],
|
|
227
|
+
validAttributes,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return updatePayload;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* clearNestedProperty takes a single set of props and valid attributes. It
|
|
236
|
+
* adds a null sentinel to the updatePayload, for each prop key.
|
|
237
|
+
*/
|
|
238
|
+
function clearNestedProperty(
|
|
239
|
+
updatePayload: null | Object,
|
|
240
|
+
prevProp: NestedNode,
|
|
241
|
+
validAttributes: AttributeConfiguration,
|
|
242
|
+
): null | Object {
|
|
243
|
+
if (!prevProp) {
|
|
244
|
+
return updatePayload;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (!Array.isArray(prevProp)) {
|
|
248
|
+
// Add each property of the leaf.
|
|
249
|
+
return clearProperties(updatePayload, prevProp, validAttributes);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
for (let i = 0; i < prevProp.length; i++) {
|
|
253
|
+
// Add all the properties of the array.
|
|
254
|
+
updatePayload = clearNestedProperty(
|
|
255
|
+
updatePayload,
|
|
256
|
+
prevProp[i],
|
|
257
|
+
validAttributes,
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
return updatePayload;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* diffProperties takes two sets of props and a set of valid attributes
|
|
265
|
+
* and write to updatePayload the values that changed or were deleted.
|
|
266
|
+
* If no updatePayload is provided, a new one is created and returned if
|
|
267
|
+
* anything changed.
|
|
268
|
+
*/
|
|
269
|
+
function diffProperties(
|
|
270
|
+
updatePayload: null | Object,
|
|
271
|
+
prevProps: Object,
|
|
272
|
+
nextProps: Object,
|
|
273
|
+
validAttributes: AttributeConfiguration,
|
|
274
|
+
): null | Object {
|
|
275
|
+
let attributeConfig;
|
|
276
|
+
let nextProp;
|
|
277
|
+
let prevProp;
|
|
278
|
+
|
|
279
|
+
for (const propKey in nextProps) {
|
|
280
|
+
attributeConfig = validAttributes[propKey];
|
|
281
|
+
if (!attributeConfig) {
|
|
282
|
+
continue; // not a valid native prop
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
prevProp = prevProps[propKey];
|
|
286
|
+
nextProp = nextProps[propKey];
|
|
287
|
+
|
|
288
|
+
// functions are converted to booleans as markers that the associated
|
|
289
|
+
// events should be sent from native.
|
|
290
|
+
if (typeof nextProp === 'function') {
|
|
291
|
+
nextProp = (true: any);
|
|
292
|
+
// If nextProp is not a function, then don't bother changing prevProp
|
|
293
|
+
// since nextProp will win and go into the updatePayload regardless.
|
|
294
|
+
if (typeof prevProp === 'function') {
|
|
295
|
+
prevProp = (true: any);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// An explicit value of undefined is treated as a null because it overrides
|
|
300
|
+
// any other preceding value.
|
|
301
|
+
if (typeof nextProp === 'undefined') {
|
|
302
|
+
nextProp = (null: any);
|
|
303
|
+
if (typeof prevProp === 'undefined') {
|
|
304
|
+
prevProp = (null: any);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (removedKeys) {
|
|
309
|
+
removedKeys[propKey] = false;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (updatePayload && updatePayload[propKey] !== undefined) {
|
|
313
|
+
// Something else already triggered an update to this key because another
|
|
314
|
+
// value diffed. Since we're now later in the nested arrays our value is
|
|
315
|
+
// more important so we need to calculate it and override the existing
|
|
316
|
+
// value. It doesn't matter if nothing changed, we'll set it anyway.
|
|
317
|
+
|
|
318
|
+
// Pattern match on: attributeConfig
|
|
319
|
+
if (typeof attributeConfig !== 'object') {
|
|
320
|
+
// case: !Object is the default case
|
|
321
|
+
updatePayload[propKey] = nextProp;
|
|
322
|
+
} else if (
|
|
323
|
+
typeof attributeConfig.diff === 'function' ||
|
|
324
|
+
typeof attributeConfig.process === 'function'
|
|
325
|
+
) {
|
|
326
|
+
// case: CustomAttributeConfiguration
|
|
327
|
+
const nextValue =
|
|
328
|
+
typeof attributeConfig.process === 'function'
|
|
329
|
+
? attributeConfig.process(nextProp)
|
|
330
|
+
: nextProp;
|
|
331
|
+
updatePayload[propKey] = nextValue;
|
|
332
|
+
}
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (prevProp === nextProp) {
|
|
337
|
+
continue; // nothing changed
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Pattern match on: attributeConfig
|
|
341
|
+
if (typeof attributeConfig !== 'object') {
|
|
342
|
+
// case: !Object is the default case
|
|
343
|
+
if (defaultDiffer(prevProp, nextProp)) {
|
|
344
|
+
// a normal leaf has changed
|
|
345
|
+
(updatePayload || (updatePayload = ({}: {[string]: $FlowFixMe})))[
|
|
346
|
+
propKey
|
|
347
|
+
] = nextProp;
|
|
348
|
+
}
|
|
349
|
+
} else if (
|
|
350
|
+
typeof attributeConfig.diff === 'function' ||
|
|
351
|
+
typeof attributeConfig.process === 'function'
|
|
352
|
+
) {
|
|
353
|
+
// case: CustomAttributeConfiguration
|
|
354
|
+
const shouldUpdate =
|
|
355
|
+
prevProp === undefined ||
|
|
356
|
+
(typeof attributeConfig.diff === 'function'
|
|
357
|
+
? attributeConfig.diff(prevProp, nextProp)
|
|
358
|
+
: defaultDiffer(prevProp, nextProp));
|
|
359
|
+
if (shouldUpdate) {
|
|
360
|
+
const nextValue =
|
|
361
|
+
typeof attributeConfig.process === 'function'
|
|
362
|
+
? // $FlowFixMe[incompatible-use] found when upgrading Flow
|
|
363
|
+
attributeConfig.process(nextProp)
|
|
364
|
+
: nextProp;
|
|
365
|
+
(updatePayload || (updatePayload = ({}: {[string]: $FlowFixMe})))[
|
|
366
|
+
propKey
|
|
367
|
+
] = nextValue;
|
|
368
|
+
}
|
|
369
|
+
} else {
|
|
370
|
+
// default: fallthrough case when nested properties are defined
|
|
371
|
+
removedKeys = null;
|
|
372
|
+
removedKeyCount = 0;
|
|
373
|
+
// We think that attributeConfig is not CustomAttributeConfiguration at
|
|
374
|
+
// this point so we assume it must be AttributeConfiguration.
|
|
375
|
+
updatePayload = diffNestedProperty(
|
|
376
|
+
updatePayload,
|
|
377
|
+
prevProp,
|
|
378
|
+
nextProp,
|
|
379
|
+
((attributeConfig: any): AttributeConfiguration),
|
|
380
|
+
);
|
|
381
|
+
if (removedKeyCount > 0 && updatePayload) {
|
|
382
|
+
restoreDeletedValuesInNestedArray(
|
|
383
|
+
updatePayload,
|
|
384
|
+
nextProp,
|
|
385
|
+
((attributeConfig: any): AttributeConfiguration),
|
|
386
|
+
);
|
|
387
|
+
removedKeys = null;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// Also iterate through all the previous props to catch any that have been
|
|
393
|
+
// removed and make sure native gets the signal so it can reset them to the
|
|
394
|
+
// default.
|
|
395
|
+
for (const propKey in prevProps) {
|
|
396
|
+
if (nextProps[propKey] !== undefined) {
|
|
397
|
+
continue; // we've already covered this key in the previous pass
|
|
398
|
+
}
|
|
399
|
+
attributeConfig = validAttributes[propKey];
|
|
400
|
+
if (!attributeConfig) {
|
|
401
|
+
continue; // not a valid native prop
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (updatePayload && updatePayload[propKey] !== undefined) {
|
|
405
|
+
// This was already updated to a diff result earlier.
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
prevProp = prevProps[propKey];
|
|
410
|
+
if (prevProp === undefined) {
|
|
411
|
+
continue; // was already empty anyway
|
|
412
|
+
}
|
|
413
|
+
// Pattern match on: attributeConfig
|
|
414
|
+
if (
|
|
415
|
+
typeof attributeConfig !== 'object' ||
|
|
416
|
+
typeof attributeConfig.diff === 'function' ||
|
|
417
|
+
typeof attributeConfig.process === 'function'
|
|
418
|
+
) {
|
|
419
|
+
// case: CustomAttributeConfiguration | !Object
|
|
420
|
+
// Flag the leaf property for removal by sending a sentinel.
|
|
421
|
+
(updatePayload || (updatePayload = ({}: {[string]: $FlowFixMe})))[
|
|
422
|
+
propKey
|
|
423
|
+
] = null;
|
|
424
|
+
if (!removedKeys) {
|
|
425
|
+
removedKeys = ({}: {[string]: boolean});
|
|
426
|
+
}
|
|
427
|
+
if (!removedKeys[propKey]) {
|
|
428
|
+
removedKeys[propKey] = true;
|
|
429
|
+
removedKeyCount++;
|
|
430
|
+
}
|
|
431
|
+
} else {
|
|
432
|
+
// default:
|
|
433
|
+
// This is a nested attribute configuration where all the properties
|
|
434
|
+
// were removed so we need to go through and clear out all of them.
|
|
435
|
+
updatePayload = clearNestedProperty(
|
|
436
|
+
updatePayload,
|
|
437
|
+
prevProp,
|
|
438
|
+
((attributeConfig: any): AttributeConfiguration),
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return updatePayload;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* addProperties adds all the valid props to the payload after being processed.
|
|
447
|
+
*/
|
|
448
|
+
function addProperties(
|
|
449
|
+
updatePayload: null | Object,
|
|
450
|
+
props: Object,
|
|
451
|
+
validAttributes: AttributeConfiguration,
|
|
452
|
+
): null | Object {
|
|
453
|
+
// TODO: Fast path
|
|
454
|
+
return diffProperties(updatePayload, emptyObject, props, validAttributes);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* clearProperties clears all the previous props by adding a null sentinel
|
|
459
|
+
* to the payload for each valid key.
|
|
460
|
+
*/
|
|
461
|
+
function clearProperties(
|
|
462
|
+
updatePayload: null | Object,
|
|
463
|
+
prevProps: Object,
|
|
464
|
+
validAttributes: AttributeConfiguration,
|
|
465
|
+
): null | Object {
|
|
466
|
+
// TODO: Fast path
|
|
467
|
+
return diffProperties(updatePayload, prevProps, emptyObject, validAttributes);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export function create(
|
|
471
|
+
props: Object,
|
|
472
|
+
validAttributes: AttributeConfiguration,
|
|
473
|
+
): null | Object {
|
|
474
|
+
return addProperties(
|
|
475
|
+
null, // updatePayload
|
|
476
|
+
props,
|
|
477
|
+
validAttributes,
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export function diff(
|
|
482
|
+
prevProps: Object,
|
|
483
|
+
nextProps: Object,
|
|
484
|
+
validAttributes: AttributeConfiguration,
|
|
485
|
+
): null | Object {
|
|
486
|
+
return diffProperties(
|
|
487
|
+
null, // updatePayload
|
|
488
|
+
prevProps,
|
|
489
|
+
nextProps,
|
|
490
|
+
validAttributes,
|
|
491
|
+
);
|
|
492
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @flow strict-local
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {AttributeConfiguration} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
|
+
|
|
13
|
+
export default function warnForStyleProps(
|
|
14
|
+
props: {...},
|
|
15
|
+
validAttributes: AttributeConfiguration,
|
|
16
|
+
): void {
|
|
17
|
+
if (__DEV__) {
|
|
18
|
+
for (const key in validAttributes.style) {
|
|
19
|
+
if (!(validAttributes[key] || props[key] === undefined)) {
|
|
20
|
+
console.error(
|
|
21
|
+
'You are setting the style `{ %s' +
|
|
22
|
+
': ... }` as a prop. You ' +
|
|
23
|
+
'should nest it in a style object. ' +
|
|
24
|
+
'E.g. `{ style: { %s' +
|
|
25
|
+
': ... } }`',
|
|
26
|
+
key,
|
|
27
|
+
key,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -38,13 +38,26 @@ export type FeatureFlags = {|
|
|
|
38
38
|
animatedShouldUseSingleOp: () => boolean,
|
|
39
39
|
/**
|
|
40
40
|
* Enables GlobalPerformanceLogger replacement with a WebPerformance API based
|
|
41
|
-
* implementation
|
|
41
|
+
* implementation. Tri-state due to being sensitive to initialization order
|
|
42
|
+
* vs the platform-specific ReactNativeFeatureFlags implementation.
|
|
42
43
|
*/
|
|
43
|
-
isGlobalWebPerformanceLoggerEnabled: () => boolean,
|
|
44
|
+
isGlobalWebPerformanceLoggerEnabled: () => ?boolean,
|
|
44
45
|
/**
|
|
45
46
|
* Enables access to the host tree in Fabric using DOM-compatible APIs.
|
|
46
47
|
*/
|
|
47
48
|
enableAccessToHostTreeInFabric: () => boolean,
|
|
49
|
+
/**
|
|
50
|
+
* Enables use of AnimatedObject for animating transform values.
|
|
51
|
+
*/
|
|
52
|
+
shouldUseAnimatedObjectForTransform: () => boolean,
|
|
53
|
+
/**
|
|
54
|
+
* Enables use of setNativeProps in JS driven animations.
|
|
55
|
+
*/
|
|
56
|
+
shouldUseSetNativePropsInFabric: () => boolean,
|
|
57
|
+
/**
|
|
58
|
+
* Enables a hotfix for forcing materialization of views with elevation set.
|
|
59
|
+
*/
|
|
60
|
+
shouldForceUnflattenForElevation: () => boolean,
|
|
48
61
|
|};
|
|
49
62
|
|
|
50
63
|
const ReactNativeFeatureFlags: FeatureFlags = {
|
|
@@ -53,8 +66,11 @@ const ReactNativeFeatureFlags: FeatureFlags = {
|
|
|
53
66
|
shouldPressibilityUseW3CPointerEventsForHover: () => false,
|
|
54
67
|
animatedShouldDebounceQueueFlush: () => false,
|
|
55
68
|
animatedShouldUseSingleOp: () => false,
|
|
56
|
-
isGlobalWebPerformanceLoggerEnabled: () =>
|
|
69
|
+
isGlobalWebPerformanceLoggerEnabled: () => undefined,
|
|
57
70
|
enableAccessToHostTreeInFabric: () => false,
|
|
71
|
+
shouldUseAnimatedObjectForTransform: () => false,
|
|
72
|
+
shouldUseSetNativePropsInFabric: () => false,
|
|
73
|
+
shouldForceUnflattenForElevation: () => false,
|
|
58
74
|
};
|
|
59
75
|
|
|
60
76
|
module.exports = ReactNativeFeatureFlags;
|
|
@@ -180,6 +180,14 @@ const UIManager = {
|
|
|
180
180
|
commandName: number | string,
|
|
181
181
|
commandArgs: any[],
|
|
182
182
|
) {
|
|
183
|
+
// Sometimes, libraries directly pass in the output of `findNodeHandle` to
|
|
184
|
+
// this function without checking if it's null. This guards against that
|
|
185
|
+
// case. We throw early here in Javascript so we can get a JS stacktrace
|
|
186
|
+
// instead of a harder-to-debug native Java or Objective-C stacktrace.
|
|
187
|
+
if (typeof reactTag !== 'number') {
|
|
188
|
+
throw new Error('dispatchViewManagerCommand: found null reactTag');
|
|
189
|
+
}
|
|
190
|
+
|
|
183
191
|
if (isFabricReactTag(reactTag)) {
|
|
184
192
|
const FabricUIManager = nullthrows(getFabricUIManager());
|
|
185
193
|
const shadowNode =
|