@office-iss/react-native-win32 0.76.2 → 0.77.0-preview.2
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 +179 -53
- package/CHANGELOG.md +82 -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 +104 -46
- package/Libraries/Animated/nodes/AnimatedStyle.js +116 -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/FormData.js +11 -3
- 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 +356 -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,21 +8,22 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
11
|
import type {EventSubscription} from '../EventEmitter/NativeEventEmitter';
|
|
12
|
+
import type {AnimatedPropsAllowlist} from './nodes/AnimatedProps';
|
|
14
13
|
|
|
14
|
+
import NativeAnimatedHelper from '../../src/private/animated/NativeAnimatedHelper';
|
|
15
|
+
import {useAnimatedPropsMemo} from '../../src/private/animated/useAnimatedPropsMemo';
|
|
15
16
|
import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
|
|
16
17
|
import {isPublicInstance as isFabricPublicInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils';
|
|
17
18
|
import useRefEffect from '../Utilities/useRefEffect';
|
|
18
19
|
import {AnimatedEvent} from './AnimatedEvent';
|
|
19
|
-
import NativeAnimatedHelper from '../../src/private/animated/NativeAnimatedHelper';
|
|
20
20
|
import AnimatedNode from './nodes/AnimatedNode';
|
|
21
21
|
import AnimatedProps from './nodes/AnimatedProps';
|
|
22
22
|
import AnimatedValue from './nodes/AnimatedValue';
|
|
23
23
|
import {
|
|
24
24
|
useCallback,
|
|
25
25
|
useEffect,
|
|
26
|
+
useInsertionEffect,
|
|
26
27
|
useLayoutEffect,
|
|
27
28
|
useMemo,
|
|
28
29
|
useReducer,
|
|
@@ -36,34 +37,46 @@ type ReducedProps<TProps> = {
|
|
|
36
37
|
};
|
|
37
38
|
type CallbackRef<T> = T => mixed;
|
|
38
39
|
|
|
40
|
+
type UpdateCallback = () => void;
|
|
41
|
+
|
|
39
42
|
type AnimatedValueListeners = Array<{
|
|
40
43
|
propValue: AnimatedValue,
|
|
41
44
|
listenerId: string,
|
|
42
45
|
}>;
|
|
43
46
|
|
|
47
|
+
const useMemoOrAnimatedPropsMemo =
|
|
48
|
+
ReactNativeFeatureFlags.enableAnimatedPropsMemo()
|
|
49
|
+
? useAnimatedPropsMemo
|
|
50
|
+
: useMemo;
|
|
51
|
+
|
|
44
52
|
export default function useAnimatedProps<TProps: {...}, TInstance>(
|
|
45
53
|
props: TProps,
|
|
54
|
+
allowlist?: ?AnimatedPropsAllowlist,
|
|
46
55
|
): [ReducedProps<TProps>, CallbackRef<TInstance | null>] {
|
|
47
56
|
const [, scheduleUpdate] = useReducer<number, void>(count => count + 1, 0);
|
|
48
|
-
const onUpdateRef = useRef
|
|
57
|
+
const onUpdateRef = useRef<UpdateCallback | null>(null);
|
|
49
58
|
const timerRef = useRef<TimeoutID | null>(null);
|
|
50
59
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const node =
|
|
56
|
-
() =>
|
|
57
|
-
|
|
60
|
+
const allowlistIfEnabled = ReactNativeFeatureFlags.enableAnimatedAllowlist()
|
|
61
|
+
? allowlist
|
|
62
|
+
: null;
|
|
63
|
+
|
|
64
|
+
const node = useMemoOrAnimatedPropsMemo(
|
|
65
|
+
() =>
|
|
66
|
+
new AnimatedProps(
|
|
67
|
+
props,
|
|
68
|
+
() => onUpdateRef.current?.(),
|
|
69
|
+
allowlistIfEnabled,
|
|
70
|
+
),
|
|
71
|
+
[allowlistIfEnabled, props],
|
|
58
72
|
);
|
|
73
|
+
|
|
59
74
|
const useNativePropsInFabric =
|
|
60
75
|
ReactNativeFeatureFlags.shouldUseSetNativePropsInFabric();
|
|
61
|
-
const useSetNativePropsInNativeAnimationsInFabric =
|
|
62
|
-
ReactNativeFeatureFlags.shouldUseSetNativePropsInNativeAnimationsInFabric();
|
|
63
76
|
|
|
64
77
|
const useAnimatedPropsLifecycle =
|
|
65
|
-
ReactNativeFeatureFlags.
|
|
66
|
-
?
|
|
78
|
+
ReactNativeFeatureFlags.useInsertionEffectsForAnimations()
|
|
79
|
+
? useAnimatedPropsLifecycle_insertionEffects
|
|
67
80
|
: useAnimatedPropsLifecycle_layoutEffects;
|
|
68
81
|
|
|
69
82
|
useAnimatedPropsLifecycle(node);
|
|
@@ -104,12 +117,7 @@ export default function useAnimatedProps<TProps: {...}, TInstance>(
|
|
|
104
117
|
if (isFabricNode) {
|
|
105
118
|
// Call `scheduleUpdate` to synchronise Fiber and Shadow tree.
|
|
106
119
|
// Must not be called in Paper.
|
|
107
|
-
|
|
108
|
-
// $FlowFixMe[incompatible-use]
|
|
109
|
-
instance.setNativeProps(node.__getAnimatedValue());
|
|
110
|
-
} else {
|
|
111
|
-
scheduleUpdate();
|
|
112
|
-
}
|
|
120
|
+
scheduleUpdate();
|
|
113
121
|
}
|
|
114
122
|
return;
|
|
115
123
|
}
|
|
@@ -186,23 +194,23 @@ export default function useAnimatedProps<TProps: {...}, TInstance>(
|
|
|
186
194
|
}
|
|
187
195
|
};
|
|
188
196
|
},
|
|
189
|
-
[
|
|
190
|
-
node,
|
|
191
|
-
useNativePropsInFabric,
|
|
192
|
-
useSetNativePropsInNativeAnimationsInFabric,
|
|
193
|
-
props,
|
|
194
|
-
],
|
|
197
|
+
[node, useNativePropsInFabric, props],
|
|
195
198
|
);
|
|
196
199
|
const callbackRef = useRefEffect<TInstance>(refEffect);
|
|
197
200
|
|
|
198
|
-
return [reduceAnimatedProps<TProps>(node), callbackRef];
|
|
201
|
+
return [reduceAnimatedProps<TProps>(node, props), callbackRef];
|
|
199
202
|
}
|
|
200
203
|
|
|
201
|
-
function reduceAnimatedProps<TProps>(
|
|
204
|
+
function reduceAnimatedProps<TProps>(
|
|
205
|
+
node: AnimatedProps,
|
|
206
|
+
props: TProps,
|
|
207
|
+
): ReducedProps<TProps> {
|
|
202
208
|
// Force `collapsable` to be false so that the native view is not flattened.
|
|
203
209
|
// Flattened views cannot be accurately referenced by the native driver.
|
|
204
210
|
return {
|
|
205
|
-
...
|
|
211
|
+
...(ReactNativeFeatureFlags.enableAnimatedPropsMemo()
|
|
212
|
+
? node.__getValueWithStaticProps(props)
|
|
213
|
+
: node.__getValue()),
|
|
206
214
|
collapsable: false,
|
|
207
215
|
};
|
|
208
216
|
}
|
|
@@ -301,10 +309,8 @@ function useAnimatedPropsLifecycle_layoutEffects(node: AnimatedProps): void {
|
|
|
301
309
|
* uses reference counting to determine when to recursively detach its children
|
|
302
310
|
* nodes. So in order to optimize this, we avoid detaching until the next attach
|
|
303
311
|
* unless we are unmounting.
|
|
304
|
-
*
|
|
305
|
-
* NOTE: unlike `useAnimatedPropsLifecycle_layoutEffects`, this version uses passive effects to setup animation graph.
|
|
306
312
|
*/
|
|
307
|
-
function
|
|
313
|
+
function useAnimatedPropsLifecycle_insertionEffects(node: AnimatedProps): void {
|
|
308
314
|
const prevNodeRef = useRef<?AnimatedProps>(null);
|
|
309
315
|
const isUnmountingRef = useRef<boolean>(false);
|
|
310
316
|
|
|
@@ -315,14 +321,14 @@ function useAnimatedPropsLifecycle_passiveEffects(node: AnimatedProps): void {
|
|
|
315
321
|
NativeAnimatedHelper.API.flushQueue();
|
|
316
322
|
});
|
|
317
323
|
|
|
318
|
-
|
|
324
|
+
useInsertionEffect(() => {
|
|
319
325
|
isUnmountingRef.current = false;
|
|
320
326
|
return () => {
|
|
321
327
|
isUnmountingRef.current = true;
|
|
322
328
|
};
|
|
323
329
|
}, []);
|
|
324
330
|
|
|
325
|
-
|
|
331
|
+
useInsertionEffect(() => {
|
|
326
332
|
node.__attach();
|
|
327
333
|
let drivenAnimationEndedListener: ?EventSubscription = null;
|
|
328
334
|
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* @format
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
import {HostComponent} from '../../../types/public/ReactNativeTypes';
|
|
10
|
+
import {HostInstance} from '../../../types/public/ReactNativeTypes';
|
|
12
11
|
import {EmitterSubscription} from '../../vendor/emitter/EventEmitter';
|
|
13
12
|
|
|
14
13
|
type AccessibilityChangeEventName =
|
|
@@ -17,6 +16,8 @@ type AccessibilityChangeEventName =
|
|
|
17
16
|
| 'grayscaleChanged' // iOS-only Event
|
|
18
17
|
| 'invertColorsChanged' // iOS-only Event
|
|
19
18
|
| 'reduceMotionChanged'
|
|
19
|
+
| 'highTextContrastChanged' // Android-only Event
|
|
20
|
+
| 'darkerSystemColorsChanged' // iOS-only Event
|
|
20
21
|
| 'screenReaderChanged'
|
|
21
22
|
| 'reduceTransparencyChanged'; // iOS-only Event
|
|
22
23
|
|
|
@@ -69,6 +70,21 @@ export interface AccessibilityInfoStatic {
|
|
|
69
70
|
*/
|
|
70
71
|
isReduceMotionEnabled: () => Promise<boolean>;
|
|
71
72
|
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* Query whether high text contrast is currently enabled.
|
|
76
|
+
*
|
|
77
|
+
* @platform android
|
|
78
|
+
*/
|
|
79
|
+
isHighTextContrastEnabled: () => Promise<boolean>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Query whether darker system colors is currently enabled.
|
|
83
|
+
*
|
|
84
|
+
* @platform ios
|
|
85
|
+
*/
|
|
86
|
+
isDarkerSystemColorsEnabled: () => Promise<boolean>;
|
|
87
|
+
|
|
72
88
|
/**
|
|
73
89
|
* Query whether reduce motion and prefer cross-fade transitions settings are currently enabled.
|
|
74
90
|
*
|
|
@@ -152,7 +168,7 @@ export interface AccessibilityInfoStatic {
|
|
|
152
168
|
*/
|
|
153
169
|
getRecommendedTimeoutMillis: (originalTimeout: number) => Promise<number>;
|
|
154
170
|
sendAccessibilityEvent: (
|
|
155
|
-
handle:
|
|
171
|
+
handle: HostInstance,
|
|
156
172
|
eventType: AccessibilityEventTypes,
|
|
157
173
|
) => void;
|
|
158
174
|
}
|
|
@@ -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
|
+
));
|