@office-iss/react-native-win32 0.74.4 → 0.75.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 +9 -4
- package/CHANGELOG.json +554 -51
- package/CHANGELOG.md +165 -30
- package/Libraries/Animated/AnimatedImplementation.js +2 -0
- package/Libraries/Animated/NativeAnimatedHelper.js +4 -0
- package/Libraries/Animated/NativeAnimatedHelper.win32.js +4 -0
- package/Libraries/Animated/createAnimatedComponent.js +10 -4
- package/Libraries/Animated/useAnimatedProps.js +56 -28
- package/Libraries/BatchedBridge/MessageQueue.js +1 -0
- package/Libraries/Components/Button.js +10 -5
- package/Libraries/Components/Button.win32.js +1 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +11 -2
- package/Libraries/Components/Pressable/Pressable.js +13 -6
- package/Libraries/Components/Pressable/Pressable.win32.js +13 -6
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +4 -0
- package/Libraries/Components/ScrollView/ScrollView.js +109 -29
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +6 -0
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +13 -1
- package/Libraries/Components/StatusBar/StatusBar.js +1 -21
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -15
- package/Libraries/Components/TextInput/InputAccessoryView.js +10 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +0 -12
- package/Libraries/Components/TextInput/TextInput.d.ts +0 -19
- package/Libraries/Components/TextInput/TextInput.js +14 -70
- package/Libraries/Components/TextInput/TextInput.win32.js +15 -72
- package/Libraries/Components/Touchable/Touchable.js +2 -2
- package/Libraries/Components/Touchable/TouchableHighlight.d.ts +4 -10
- package/Libraries/Components/Touchable/TouchableHighlight.js +3 -1
- package/Libraries/Components/Touchable/TouchableOpacity.d.ts +4 -32
- package/Libraries/Components/Touchable/TouchableOpacity.js +3 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +8 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +117 -111
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
- package/Libraries/Components/View/View.js +0 -11
- package/Libraries/Components/View/View.win32.js +0 -11
- package/Libraries/Components/View/ViewAccessibility.js +4 -4
- package/Libraries/Components/View/ViewAccessibility.win32.js +6 -6
- package/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
- package/Libraries/Components/View/ViewPropTypes.js +7 -0
- package/Libraries/Components/View/ViewPropTypes.win32.js +7 -0
- package/Libraries/Core/Devtools/loadBundleFromServer.js +3 -3
- package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +153 -0
- package/Libraries/Core/Devtools/parseErrorStack.js +5 -5
- package/Libraries/Core/Devtools/parseHermesStack.js +22 -16
- package/Libraries/Core/ErrorHandlers.js +116 -0
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/setUpDeveloperTools.js +3 -1
- package/Libraries/Core/setUpPerformance.js +6 -4
- package/Libraries/Core/setUpReactDevTools.js +70 -10
- package/Libraries/Core/setUpTimers.js +50 -31
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +1 -1
- package/Libraries/Image/Image.android.js +23 -13
- package/Libraries/Image/Image.d.ts +14 -15
- package/Libraries/Image/Image.ios.js +21 -11
- package/Libraries/Image/Image.win32.js +5 -3
- package/Libraries/Image/ImageProps.js +16 -5
- package/Libraries/Image/ImageTypes.flow.js +7 -2
- package/Libraries/Image/ImageUtils.js +1 -0
- package/Libraries/Image/ImageViewNativeComponent.js +2 -1
- package/Libraries/Inspector/ElementBox.js +6 -3
- package/Libraries/Inspector/ElementProperties.js +1 -1
- package/Libraries/Interaction/TouchHistoryMath.js +4 -4
- package/Libraries/IntersectionObserver/IntersectionObserverManager.js +6 -26
- package/Libraries/JSInspector/NetworkAgent.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +39 -29
- package/Libraries/LogBox/Data/LogBoxLog.js +114 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +168 -53
- package/Libraries/LogBox/LogBox.js +29 -12
- package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
- package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
- package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
- package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +5 -66
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -52
- package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +8 -5
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +8 -5
- package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
- package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
- package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
- package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +5 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +5 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +5 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +12 -5
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +3 -0
- package/Libraries/Network/XMLHttpRequest.js +5 -1
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
- package/Libraries/Pressability/Pressability.js +3 -51
- package/Libraries/Pressability/Pressability.win32.js +3 -51
- package/Libraries/ReactNative/AppContainer-dev.js +3 -2
- package/Libraries/ReactNative/AppContainer-prod.js +2 -1
- package/Libraries/ReactNative/AppContainer.js +2 -0
- package/Libraries/ReactNative/AppRegistry.d.ts +7 -0
- package/Libraries/ReactNative/AppRegistry.js +10 -4
- package/Libraries/ReactNative/BridgelessUIManager.js +1 -21
- package/Libraries/ReactNative/FabricUIManager.js +0 -51
- package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +1 -0
- package/Libraries/ReactNative/RendererImplementation.js +20 -2
- package/Libraries/ReactNative/UIManager.d.ts +0 -21
- package/Libraries/ReactNative/UIManagerProperties.js +0 -3
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +5 -341
- package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -8
- package/Libraries/ReactNative/renderApplication.js +3 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +15682 -27088
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +5082 -4381
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3480 -2571
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +15943 -27543
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5303 -4606
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3450 -2572
- package/Libraries/Renderer/shims/ReactFabric.js +2 -2
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
- package/Libraries/Renderer/shims/ReactNative.js +2 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +24 -3
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -2
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/Share/Share.d.ts +16 -10
- package/Libraries/Share/Share.js +14 -15
- package/Libraries/StyleSheet/StyleSheet.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheet.js +3 -10
- package/Libraries/StyleSheet/StyleSheet.win32.js +3 -10
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +21 -21
- package/Libraries/StyleSheet/StyleSheetTypes.js +24 -18
- package/Libraries/StyleSheet/flattenStyle.js +1 -0
- package/Libraries/StyleSheet/processFilter.js +132 -0
- package/Libraries/StyleSheet/processTransform.js +18 -3
- package/Libraries/Text/Text.js +151 -128
- package/Libraries/Text/Text.win32.js +163 -138
- package/Libraries/Text/TextNativeComponent.js +5 -4
- package/Libraries/Text/TextNativeComponent.win32.js +5 -4
- package/Libraries/Text/TextProps.js +6 -6
- package/Libraries/Text/TextProps.win32.js +6 -6
- package/Libraries/TurboModule/TurboModuleRegistry.js +2 -1
- package/Libraries/Types/CodegenTypes.js +3 -0
- package/Libraries/Utilities/{LoadingView.android.js → DevLoadingView.js} +33 -11
- package/Libraries/Utilities/Dimensions.js +1 -0
- package/Libraries/Utilities/Dimensions.win32.js +1 -0
- package/Libraries/Utilities/HMRClient.js +36 -8
- package/Libraries/Utilities/HMRClientProdShim.js +1 -0
- package/Libraries/Utilities/Platform.android.js +4 -4
- package/Libraries/Utilities/RCTLog.js +1 -0
- package/Libraries/Utilities/ReactNativeTestTools.js +12 -24
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +11 -6
- package/Libraries/__tests__/ButtonWin32-test.js +7 -6
- package/Libraries/promiseRejectionTrackingOptions.js +1 -0
- package/jest/mockComponent.js +7 -0
- package/jest/renderer.js +25 -14
- package/jest/setup.js +19 -13
- package/jest.config.js +2 -1
- package/overrides.json +30 -29
- package/package.json +27 -25
- package/rn-get-polyfills.js +1 -0
- package/src/private/core/composeStyles.js +27 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -33
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +56 -0
- package/src/private/fusebox/setUpFuseboxReactDevToolsDispatcher.js +108 -0
- package/src/private/specs/modules/NativeBlobModule.js +4 -2
- package/src/private/specs/modules/NativeDevSettings.js +1 -0
- package/src/private/specs/modules/NativePushNotificationManagerIOS.js +0 -4
- package/src/private/specs/modules/NativeUIManager.js +0 -7
- package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +24 -24
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +11 -14
- package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +2 -3
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +24 -54
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -13
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +468 -0
- package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +413 -0
- package/src/private/webapis/dom/oldstylecollections/DOMRectList.js +4 -4
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +4 -4
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +5 -5
- package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
- package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +21 -0
- package/src/private/webapis/performance/EventCounts.js +1 -1
- package/src/private/webapis/performance/MemoryInfo.js +9 -9
- package/src/private/webapis/performance/Performance.js +10 -56
- package/src/private/webapis/performance/PerformanceObserver.js +30 -22
- package/src/private/webapis/performance/RawPerformanceEntry.js +2 -7
- package/src/private/webapis/performance/ReactNativeStartupTiming.js +18 -18
- package/src/private/webapis/performance/UserTiming.js +63 -0
- package/src/private/webapis/performance/{NativePerformance.js → specs/NativePerformance.js} +3 -2
- package/src/private/webapis/performance/{NativePerformanceObserver.js → specs/NativePerformanceObserver.js} +2 -2
- package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformance.js +1 -1
- package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformanceObserver.js +3 -4
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
- package/types/modules/globals.d.ts +4 -0
- package/Libraries/Components/ScrollView/ScrollView.win32.js +0 -1915
- package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +0 -13
- package/Libraries/Utilities/LoadingView.ios.js +0 -50
- package/Libraries/Utilities/LoadingView.js +0 -16
- package/jest/ReactNativeInternalFeatureFlagsMock.js +0 -13
- package/src/private/featureflags/NativeReactNativeFeatureFlags.js +0 -44
- package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +0 -92
- package/src/private/specs/modules/NativeAnimationsDebugModule.js +0 -20
- package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +0 -85
- package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +0 -80
- package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +0 -161
- package/src/private/webapis/performance/__tests__/EventCounts-test.js +0 -116
- package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +0 -82
- package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +0 -108
- package/src/private/webapis/performance/__tests__/Performance-test.js +0 -117
- package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +0 -208
|
@@ -56,8 +56,10 @@ const Text: React.AbstractComponent<
|
|
|
56
56
|
'aria-selected': ariaSelected,
|
|
57
57
|
'aria-setsize': ariaSetsize, // Win32
|
|
58
58
|
ellipsizeMode,
|
|
59
|
+
disabled,
|
|
59
60
|
id,
|
|
60
61
|
nativeID,
|
|
62
|
+
numberOfLines,
|
|
61
63
|
onLongPress,
|
|
62
64
|
onPress,
|
|
63
65
|
onPressIn,
|
|
@@ -69,15 +71,20 @@ const Text: React.AbstractComponent<
|
|
|
69
71
|
onResponderTerminationRequest,
|
|
70
72
|
onStartShouldSetResponder,
|
|
71
73
|
pressRetentionOffset,
|
|
74
|
+
selectable,
|
|
75
|
+
selectionColor,
|
|
72
76
|
suppressHighlighting,
|
|
77
|
+
style,
|
|
73
78
|
...restProps
|
|
74
79
|
} = props;
|
|
75
80
|
|
|
76
81
|
const [isHighlighted, setHighlighted] = useState(false);
|
|
77
82
|
|
|
78
|
-
|
|
83
|
+
const _accessibilityLabel = ariaLabel ?? accessibilityLabel;
|
|
84
|
+
|
|
85
|
+
let _accessibilityState: ?TextProps['accessibilityState'] =
|
|
86
|
+
accessibilityState;
|
|
79
87
|
if (
|
|
80
|
-
accessibilityState != null ||
|
|
81
88
|
ariaBusy != null ||
|
|
82
89
|
ariaChecked != null ||
|
|
83
90
|
ariaDisabled != null ||
|
|
@@ -86,27 +93,32 @@ const Text: React.AbstractComponent<
|
|
|
86
93
|
ariaRequired != null ||
|
|
87
94
|
ariaSelected != null
|
|
88
95
|
) {
|
|
89
|
-
_accessibilityState
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
if (_accessibilityState != null) {
|
|
97
|
+
_accessibilityState = {
|
|
98
|
+
busy: ariaBusy ?? _accessibilityState.busy,
|
|
99
|
+
checked: ariaChecked ?? _accessibilityState.checked,
|
|
100
|
+
disabled: ariaDisabled ?? _accessibilityState.disabled,
|
|
101
|
+
expanded: ariaExpanded ?? _accessibilityState.expanded,
|
|
102
|
+
multiselectable:
|
|
103
|
+
ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
|
|
104
|
+
required: ariaRequired ?? accessibilityState?.required, // Win32
|
|
105
|
+
selected: ariaSelected ?? _accessibilityState.selected,
|
|
106
|
+
};
|
|
107
|
+
} else {
|
|
108
|
+
_accessibilityState = {
|
|
109
|
+
busy: ariaBusy,
|
|
110
|
+
checked: ariaChecked,
|
|
111
|
+
disabled: ariaDisabled,
|
|
112
|
+
expanded: ariaExpanded,
|
|
113
|
+
multiselectable: ariaMultiselectable, // Win32,
|
|
114
|
+
required: ariaRequired, // Win32
|
|
115
|
+
selected: ariaSelected,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
99
118
|
}
|
|
100
119
|
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
? restProps.disabled
|
|
104
|
-
: _accessibilityState?.disabled;
|
|
105
|
-
|
|
106
|
-
const nativeTextAccessibilityState =
|
|
107
|
-
_disabled !== _accessibilityState?.disabled
|
|
108
|
-
? {..._accessibilityState, disabled: _disabled}
|
|
109
|
-
: _accessibilityState;
|
|
120
|
+
const _accessibilityStateDisabled = _accessibilityState?.disabled;
|
|
121
|
+
const _disabled = disabled ?? _accessibilityStateDisabled;
|
|
110
122
|
|
|
111
123
|
const isPressable =
|
|
112
124
|
(onPress != null ||
|
|
@@ -115,46 +127,47 @@ const Text: React.AbstractComponent<
|
|
|
115
127
|
_disabled !== true;
|
|
116
128
|
|
|
117
129
|
const initialized = useLazyInitialization(isPressable);
|
|
118
|
-
const config = useMemo(
|
|
119
|
-
()
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
: null,
|
|
145
|
-
[
|
|
146
|
-
initialized,
|
|
147
|
-
isPressable,
|
|
148
|
-
pressRetentionOffset,
|
|
130
|
+
const config = useMemo(() => {
|
|
131
|
+
if (!initialized) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let _onPressIn = onPressIn;
|
|
136
|
+
let _onPressOut = onPressOut;
|
|
137
|
+
|
|
138
|
+
// Updating isHighlighted causes unnecessary re-renders for platforms that don't use it
|
|
139
|
+
// in the best case, and cause issues with text selection in the worst case. Forcing
|
|
140
|
+
// the isHighlighted prop to false on all platforms except iOS.
|
|
141
|
+
if (Platform.OS === 'ios') {
|
|
142
|
+
_onPressIn = (event: PressEvent) => {
|
|
143
|
+
setHighlighted(suppressHighlighting == null || !suppressHighlighting);
|
|
144
|
+
onPressIn?.(event);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
_onPressOut = (event: PressEvent) => {
|
|
148
|
+
setHighlighted(false);
|
|
149
|
+
onPressOut?.(event);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
disabled: !isPressable,
|
|
155
|
+
pressRectOffset: pressRetentionOffset,
|
|
149
156
|
onLongPress,
|
|
150
157
|
onPress,
|
|
151
|
-
onPressIn,
|
|
152
|
-
onPressOut,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
onPressIn: _onPressIn,
|
|
159
|
+
onPressOut: _onPressOut,
|
|
160
|
+
};
|
|
161
|
+
}, [
|
|
162
|
+
initialized,
|
|
163
|
+
isPressable,
|
|
164
|
+
pressRetentionOffset,
|
|
165
|
+
onLongPress,
|
|
166
|
+
onPress,
|
|
167
|
+
onPressIn,
|
|
168
|
+
onPressOut,
|
|
169
|
+
suppressHighlighting,
|
|
170
|
+
]);
|
|
158
171
|
|
|
159
172
|
const eventHandlers = usePressability(config);
|
|
160
173
|
const eventHandlersForText = useMemo(
|
|
@@ -188,8 +201,13 @@ const Text: React.AbstractComponent<
|
|
|
188
201
|
},
|
|
189
202
|
onClick: eventHandlers.onClick,
|
|
190
203
|
onResponderTerminationRequest:
|
|
191
|
-
|
|
192
|
-
|
|
204
|
+
onResponderTerminationRequest != null
|
|
205
|
+
? onResponderTerminationRequest
|
|
206
|
+
: eventHandlers.onResponderTerminationRequest,
|
|
207
|
+
onStartShouldSetResponder:
|
|
208
|
+
onStartShouldSetResponder != null
|
|
209
|
+
? onStartShouldSetResponder
|
|
210
|
+
: eventHandlers.onStartShouldSetResponder,
|
|
193
211
|
},
|
|
194
212
|
[
|
|
195
213
|
eventHandlers,
|
|
@@ -197,119 +215,126 @@ const Text: React.AbstractComponent<
|
|
|
197
215
|
onResponderMove,
|
|
198
216
|
onResponderRelease,
|
|
199
217
|
onResponderTerminate,
|
|
218
|
+
onResponderTerminationRequest,
|
|
219
|
+
onStartShouldSetResponder,
|
|
200
220
|
],
|
|
201
221
|
);
|
|
202
222
|
|
|
203
223
|
// TODO: Move this processing to the view configuration.
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
? null
|
|
207
|
-
: processColor(restProps.selectionColor);
|
|
208
|
-
|
|
209
|
-
let style = restProps.style;
|
|
224
|
+
const _selectionColor =
|
|
225
|
+
selectionColor == null ? null : processColor(selectionColor);
|
|
210
226
|
|
|
227
|
+
let _style = style;
|
|
211
228
|
if (__DEV__) {
|
|
212
229
|
if (PressabilityDebug.isEnabled() && onPress != null) {
|
|
213
|
-
|
|
230
|
+
_style = [style, {color: 'magenta'}];
|
|
214
231
|
}
|
|
215
232
|
}
|
|
216
233
|
|
|
217
|
-
let
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
234
|
+
let _numberOfLines = numberOfLines;
|
|
235
|
+
if (_numberOfLines != null && !(_numberOfLines >= 0)) {
|
|
236
|
+
if (__DEV__) {
|
|
237
|
+
console.error(
|
|
238
|
+
`'numberOfLines' in <Text> must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`,
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
_numberOfLines = 0;
|
|
223
242
|
}
|
|
224
243
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
244
|
+
let _selectable = selectable;
|
|
245
|
+
const processedStyle = flattenStyle(_style);
|
|
246
|
+
if (processedStyle != null) {
|
|
247
|
+
if (typeof processedStyle.fontWeight === 'number') {
|
|
248
|
+
// $FlowFixMe[cannot-write]
|
|
249
|
+
processedStyle.fontWeight = processedStyle.fontWeight.toString();
|
|
250
|
+
}
|
|
231
251
|
|
|
232
|
-
|
|
233
|
-
|
|
252
|
+
if (processedStyle.userSelect != null) {
|
|
253
|
+
_selectable = userSelectToSelectableMap[processedStyle.userSelect];
|
|
254
|
+
// $FlowFixMe[cannot-write]
|
|
255
|
+
delete processedStyle.userSelect;
|
|
256
|
+
}
|
|
234
257
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
258
|
+
if (processedStyle.verticalAlign != null) {
|
|
259
|
+
// $FlowFixMe[cannot-write]
|
|
260
|
+
processedStyle.textAlignVertical =
|
|
261
|
+
verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign];
|
|
262
|
+
// $FlowFixMe[cannot-write]
|
|
263
|
+
delete processedStyle.verticalAlign;
|
|
264
|
+
}
|
|
239
265
|
}
|
|
240
266
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
267
|
+
const _nativeID = id ?? nativeID;
|
|
268
|
+
|
|
269
|
+
const hasTextAncestor = useContext(TextAncestor);
|
|
270
|
+
if (hasTextAncestor) {
|
|
271
|
+
return (
|
|
272
|
+
<NativeVirtualText
|
|
273
|
+
{...restProps}
|
|
274
|
+
{...eventHandlersForText}
|
|
275
|
+
accessibilityLabel={_accessibilityLabel}
|
|
276
|
+
accessibilityState={_accessibilityState}
|
|
277
|
+
accessibilityControls={ariaControls ?? accessibilityControls} // Win32
|
|
278
|
+
accessibilityDescribedBy={ariaDescribedBy ?? accessibilityDescribedBy} // Win32
|
|
279
|
+
accessibilityDescription={ariaDescription ?? accessibilityDescription} // Win32
|
|
280
|
+
accessibilityLevel={ariaLevel ?? accessibilityLevel} // Win32
|
|
281
|
+
accessibilityPositionInSet={ariaPosinset ?? accessibilityPositionInSet} // Win32
|
|
282
|
+
accessibilitySetSize={ariaSetsize ?? accessibilitySetSize} // Win32
|
|
283
|
+
isHighlighted={isHighlighted}
|
|
284
|
+
isPressable={isPressable}
|
|
285
|
+
nativeID={_nativeID}
|
|
286
|
+
numberOfLines={_numberOfLines}
|
|
287
|
+
ref={forwardedRef}
|
|
288
|
+
selectable={_selectable}
|
|
289
|
+
selectionColor={_selectionColor}
|
|
290
|
+
style={processedStyle}
|
|
291
|
+
disabled={disabled}
|
|
292
|
+
/>
|
|
293
|
+
);
|
|
248
294
|
}
|
|
249
295
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
296
|
+
// If the disabled prop and accessibilityState.disabled are out of sync but not both in
|
|
297
|
+
// falsy states we need to update the accessibilityState object to use the disabled prop.
|
|
298
|
+
if (
|
|
299
|
+
_disabled !== _accessibilityStateDisabled &&
|
|
300
|
+
((_disabled != null && _disabled !== false) ||
|
|
301
|
+
(_accessibilityStateDisabled != null &&
|
|
302
|
+
_accessibilityStateDisabled !== false))
|
|
303
|
+
) {
|
|
304
|
+
_accessibilityState = {..._accessibilityState, disabled: _disabled};
|
|
259
305
|
}
|
|
260
306
|
|
|
261
|
-
const
|
|
262
|
-
|
|
307
|
+
const _accessible = Platform.select({
|
|
308
|
+
ios: accessible !== false,
|
|
309
|
+
android:
|
|
310
|
+
accessible == null ? onPress != null || onLongPress != null : accessible,
|
|
311
|
+
default: accessible !== false,
|
|
312
|
+
});
|
|
263
313
|
|
|
264
|
-
return
|
|
265
|
-
<NativeVirtualText
|
|
266
|
-
{...restProps}
|
|
267
|
-
{...eventHandlersForText}
|
|
268
|
-
accessibilityControls={ariaControls ?? accessibilityControls} // Win32
|
|
269
|
-
accessibilityDescribedBy={ariaDescribedBy ?? accessibilityDescribedBy} // Win32
|
|
270
|
-
accessibilityDescription={ariaDescription ?? accessibilityDescription} // Win32
|
|
271
|
-
accessibilityLabel={ariaLabel ?? accessibilityLabel}
|
|
272
|
-
accessibilityLevel={ariaLevel ?? accessibilityLevel} // Win32
|
|
273
|
-
accessibilityPositionInSet={ariaPosinset ?? accessibilityPositionInSet} // Win32
|
|
274
|
-
accessibilitySetSize={ariaSetsize ?? accessibilitySetSize} // Win32
|
|
275
|
-
accessibilityState={_accessibilityState}
|
|
276
|
-
isHighlighted={isHighlighted}
|
|
277
|
-
isPressable={isPressable}
|
|
278
|
-
nativeID={id ?? nativeID}
|
|
279
|
-
numberOfLines={numberOfLines}
|
|
280
|
-
ref={forwardedRef}
|
|
281
|
-
selectable={_selectable}
|
|
282
|
-
selectionColor={selectionColor}
|
|
283
|
-
style={style}
|
|
284
|
-
/>
|
|
285
|
-
) : (
|
|
314
|
+
return (
|
|
286
315
|
<TextAncestor.Provider value={true}>
|
|
287
316
|
<NativeText
|
|
288
317
|
{...restProps}
|
|
289
318
|
{...eventHandlersForText}
|
|
319
|
+
accessibilityLabel={_accessibilityLabel}
|
|
320
|
+
accessibilityState={_accessibilityState}
|
|
321
|
+
accessible={_accessible}
|
|
290
322
|
accessibilityControls={ariaControls ?? accessibilityControls} // Win32
|
|
291
323
|
accessibilityDescribedBy={ariaDescribedBy ?? accessibilityDescribedBy} // Win32
|
|
292
324
|
accessibilityDescription={ariaDescription ?? accessibilityDescription} // Win32
|
|
293
|
-
accessibilityLabel={ariaLabel ?? accessibilityLabel}
|
|
294
325
|
accessibilityLevel={ariaLevel ?? accessibilityLevel} // Win32
|
|
295
326
|
accessibilityPositionInSet={ariaPosinset ?? accessibilityPositionInSet} // Win32
|
|
296
327
|
accessibilitySetSize={ariaSetsize ?? accessibilitySetSize} // Win32
|
|
297
|
-
accessibilityState={nativeTextAccessibilityState}
|
|
298
|
-
accessible={
|
|
299
|
-
accessible == null && Platform.OS === 'android'
|
|
300
|
-
? _hasOnPressOrOnLongPress
|
|
301
|
-
: _accessible
|
|
302
|
-
}
|
|
303
328
|
allowFontScaling={allowFontScaling !== false}
|
|
304
329
|
disabled={_disabled}
|
|
305
330
|
ellipsizeMode={ellipsizeMode ?? 'tail'}
|
|
306
331
|
isHighlighted={isHighlighted}
|
|
307
|
-
nativeID={
|
|
308
|
-
numberOfLines={
|
|
332
|
+
nativeID={_nativeID}
|
|
333
|
+
numberOfLines={_numberOfLines}
|
|
309
334
|
ref={forwardedRef}
|
|
310
335
|
selectable={_selectable}
|
|
311
|
-
selectionColor={
|
|
312
|
-
style={
|
|
336
|
+
selectionColor={_selectionColor}
|
|
337
|
+
style={processedStyle}
|
|
313
338
|
/>
|
|
314
339
|
</TextAncestor.Provider>
|
|
315
340
|
);
|
|
@@ -345,4 +370,4 @@ const verticalAlignToTextAlignVerticalMap = {
|
|
|
345
370
|
middle: 'center',
|
|
346
371
|
};
|
|
347
372
|
|
|
348
|
-
module.exports = Text;
|
|
373
|
+
module.exports = Text;
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
|
12
|
+
import type {ProcessedColorValue} from '../StyleSheet/processColor';
|
|
13
|
+
import type {PressEvent} from '../Types/CoreEventTypes';
|
|
14
|
+
import type {TextProps} from './TextProps';
|
|
15
|
+
|
|
11
16
|
import {createViewConfig} from '../NativeComponent/ViewConfig';
|
|
12
17
|
import UIManager from '../ReactNative/UIManager';
|
|
13
18
|
import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass';
|
|
14
|
-
import {type HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
|
15
|
-
import {type ProcessedColorValue} from '../StyleSheet/processColor';
|
|
16
|
-
import {type PressEvent} from '../Types/CoreEventTypes';
|
|
17
|
-
import {type TextProps} from './TextProps';
|
|
18
19
|
|
|
19
20
|
type NativeTextProps = $ReadOnly<{
|
|
20
21
|
...TextProps,
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
|
12
|
+
import type {ProcessedColorValue} from '../StyleSheet/processColor';
|
|
13
|
+
import type {PressEvent} from '../Types/CoreEventTypes';
|
|
14
|
+
import type {TextProps} from './TextProps';
|
|
15
|
+
|
|
11
16
|
import {createViewConfig} from '../NativeComponent/ViewConfig';
|
|
12
17
|
import UIManager from '../ReactNative/UIManager';
|
|
13
18
|
import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass';
|
|
14
|
-
import {type HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
|
15
|
-
import {type ProcessedColorValue} from '../StyleSheet/processColor';
|
|
16
|
-
import {type PressEvent} from '../Types/CoreEventTypes';
|
|
17
|
-
import {type TextProps} from './TextProps';
|
|
18
19
|
|
|
19
20
|
type NativeTextProps = $ReadOnly<{
|
|
20
21
|
...TextProps,
|
|
@@ -26,23 +26,23 @@ import type {
|
|
|
26
26
|
} from '../Types/CoreEventTypes';
|
|
27
27
|
import type {Node} from 'react';
|
|
28
28
|
|
|
29
|
-
export type PressRetentionOffset = $ReadOnly<{
|
|
29
|
+
export type PressRetentionOffset = $ReadOnly<{
|
|
30
30
|
top: number,
|
|
31
31
|
left: number,
|
|
32
32
|
bottom: number,
|
|
33
33
|
right: number,
|
|
34
|
-
|
|
34
|
+
}>;
|
|
35
35
|
|
|
36
|
-
type PointerEventProps = $ReadOnly<{
|
|
36
|
+
type PointerEventProps = $ReadOnly<{
|
|
37
37
|
onPointerEnter?: (event: PointerEvent) => void,
|
|
38
38
|
onPointerLeave?: (event: PointerEvent) => void,
|
|
39
39
|
onPointerMove?: (event: PointerEvent) => void,
|
|
40
|
-
|
|
40
|
+
}>;
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @see https://reactnative.dev/docs/text#reference
|
|
44
44
|
*/
|
|
45
|
-
export type TextProps = $ReadOnly<{
|
|
45
|
+
export type TextProps = $ReadOnly<{
|
|
46
46
|
...PointerEventProps,
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -265,4 +265,4 @@ export type TextProps = $ReadOnly<{|
|
|
|
265
265
|
* See https://reactnative.dev/docs/text.html#linebreakstrategyios
|
|
266
266
|
*/
|
|
267
267
|
lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
|
|
268
|
-
|
|
268
|
+
}>;
|
|
@@ -26,23 +26,23 @@ import type {
|
|
|
26
26
|
} from '../Types/CoreEventTypes';
|
|
27
27
|
import type {Node} from 'react';
|
|
28
28
|
|
|
29
|
-
export type PressRetentionOffset = $ReadOnly<{
|
|
29
|
+
export type PressRetentionOffset = $ReadOnly<{
|
|
30
30
|
top: number,
|
|
31
31
|
left: number,
|
|
32
32
|
bottom: number,
|
|
33
33
|
right: number,
|
|
34
|
-
|
|
34
|
+
}>;
|
|
35
35
|
|
|
36
|
-
type PointerEventProps = $ReadOnly<{
|
|
36
|
+
type PointerEventProps = $ReadOnly<{
|
|
37
37
|
onPointerEnter?: (event: PointerEvent) => void,
|
|
38
38
|
onPointerLeave?: (event: PointerEvent) => void,
|
|
39
39
|
onPointerMove?: (event: PointerEvent) => void,
|
|
40
|
-
|
|
40
|
+
}>;
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @see https://reactnative.dev/docs/text#reference
|
|
44
44
|
*/
|
|
45
|
-
export type TextProps = $ReadOnly<{
|
|
45
|
+
export type TextProps = $ReadOnly<{
|
|
46
46
|
...PointerEventProps,
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -278,4 +278,4 @@ export type TextProps = $ReadOnly<{|
|
|
|
278
278
|
* See https://reactnative.dev/docs/text.html#linebreakstrategyios
|
|
279
279
|
*/
|
|
280
280
|
lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
|
|
281
|
-
|
|
281
|
+
}>;
|
|
@@ -76,7 +76,8 @@ export function getEnforcing<T: TurboModule>(name: string): T {
|
|
|
76
76
|
'Verify that a module by this name is registered in the native binary.';
|
|
77
77
|
|
|
78
78
|
if (shouldReportDebugInfo()) {
|
|
79
|
-
message +=
|
|
79
|
+
message +=
|
|
80
|
+
' Bridgeless mode: ' + (isBridgeless() ? 'true' : 'false') + '. ';
|
|
80
81
|
message +=
|
|
81
82
|
'TurboModule interop: ' +
|
|
82
83
|
(isTurboModuleInteropEnabled() ? 'true' : 'false') +
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
+
import type {EventSubscription} from '../vendor/emitter/EventEmitter';
|
|
13
14
|
import type {SyntheticEvent} from './CoreEventTypes';
|
|
14
15
|
|
|
15
16
|
// Event types
|
|
@@ -40,3 +41,5 @@ type DefaultTypes = number | boolean | string | $ReadOnlyArray<string>;
|
|
|
40
41
|
//
|
|
41
42
|
// eslint-disable-next-line no-unused-vars
|
|
42
43
|
export type WithDefault<Type: DefaultTypes, Value: ?Type | string> = ?Type;
|
|
44
|
+
|
|
45
|
+
export type EventEmitter<T> = (handler: (T) => mixed) => EventSubscription;
|
|
@@ -12,23 +12,45 @@ import processColor from '../StyleSheet/processColor';
|
|
|
12
12
|
import Appearance from './Appearance';
|
|
13
13
|
import NativeDevLoadingView from './NativeDevLoadingView';
|
|
14
14
|
|
|
15
|
+
const COLOR_SCHEME = {
|
|
16
|
+
dark: {
|
|
17
|
+
refresh: {
|
|
18
|
+
backgroundColor: '#2584e8',
|
|
19
|
+
textColor: '#ffffff',
|
|
20
|
+
},
|
|
21
|
+
load: {
|
|
22
|
+
backgroundColor: '#fafafa',
|
|
23
|
+
textColor: '#242526',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
default: {
|
|
27
|
+
refresh: {
|
|
28
|
+
backgroundColor: '#2584e8',
|
|
29
|
+
textColor: '#ffffff',
|
|
30
|
+
},
|
|
31
|
+
load: {
|
|
32
|
+
backgroundColor: '#404040',
|
|
33
|
+
textColor: '#ffffff',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
15
38
|
module.exports = {
|
|
16
39
|
showMessage(message: string, type: 'load' | 'refresh') {
|
|
17
40
|
if (NativeDevLoadingView) {
|
|
41
|
+
const colorScheme =
|
|
42
|
+
Appearance.getColorScheme() === 'dark'
|
|
43
|
+
? COLOR_SCHEME.dark
|
|
44
|
+
: COLOR_SCHEME.default;
|
|
45
|
+
|
|
46
|
+
const colorSet = colorScheme[type];
|
|
47
|
+
|
|
18
48
|
let backgroundColor;
|
|
19
49
|
let textColor;
|
|
20
50
|
|
|
21
|
-
if (
|
|
22
|
-
backgroundColor = processColor(
|
|
23
|
-
textColor = processColor(
|
|
24
|
-
} else if (type === 'load') {
|
|
25
|
-
if (Appearance.getColorScheme() === 'dark') {
|
|
26
|
-
backgroundColor = processColor('#fafafa');
|
|
27
|
-
textColor = processColor('#242526');
|
|
28
|
-
} else {
|
|
29
|
-
backgroundColor = processColor('#404040');
|
|
30
|
-
textColor = processColor('#ffffff');
|
|
31
|
-
}
|
|
51
|
+
if (colorSet) {
|
|
52
|
+
backgroundColor = processColor(colorSet.backgroundColor);
|
|
53
|
+
textColor = processColor(colorSet.textColor);
|
|
32
54
|
}
|
|
33
55
|
|
|
34
56
|
NativeDevLoadingView.showMessage(
|
|
@@ -44,6 +44,7 @@ class Dimensions {
|
|
|
44
44
|
* @returns {DisplayMetrics? | DisplayMetricsAndroid?} Value for the dimension.
|
|
45
45
|
*/
|
|
46
46
|
static get(dim: string): DisplayMetrics | DisplayMetricsAndroid {
|
|
47
|
+
// $FlowFixMe[invalid-computed-prop]
|
|
47
48
|
invariant(dimensions[dim], 'No dimension set for key ' + dim);
|
|
48
49
|
return dimensions[dim];
|
|
49
50
|
}
|
|
@@ -48,6 +48,7 @@ class Dimensions {
|
|
|
48
48
|
* @returns {DisplayMetrics? | DisplayMetricsAndroid?} Value for the dimension.
|
|
49
49
|
*/
|
|
50
50
|
static get(dim: string): DisplayMetrics | DisplayMetricsAndroid {
|
|
51
|
+
// $FlowFixMe[invalid-computed-prop]
|
|
51
52
|
invariant(dimensions[dim], 'No dimension set for key ' + dim);
|
|
52
53
|
return dimensions[dim];
|
|
53
54
|
}
|