@office-iss/react-native-win32 0.76.2 → 0.77.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/.eslintignore +1 -1
- package/.flowconfig +5 -1
- package/CHANGELOG.json +164 -53
- package/CHANGELOG.md +74 -28
- package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +1 -0
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +13 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +2 -2
- package/Libraries/Animated/NativeAnimatedAllowlist.js +20 -9
- package/Libraries/Animated/animations/Animation.js +60 -25
- package/Libraries/Animated/animations/DecayAnimation.js +26 -38
- package/Libraries/Animated/animations/SpringAnimation.js +33 -39
- package/Libraries/Animated/animations/TimingAnimation.js +34 -42
- package/Libraries/Animated/components/AnimatedFlatList.js +1 -1
- package/Libraries/Animated/components/AnimatedSectionList.js +3 -1
- package/Libraries/Animated/createAnimatedComponent.js +60 -33
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +1 -1
- package/Libraries/Animated/nodes/AnimatedNode.js +39 -45
- package/Libraries/Animated/nodes/AnimatedObject.js +13 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +96 -46
- package/Libraries/Animated/nodes/AnimatedStyle.js +108 -39
- package/Libraries/Animated/nodes/AnimatedTransform.js +56 -23
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -3
- package/Libraries/Animated/useAnimatedProps.js +41 -35
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +77 -5
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +82 -5
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +4 -4
- package/Libraries/Components/Button.js +9 -4
- package/Libraries/Components/Button.win32.js +12 -4
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -0
- package/Libraries/Components/Pressable/Pressable.js +4 -4
- package/Libraries/Components/Pressable/Pressable.win32.js +4 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +13 -7
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +3 -2
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +4 -4
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +4 -4
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +0 -1
- package/Libraries/Components/ScrollView/ScrollView.js +49 -88
- package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
- package/Libraries/Components/ScrollView/ScrollViewContext.js +2 -0
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +0 -2
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +8 -9
- package/Libraries/Components/Switch/Switch.js +8 -6
- package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +4 -4
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +6 -4
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +27 -4
- package/Libraries/Components/TextInput/TextInput.flow.js +36 -19
- package/Libraries/Components/TextInput/TextInput.js +37 -13
- package/Libraries/Components/TextInput/TextInput.win32.js +40 -15
- package/Libraries/Components/TextInput/TextInputState.js +11 -13
- package/Libraries/Components/TextInput/TextInputState.win32.js +13 -16
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +3 -0
- package/Libraries/Components/Touchable/BoundingDimensions.js +11 -3
- package/Libraries/Components/Touchable/Position.js +7 -2
- package/Libraries/Components/Touchable/Touchable.js +4 -0
- package/Libraries/Components/Touchable/Touchable.win32.js +4 -0
- package/Libraries/Components/Touchable/TouchableBounce.js +6 -2
- package/Libraries/Components/Touchable/TouchableHighlight.js +5 -5
- package/Libraries/Components/Touchable/TouchableOpacity.js +6 -5
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -1
- package/Libraries/Components/View/View.js +4 -4
- package/Libraries/Components/View/View.win32.js +4 -4
- package/Libraries/Components/View/ViewNativeComponent.js +6 -98
- package/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
- package/Libraries/Components/View/ViewPropTypes.js +0 -3
- package/Libraries/Components/View/ViewPropTypes.win32.js +0 -3
- package/Libraries/Components/View/ViewWin32.js +1 -0
- package/Libraries/Core/ExceptionsManager.js +50 -29
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -1
- package/Libraries/Core/setUpBatchedBridge.js +1 -10
- package/Libraries/Core/setUpDeveloperTools.js +1 -5
- package/Libraries/Core/setUpErrorHandling.js +20 -18
- package/Libraries/Core/setUpReactDevTools.js +107 -8
- package/Libraries/Core/setUpSegmentFetcher.js +1 -0
- package/Libraries/Core/setUpTimers.js +21 -18
- package/Libraries/Debugging/DebuggingOverlay.js +4 -5
- package/Libraries/Image/AssetSourceResolver.js +12 -1
- package/Libraries/Image/Image.android.js +1 -5
- package/Libraries/Image/Image.d.ts +20 -29
- package/Libraries/Image/Image.ios.js +0 -2
- package/Libraries/Image/Image.win32.js +0 -2
- package/Libraries/Image/ImageBackground.js +2 -5
- package/Libraries/Image/ImageProps.js +7 -6
- package/Libraries/Image/ImageResizeMode.d.ts +8 -1
- package/Libraries/Image/ImageResizeMode.js +4 -1
- package/Libraries/Image/ImageSource.d.ts +0 -2
- package/Libraries/Image/ImageSource.js +0 -2
- package/Libraries/Image/ImageTypes.flow.js +11 -9
- package/Libraries/Image/ImageUtils.js +6 -3
- package/Libraries/Image/ImageViewNativeComponent.js +5 -3
- package/Libraries/Inspector/Inspector.js +1 -0
- package/Libraries/Inspector/Inspector.win32.js +2 -1
- package/Libraries/Inspector/NetworkOverlay.js +4 -0
- package/Libraries/Inspector/ReactDevToolsOverlay.js +8 -14
- package/Libraries/Inspector/getInspectorDataForViewAtPoint.js +3 -5
- package/Libraries/Interaction/InteractionManager.js +6 -1
- package/Libraries/Interaction/InteractionManagerStub.js +176 -0
- package/Libraries/Interaction/TouchHistoryMath.js +22 -19
- package/Libraries/JSInspector/NetworkAgent.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +1 -2
- package/Libraries/Lists/FlatList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +7 -7
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +2 -2
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +3 -3
- package/Libraries/LogBox/LogBox.js +18 -5
- package/Libraries/LogBox/LogBoxInspectorContainer.js +1 -1
- package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
- package/Libraries/LogBox/UI/AnsiHighlight.js +26 -17
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -1
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +6 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +1 -1
- package/Libraries/LogBox/UI/LogBoxMessage.js +2 -2
- package/Libraries/Modal/Modal.d.ts +12 -0
- package/Libraries/Modal/Modal.js +31 -4
- package/Libraries/NativeComponent/BaseViewConfig.android.js +72 -1
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -1
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +3 -11
- package/Libraries/NativeComponent/NativeComponentRegistry.js +3 -3
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -1
- package/Libraries/Network/XHRInterceptor.js +63 -14
- package/Libraries/Network/XMLHttpRequest.js +26 -1
- package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +49 -2
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -4
- package/Libraries/Pressability/HoverState.js +2 -0
- package/Libraries/Pressability/HoverState.win32.js +2 -0
- package/Libraries/Pressability/Pressability.js +2 -3
- package/Libraries/Pressability/Pressability.win32.js +2 -3
- package/Libraries/Pressability/usePressability.js +4 -1
- package/Libraries/ReactNative/AppContainer.js +1 -1
- package/Libraries/ReactNative/AppRegistry.js +1 -11
- package/Libraries/ReactNative/DisplayMode.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -3
- package/Libraries/ReactNative/RendererImplementation.js +18 -17
- package/Libraries/ReactNative/getCachedComponentWithDebugName.js +1 -3
- package/Libraries/ReactNative/renderApplication.js +9 -8
- package/Libraries/ReactNative/requireNativeComponent.js +5 -2
- package/Libraries/Renderer/shims/ReactFabric.js +3 -3
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
- package/Libraries/Renderer/shims/ReactNative.js +3 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +22 -35
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +5 -6
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/StyleSheet/StyleSheet.js +7 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +7 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +13 -2
- package/Libraries/StyleSheet/StyleSheetTypes.js +24 -6
- package/Libraries/StyleSheet/processBackgroundImage.js +87 -110
- package/Libraries/StyleSheet/processTransform.js +3 -34
- package/Libraries/Text/Text.js +248 -249
- package/Libraries/Text/Text.win32.js +282 -295
- package/Libraries/Text/TextNativeComponent.js +0 -1
- package/Libraries/TurboModule/TurboModuleRegistry.js +5 -5
- package/Libraries/Types/CoreEventTypes.d.ts +3 -10
- package/Libraries/Types/CoreEventTypes.js +4 -6
- package/Libraries/Types/CoreEventTypes.win32.js +4 -6
- package/Libraries/Utilities/Appearance.js +3 -1
- package/Libraries/Utilities/BackHandler.android.js +6 -18
- package/Libraries/Utilities/BackHandler.d.ts +0 -4
- package/Libraries/Utilities/BackHandler.ios.js +0 -7
- package/Libraries/Utilities/BackHandler.win32.js +6 -18
- package/Libraries/Utilities/FocusManager.win32.js +1 -1
- package/Libraries/Utilities/HMRClient.js +3 -4
- package/Libraries/Utilities/Platform.flow.js +2 -2
- package/Libraries/Utilities/Platform.flow.win32.js +3 -2
- package/Libraries/Utilities/__mocks__/BackHandler.js +3 -8
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/Utilities/useMergeRefs.js +26 -7
- package/Libraries/WebSocket/WebSocketEvent.js +4 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +31 -13
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +6 -5
- package/Libraries/promiseRejectionTrackingOptions.js +1 -1
- package/index.js +10 -3
- package/index.win32.js +10 -3
- package/jest/setup.js +36 -1
- package/overrides.json +37 -37
- package/package.json +20 -20
- package/src/private/animated/NativeAnimatedHelper.js +18 -16
- package/src/private/animated/NativeAnimatedHelper.win32.js +18 -15
- package/src/private/animated/useAnimatedPropsMemo.js +348 -0
- package/src/private/components/HScrollViewNativeComponents.js +1 -27
- package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +11 -8
- package/src/private/components/VScrollViewNativeComponents.js +2 -25
- package/src/private/debugging/ReactDevToolsSettingsManager.android.js +20 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.ios.js +30 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.win32.js +20 -0
- package/src/private/{fusebox → debugging}/setUpFuseboxReactDevToolsDispatcher.js +6 -0
- package/src/private/devmenu/DevMenu.d.ts +20 -0
- package/src/private/devmenu/DevMenu.js +31 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +95 -86
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +8 -2
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -19
- package/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js +34 -0
- package/src/private/setup/setUpDOM.js +14 -6
- package/src/private/setup/setUpMutationObserver.js +5 -0
- package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -0
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
- package/src/private/specs/modules/NativeAccessibilityInfo.js +9 -0
- package/src/private/specs/modules/NativeAccessibilityInfoWin32.js +9 -0
- package/src/private/specs/modules/NativeAccessibilityManager.js +4 -0
- package/src/private/specs/modules/NativeActionSheetManager.js +2 -0
- package/src/private/specs/modules/NativeAppearance.js +4 -10
- package/src/private/specs/modules/NativeExceptionsManager.js +0 -12
- package/src/private/specs/modules/{NativeDevToolsSettingsManager.js → NativeReactDevToolsSettingsManager.js} +3 -5
- package/src/private/webapis/dom/geometry/DOMRect.js +2 -2
- package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +2 -2
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -3
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +102 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +26 -0
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +9 -0
- package/src/private/webapis/performance/EventTiming.js +13 -8
- package/src/private/webapis/performance/Performance.js +66 -73
- package/src/private/webapis/performance/PerformanceEntry.js +2 -5
- package/src/private/webapis/performance/PerformanceObserver.js +65 -164
- package/src/private/webapis/performance/RawPerformanceEntry.js +1 -1
- package/src/private/webapis/performance/UserTiming.js +11 -7
- package/src/private/webapis/performance/Utilities.js +18 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +71 -2
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +267 -0
- package/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
- package/types/index.d.ts +1 -1
- package/types/public/ReactNativeTypes.d.ts +4 -8
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +0 -35
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +0 -20
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +0 -49
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +0 -35
- package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +0 -13
- package/Libraries/ReactNative/ReactFabricInternals.js +0 -17
- package/src/private/components/useSyncOnScroll.js +0 -48
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +0 -61
- package/src/private/webapis/performance/specs/__mocks__/NativePerformance.js +0 -67
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceObserver.js +0 -127
- package/types/experimental.d.ts +0 -59
- /package/src/private/{fusebox → debugging}/FuseboxSessionObserver.js +0 -0
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type {HostInstance} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
12
|
import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
|
|
13
|
-
import type {ElementRef} from 'react';
|
|
14
13
|
|
|
15
14
|
import RCTDeviceEventEmitter from '../../EventEmitter/RCTDeviceEventEmitter';
|
|
16
15
|
import {sendAccessibilityEvent} from '../../ReactNative/RendererProxy';
|
|
@@ -22,6 +21,7 @@ import NativeAccessibilityManagerIOS from './NativeAccessibilityManager';
|
|
|
22
21
|
// Events that are only supported on Android.
|
|
23
22
|
type AccessibilityEventDefinitionsAndroid = {
|
|
24
23
|
accessibilityServiceChanged: [boolean],
|
|
24
|
+
highTextContrastChanged: [boolean],
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// Events that are only supported on iOS.
|
|
@@ -31,6 +31,7 @@ type AccessibilityEventDefinitionsIOS = {
|
|
|
31
31
|
grayscaleChanged: [boolean],
|
|
32
32
|
invertColorsChanged: [boolean],
|
|
33
33
|
reduceTransparencyChanged: [boolean],
|
|
34
|
+
darkerSystemColorsChanged: [boolean],
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
type AccessibilityEventDefinitions = {
|
|
@@ -51,8 +52,11 @@ const EventNames: Map<
|
|
|
51
52
|
? new Map([
|
|
52
53
|
['change', 'touchExplorationDidChange'],
|
|
53
54
|
['reduceMotionChanged', 'reduceMotionDidChange'],
|
|
55
|
+
['highTextContrastChanged', 'highTextContrastDidChange'],
|
|
54
56
|
['screenReaderChanged', 'touchExplorationDidChange'],
|
|
55
57
|
['accessibilityServiceChanged', 'accessibilityServiceDidChange'],
|
|
58
|
+
['invertColorsChanged', 'invertColorDidChange'],
|
|
59
|
+
['grayscaleChanged', 'grayscaleModeDidChange'],
|
|
56
60
|
])
|
|
57
61
|
: new Map([
|
|
58
62
|
['announcementFinished', 'announcementFinished'],
|
|
@@ -63,6 +67,7 @@ const EventNames: Map<
|
|
|
63
67
|
['reduceMotionChanged', 'reduceMotionChanged'],
|
|
64
68
|
['reduceTransparencyChanged', 'reduceTransparencyChanged'],
|
|
65
69
|
['screenReaderChanged', 'screenReaderChanged'],
|
|
70
|
+
['darkerSystemColorsChanged', 'darkerSystemColorsChanged'],
|
|
66
71
|
]);
|
|
67
72
|
|
|
68
73
|
/**
|
|
@@ -110,7 +115,13 @@ const AccessibilityInfo = {
|
|
|
110
115
|
*/
|
|
111
116
|
isGrayscaleEnabled(): Promise<boolean> {
|
|
112
117
|
if (Platform.OS === 'android') {
|
|
113
|
-
return Promise
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
if (NativeAccessibilityInfoAndroid?.isGrayscaleEnabled != null) {
|
|
120
|
+
NativeAccessibilityInfoAndroid.isGrayscaleEnabled(resolve);
|
|
121
|
+
} else {
|
|
122
|
+
reject(null);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
114
125
|
} else {
|
|
115
126
|
return new Promise((resolve, reject) => {
|
|
116
127
|
if (NativeAccessibilityManagerIOS != null) {
|
|
@@ -135,7 +146,13 @@ const AccessibilityInfo = {
|
|
|
135
146
|
*/
|
|
136
147
|
isInvertColorsEnabled(): Promise<boolean> {
|
|
137
148
|
if (Platform.OS === 'android') {
|
|
138
|
-
return Promise
|
|
149
|
+
return new Promise((resolve, reject) => {
|
|
150
|
+
if (NativeAccessibilityInfoAndroid?.isInvertColorsEnabled != null) {
|
|
151
|
+
NativeAccessibilityInfoAndroid.isInvertColorsEnabled(resolve);
|
|
152
|
+
} else {
|
|
153
|
+
reject(null);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
139
156
|
} else {
|
|
140
157
|
return new Promise((resolve, reject) => {
|
|
141
158
|
if (NativeAccessibilityManagerIOS != null) {
|
|
@@ -179,6 +196,52 @@ const AccessibilityInfo = {
|
|
|
179
196
|
});
|
|
180
197
|
},
|
|
181
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Query whether high text contrast is currently enabled. Android only.
|
|
201
|
+
*
|
|
202
|
+
* Returns a promise which resolves to a boolean.
|
|
203
|
+
* The result is `true` when high text contrast is enabled and `false` otherwise.
|
|
204
|
+
*/
|
|
205
|
+
isHighTextContrastEnabled(): Promise<boolean> {
|
|
206
|
+
return new Promise((resolve, reject) => {
|
|
207
|
+
if (Platform.OS === 'android') {
|
|
208
|
+
if (NativeAccessibilityInfoAndroid?.isHighTextContrastEnabled != null) {
|
|
209
|
+
NativeAccessibilityInfoAndroid.isHighTextContrastEnabled(resolve);
|
|
210
|
+
} else {
|
|
211
|
+
reject(null);
|
|
212
|
+
}
|
|
213
|
+
} else {
|
|
214
|
+
return Promise.resolve(false);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Query whether dark system colors is currently enabled. iOS only.
|
|
221
|
+
*
|
|
222
|
+
* Returns a promise which resolves to a boolean.
|
|
223
|
+
* The result is `true` when dark system colors is enabled and `false` otherwise.
|
|
224
|
+
*/
|
|
225
|
+
isDarkerSystemColorsEnabled(): Promise<boolean> {
|
|
226
|
+
return new Promise((resolve, reject) => {
|
|
227
|
+
if (Platform.OS === 'android') {
|
|
228
|
+
return Promise.resolve(false);
|
|
229
|
+
} else {
|
|
230
|
+
if (
|
|
231
|
+
NativeAccessibilityManagerIOS?.getCurrentDarkerSystemColorsState !=
|
|
232
|
+
null
|
|
233
|
+
) {
|
|
234
|
+
NativeAccessibilityManagerIOS.getCurrentDarkerSystemColorsState(
|
|
235
|
+
resolve,
|
|
236
|
+
reject,
|
|
237
|
+
);
|
|
238
|
+
} else {
|
|
239
|
+
reject(null);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
|
|
182
245
|
/**
|
|
183
246
|
* Query whether reduce motion and prefer cross-fade transitions settings are currently enabled.
|
|
184
247
|
*
|
|
@@ -319,6 +382,15 @@ const AccessibilityInfo = {
|
|
|
319
382
|
* - `announcement`: The string announced by the screen reader.
|
|
320
383
|
* - `success`: A boolean indicating whether the announcement was
|
|
321
384
|
* successfully made.
|
|
385
|
+
* - `darkerSystemColorsChanged`: iOS-only event. Fires when the state of the dark system colors
|
|
386
|
+
* toggle changes. The argument to the event handler is a boolean. The boolean is `true` when
|
|
387
|
+
* dark system colors is enabled and `false` otherwise.
|
|
388
|
+
*
|
|
389
|
+
* These events are only supported on Android:
|
|
390
|
+
*
|
|
391
|
+
* - `highTextContrastChanged`: Android-only event. Fires when the state of the high text contrast
|
|
392
|
+
* toggle changes. The argument to the event handler is a boolean. The boolean is `true` when
|
|
393
|
+
* high text contrast is enabled and `false` otherwise.
|
|
322
394
|
*
|
|
323
395
|
* See https://reactnative.dev/docs/accessibilityinfo#addeventlistener
|
|
324
396
|
*/
|
|
@@ -347,7 +419,7 @@ const AccessibilityInfo = {
|
|
|
347
419
|
* Send a named accessibility event to a HostComponent.
|
|
348
420
|
*/
|
|
349
421
|
sendAccessibilityEvent(
|
|
350
|
-
handle:
|
|
422
|
+
handle: HostInstance,
|
|
351
423
|
eventType: AccessibilityEventTypes,
|
|
352
424
|
) {
|
|
353
425
|
// iOS only supports 'focus' event types
|
|
@@ -8,21 +8,22 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type {HostInstance} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
12
|
import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
|
|
13
|
-
import type {ElementRef} from 'react';
|
|
14
13
|
|
|
15
14
|
import RCTDeviceEventEmitter from '../../EventEmitter/RCTDeviceEventEmitter';
|
|
16
15
|
import {sendAccessibilityEvent} from '../../ReactNative/RendererProxy';
|
|
17
16
|
import Platform from '../../Utilities/Platform';
|
|
18
17
|
import legacySendAccessibilityEvent from './legacySendAccessibilityEvent';
|
|
19
18
|
import NativeAccessibilityInfo from './NativeAccessibilityInfo';
|
|
19
|
+
import NativeAccessibilityInfoAndroid from './NativeAccessibilityInfo';
|
|
20
20
|
import NativeAccessibilityInfoWin32 from './NativeAccessibilityInfoWin32';
|
|
21
21
|
import NativeAccessibilityManagerIOS from './NativeAccessibilityManager';
|
|
22
22
|
|
|
23
23
|
// Events that are only supported on Android.
|
|
24
24
|
type AccessibilityEventDefinitionsAndroid = {
|
|
25
25
|
accessibilityServiceChanged: [boolean],
|
|
26
|
+
highTextContrastChanged: [boolean],
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
// Events that are only supported on iOS.
|
|
@@ -32,6 +33,7 @@ type AccessibilityEventDefinitionsIOS = {
|
|
|
32
33
|
grayscaleChanged: [boolean],
|
|
33
34
|
invertColorsChanged: [boolean],
|
|
34
35
|
reduceTransparencyChanged: [boolean],
|
|
36
|
+
darkerSystemColorsChanged: [boolean],
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
type AccessibilityEventDefinitions = {
|
|
@@ -52,8 +54,11 @@ const EventNames: Map<
|
|
|
52
54
|
? new Map([
|
|
53
55
|
['change', 'touchExplorationDidChange'],
|
|
54
56
|
['reduceMotionChanged', 'reduceMotionDidChange'],
|
|
57
|
+
['highTextContrastChanged', 'highTextContrastDidChange'],
|
|
55
58
|
['screenReaderChanged', 'touchExplorationDidChange'],
|
|
56
59
|
['accessibilityServiceChanged', 'accessibilityServiceDidChange'],
|
|
60
|
+
['invertColorsChanged', 'invertColorDidChange'],
|
|
61
|
+
['grayscaleChanged', 'grayscaleModeDidChange'],
|
|
57
62
|
])
|
|
58
63
|
: Platform.OS === 'win32'
|
|
59
64
|
? new Map([
|
|
@@ -70,6 +75,7 @@ const EventNames: Map<
|
|
|
70
75
|
['reduceMotionChanged', 'reduceMotionChanged'],
|
|
71
76
|
['reduceTransparencyChanged', 'reduceTransparencyChanged'],
|
|
72
77
|
['screenReaderChanged', 'screenReaderChanged'],
|
|
78
|
+
['darkerSystemColorsChanged', 'darkerSystemColorsChanged'],
|
|
73
79
|
]);
|
|
74
80
|
|
|
75
81
|
/**
|
|
@@ -116,7 +122,15 @@ const AccessibilityInfo = {
|
|
|
116
122
|
* See https://reactnative.dev/docs/accessibilityinfo#isGrayscaleEnabled
|
|
117
123
|
*/
|
|
118
124
|
isGrayscaleEnabled(): Promise<boolean> {
|
|
119
|
-
if (Platform.OS === 'android'
|
|
125
|
+
if (Platform.OS === 'android') {
|
|
126
|
+
return new Promise((resolve, reject) => {
|
|
127
|
+
if (NativeAccessibilityInfoAndroid?.isGrayscaleEnabled != null) {
|
|
128
|
+
NativeAccessibilityInfoAndroid.isGrayscaleEnabled(resolve);
|
|
129
|
+
} else {
|
|
130
|
+
reject(null);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
} else if (Platform.OS === 'win32') {
|
|
120
134
|
return Promise.resolve(false);
|
|
121
135
|
} else {
|
|
122
136
|
return new Promise((resolve, reject) => {
|
|
@@ -141,7 +155,15 @@ const AccessibilityInfo = {
|
|
|
141
155
|
* See https://reactnative.dev/docs/accessibilityinfo#isInvertColorsEnabled
|
|
142
156
|
*/
|
|
143
157
|
isInvertColorsEnabled(): Promise<boolean> {
|
|
144
|
-
if (Platform.OS === 'android'
|
|
158
|
+
if (Platform.OS === 'android') {
|
|
159
|
+
return new Promise((resolve, reject) => {
|
|
160
|
+
if (NativeAccessibilityInfoAndroid?.isInvertColorsEnabled != null) {
|
|
161
|
+
NativeAccessibilityInfoAndroid.isInvertColorsEnabled(resolve);
|
|
162
|
+
} else {
|
|
163
|
+
reject(null);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
} else if (Platform.OS === 'win32') {
|
|
145
167
|
return Promise.resolve(false);
|
|
146
168
|
} else {
|
|
147
169
|
return new Promise((resolve, reject) => {
|
|
@@ -192,6 +214,52 @@ const AccessibilityInfo = {
|
|
|
192
214
|
});
|
|
193
215
|
},
|
|
194
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Query whether high text contrast is currently enabled. Android only.
|
|
219
|
+
*
|
|
220
|
+
* Returns a promise which resolves to a boolean.
|
|
221
|
+
* The result is `true` when high text contrast is enabled and `false` otherwise.
|
|
222
|
+
*/
|
|
223
|
+
isHighTextContrastEnabled(): Promise<boolean> {
|
|
224
|
+
return new Promise((resolve, reject) => {
|
|
225
|
+
if (Platform.OS === 'android') {
|
|
226
|
+
if (NativeAccessibilityInfo?.isHighTextContrastEnabled != null) {
|
|
227
|
+
NativeAccessibilityInfo.isHighTextContrastEnabled(resolve);
|
|
228
|
+
} else {
|
|
229
|
+
reject(null);
|
|
230
|
+
}
|
|
231
|
+
} else {
|
|
232
|
+
return Promise.resolve(false);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Query whether dark system colors is currently enabled. iOS only.
|
|
239
|
+
*
|
|
240
|
+
* Returns a promise which resolves to a boolean.
|
|
241
|
+
* The result is `true` when dark system colors is enabled and `false` otherwise.
|
|
242
|
+
*/
|
|
243
|
+
isDarkerSystemColorsEnabled(): Promise<boolean> {
|
|
244
|
+
return new Promise((resolve, reject) => {
|
|
245
|
+
if (Platform.OS === 'android') {
|
|
246
|
+
return Promise.resolve(false);
|
|
247
|
+
} else {
|
|
248
|
+
if (
|
|
249
|
+
NativeAccessibilityManagerIOS?.getCurrentDarkerSystemColorsState !=
|
|
250
|
+
null
|
|
251
|
+
) {
|
|
252
|
+
NativeAccessibilityManagerIOS.getCurrentDarkerSystemColorsState(
|
|
253
|
+
resolve,
|
|
254
|
+
reject,
|
|
255
|
+
);
|
|
256
|
+
} else {
|
|
257
|
+
reject(null);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
|
|
195
263
|
/**
|
|
196
264
|
* Query whether reduce motion and prefer cross-fade transitions settings are currently enabled.
|
|
197
265
|
*
|
|
@@ -338,6 +406,15 @@ const AccessibilityInfo = {
|
|
|
338
406
|
* - `announcement`: The string announced by the screen reader.
|
|
339
407
|
* - `success`: A boolean indicating whether the announcement was
|
|
340
408
|
* successfully made.
|
|
409
|
+
* - `darkerSystemColorsChanged`: iOS-only event. Fires when the state of the dark system colors
|
|
410
|
+
* toggle changes. The argument to the event handler is a boolean. The boolean is `true` when
|
|
411
|
+
* dark system colors is enabled and `false` otherwise.
|
|
412
|
+
*
|
|
413
|
+
* These events are only supported on Android:
|
|
414
|
+
*
|
|
415
|
+
* - `highTextContrastChanged`: Android-only event. Fires when the state of the high text contrast
|
|
416
|
+
* toggle changes. The argument to the event handler is a boolean. The boolean is `true` when
|
|
417
|
+
* high text contrast is enabled and `false` otherwise.
|
|
341
418
|
*
|
|
342
419
|
* See https://reactnative.dev/docs/accessibilityinfo#addeventlistener
|
|
343
420
|
*/
|
|
@@ -366,7 +443,7 @@ const AccessibilityInfo = {
|
|
|
366
443
|
* Send a named accessibility event to a HostComponent.
|
|
367
444
|
*/
|
|
368
445
|
sendAccessibilityEvent(
|
|
369
|
-
handle:
|
|
446
|
+
handle: HostInstance,
|
|
370
447
|
eventType: AccessibilityEventTypes,
|
|
371
448
|
) {
|
|
372
449
|
// iOS only supports 'focus' event types
|
|
@@ -153,10 +153,10 @@ const ActivityIndicator = (
|
|
|
153
153
|
```
|
|
154
154
|
*/
|
|
155
155
|
|
|
156
|
-
const ActivityIndicatorWithRef:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
const ActivityIndicatorWithRef: component(
|
|
157
|
+
ref: React.RefSetter<HostComponent<empty>>,
|
|
158
|
+
...props: Props
|
|
159
|
+
) = React.forwardRef(ActivityIndicator);
|
|
160
160
|
ActivityIndicatorWithRef.displayName = 'ActivityIndicator';
|
|
161
161
|
|
|
162
162
|
const styles = StyleSheet.create({
|
|
@@ -283,10 +283,12 @@ type ButtonProps = $ReadOnly<{|
|
|
|
283
283
|
const Touchable: typeof TouchableNativeFeedback | typeof TouchableOpacity =
|
|
284
284
|
Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
|
|
285
285
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
type ButtonRef = React.ElementRef<typeof Touchable>;
|
|
287
|
+
|
|
288
|
+
const Button: component(
|
|
289
|
+
ref: React.RefSetter<ButtonRef>,
|
|
290
|
+
...props: ButtonProps
|
|
291
|
+
) = React.forwardRef((props: ButtonProps, ref: React.RefSetter<ButtonRef>) => {
|
|
290
292
|
const {
|
|
291
293
|
accessibilityLabel,
|
|
292
294
|
accessibilityState,
|
|
@@ -379,6 +381,9 @@ const Button: React.AbstractComponent<
|
|
|
379
381
|
disabled={disabled}
|
|
380
382
|
onPress={onPress}
|
|
381
383
|
touchSoundDisabled={touchSoundDisabled}
|
|
384
|
+
// $FlowFixMe[incompatible-exact]
|
|
385
|
+
// $FlowFixMe[prop-missing]
|
|
386
|
+
// $FlowFixMe[incompatible-type-arg]
|
|
382
387
|
ref={ref}>
|
|
383
388
|
<View style={buttonStyles}>
|
|
384
389
|
<Text style={textStyles} disabled={disabled}>
|
|
@@ -283,10 +283,15 @@ type ButtonProps = $ReadOnly<{|
|
|
|
283
283
|
```
|
|
284
284
|
*/
|
|
285
285
|
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
const Touchable: typeof TouchableNativeFeedback | typeof TouchableOpacity =
|
|
287
|
+
Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
|
|
288
|
+
|
|
289
|
+
type ButtonRef = React.ElementRef<typeof Touchable>;
|
|
290
|
+
|
|
291
|
+
const Button: component(
|
|
292
|
+
ref: React.RefSetter<ButtonRef>,
|
|
293
|
+
...props: ButtonProps
|
|
294
|
+
) = React.forwardRef((props: ButtonProps, ref: React.RefSetter<ButtonRef>) => {
|
|
290
295
|
// Win32
|
|
291
296
|
const {
|
|
292
297
|
accessibilityLabel,
|
|
@@ -387,6 +392,9 @@ const Button: React.AbstractComponent<
|
|
|
387
392
|
disabled={disabled}
|
|
388
393
|
onPress={onPress}
|
|
389
394
|
touchSoundDisabled={touchSoundDisabled}
|
|
395
|
+
// $FlowFixMe[incompatible-exact]
|
|
396
|
+
// $FlowFixMe[prop-missing]
|
|
397
|
+
// $FlowFixMe[incompatible-type-arg]
|
|
390
398
|
ref={ref}>
|
|
391
399
|
<View style={buttonStyles}>
|
|
392
400
|
<Text style={textStyles} disabled={disabled}>
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @format
|
|
8
|
+
* @flow strict-local
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
'use strict';
|
|
11
12
|
|
|
12
|
-
module.exports =
|
|
13
|
+
module.exports =
|
|
14
|
+
require('../UnimplementedViews/UnimplementedView') as $FlowFixMe;
|
|
@@ -116,6 +116,8 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
_onLayout = async (event: ViewLayoutEvent) => {
|
|
119
|
+
event.persist();
|
|
120
|
+
|
|
119
121
|
const oldFrame = this._frame;
|
|
120
122
|
this._frame = event.nativeEvent.layout;
|
|
121
123
|
if (!this._initialFrameHeight) {
|
|
@@ -191,6 +193,11 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
|
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
componentDidMount(): void {
|
|
196
|
+
if (!Keyboard.isVisible()) {
|
|
197
|
+
this._keyboardEvent = null;
|
|
198
|
+
this._setBottom(0);
|
|
199
|
+
}
|
|
200
|
+
|
|
194
201
|
if (Platform.OS === 'ios') {
|
|
195
202
|
this._subscriptions = [
|
|
196
203
|
Keyboard.addListener('keyboardWillChangeFrame', this._onKeyboardChange),
|
|
@@ -363,7 +363,7 @@ function usePressState(forcePressed: boolean): [boolean, (boolean) => void] {
|
|
|
363
363
|
const MemoedPressable = React.memo(React.forwardRef(Pressable));
|
|
364
364
|
MemoedPressable.displayName = 'Pressable';
|
|
365
365
|
|
|
366
|
-
export default (MemoedPressable:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
export default (MemoedPressable: component(
|
|
367
|
+
ref: React.RefSetter<React.ElementRef<typeof View>>,
|
|
368
|
+
...props: Props
|
|
369
|
+
));
|
|
@@ -431,7 +431,7 @@ function usePressState(forcePressed: boolean): [boolean, (boolean) => void] {
|
|
|
431
431
|
const MemoedPressable = React.memo(React.forwardRef(Pressable));
|
|
432
432
|
MemoedPressable.displayName = 'Pressable';
|
|
433
433
|
|
|
434
|
-
export default (MemoedPressable:
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
434
|
+
export default (MemoedPressable: component(
|
|
435
|
+
ref: React.RefSetter<React.ElementRef<typeof View>>,
|
|
436
|
+
...props: Props
|
|
437
|
+
));
|
|
@@ -78,15 +78,23 @@ export type ProgressBarAndroidProps = $ReadOnly<{|
|
|
|
78
78
|
* },
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
const
|
|
81
|
+
const ProgressBarAndroidWithForwardedRef: component(
|
|
82
|
+
ref: React.RefSetter<
|
|
83
|
+
React.ElementRef<typeof ProgressBarAndroidNativeComponent>,
|
|
84
|
+
>,
|
|
85
|
+
...props: ProgressBarAndroidProps
|
|
86
|
+
) = React.forwardRef(function ProgressBarAndroid(
|
|
82
87
|
{
|
|
88
|
+
// $FlowFixMe[incompatible-type]
|
|
83
89
|
styleAttr = 'Normal',
|
|
84
90
|
indeterminate = true,
|
|
85
91
|
animating = true,
|
|
86
92
|
...restProps
|
|
87
93
|
}: ProgressBarAndroidProps,
|
|
88
|
-
forwardedRef: ?React.
|
|
89
|
-
|
|
94
|
+
forwardedRef: ?React.RefSetter<
|
|
95
|
+
React.ElementRef<typeof ProgressBarAndroidNativeComponent>,
|
|
96
|
+
>,
|
|
97
|
+
) {
|
|
90
98
|
return (
|
|
91
99
|
<ProgressBarAndroidNativeComponent
|
|
92
100
|
styleAttr={styleAttr}
|
|
@@ -96,12 +104,10 @@ const ProgressBarAndroid = (
|
|
|
96
104
|
ref={forwardedRef}
|
|
97
105
|
/>
|
|
98
106
|
);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const ProgressBarAndroidToExport = React.forwardRef(ProgressBarAndroid);
|
|
107
|
+
});
|
|
102
108
|
|
|
103
109
|
module.exports =
|
|
104
110
|
/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an
|
|
105
111
|
* error found when Flow v0.89 was deployed. To see the error, delete this
|
|
106
112
|
* comment and run Flow. */
|
|
107
|
-
(
|
|
113
|
+
(ProgressBarAndroidWithForwardedRef: typeof ProgressBarAndroidNativeComponent);
|
|
@@ -14,8 +14,9 @@ import type {HostComponent} from '../../../Renderer/shims/ReactNativeTypes';
|
|
|
14
14
|
import requireNativeComponent from '../../../ReactNative/requireNativeComponent';
|
|
15
15
|
import * as React from 'react';
|
|
16
16
|
|
|
17
|
-
const RCTRefreshControl: HostComponent<
|
|
18
|
-
|
|
17
|
+
const RCTRefreshControl: HostComponent<{}> = requireNativeComponent<{}>(
|
|
18
|
+
'RCTRefreshControl',
|
|
19
|
+
);
|
|
19
20
|
|
|
20
21
|
class RefreshControlMock extends React.Component<{...}> {
|
|
21
22
|
static latestRef: ?RefreshControlMock;
|
|
@@ -23,10 +23,10 @@ import * as React from 'react';
|
|
|
23
23
|
* limitation of the screen, such as rounded corners or camera notches (aka
|
|
24
24
|
* sensor housing area on iPhone X).
|
|
25
25
|
*/
|
|
26
|
-
const exported:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
const exported: component(
|
|
27
|
+
ref: React.RefSetter<React.ElementRef<typeof View>>,
|
|
28
|
+
...props: ViewProps
|
|
29
|
+
) = Platform.select({
|
|
30
30
|
ios: require('./RCTSafeAreaViewNativeComponent').default,
|
|
31
31
|
default: View,
|
|
32
32
|
});
|
|
@@ -23,10 +23,10 @@ import * as React from 'react';
|
|
|
23
23
|
* limitation of the screen, such as rounded corners or camera notches (aka
|
|
24
24
|
* sensor housing area on iPhone X).
|
|
25
25
|
*/
|
|
26
|
-
const exported:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
const exported: component(
|
|
27
|
+
ref: React.RefSetter<React.ElementRef<typeof View>>,
|
|
28
|
+
...props: ViewProps
|
|
29
|
+
) = Platform.select({
|
|
30
30
|
ios: require('./RCTSafeAreaViewNativeComponent').default,
|
|
31
31
|
default: View,
|
|
32
32
|
});
|