@office-iss/react-native-win32 0.81.2 → 0.82.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/.flowconfig +3 -11
- package/CHANGELOG.json +118 -43
- package/CHANGELOG.md +45 -27
- package/IntegrationTests/IntegrationTestsApp.js +2 -2
- package/IntegrationTests/LayoutEventsTest.js +3 -3
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +7 -3
- package/Libraries/Alert/RCTAlertManager.android.js +4 -2
- package/Libraries/Animated/Animated.d.ts +2 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedExports.js.flow +1 -0
- package/Libraries/Animated/AnimatedImplementation.js +4 -2
- package/Libraries/Animated/AnimatedMock.js +1 -1
- package/Libraries/Animated/Easing.js +2 -0
- package/Libraries/Animated/NativeAnimatedAllowlist.js +1 -0
- package/Libraries/Animated/animations/Animation.js +19 -20
- package/Libraries/Animated/animations/TimingAnimation.js +2 -0
- package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
- package/Libraries/Animated/components/AnimatedSectionList.js +1 -1
- package/Libraries/Animated/nodes/AnimatedColor.js +9 -9
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -4
- package/Libraries/Animated/nodes/AnimatedNode.js +14 -7
- package/Libraries/Animated/nodes/AnimatedObject.js +7 -7
- package/Libraries/Animated/nodes/AnimatedProps.js +32 -32
- package/Libraries/Animated/nodes/AnimatedStyle.js +23 -21
- package/Libraries/Animated/nodes/AnimatedTransform.js +6 -6
- package/Libraries/Animated/nodes/AnimatedValue.js +18 -26
- package/Libraries/AppState/AppState.js +8 -4
- package/Libraries/BatchedBridge/BatchedBridge.js +1 -0
- package/Libraries/BatchedBridge/MessageQueue.js +5 -0
- package/Libraries/BatchedBridge/NativeModules.js +1 -1
- package/Libraries/Blob/BlobManager.js +1 -1
- package/Libraries/Blob/URLSearchParams.js +2 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -2
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.win32.js +1 -1
- package/Libraries/Components/Pressable/Pressable.js +10 -1
- package/Libraries/Components/Pressable/Pressable.win32.js +9 -0
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +13 -4
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +2 -2
- package/Libraries/Components/Switch/Switch.js +1 -1
- package/Libraries/Components/TextInput/TextInput.flow.js +12 -5
- package/Libraries/Components/TextInput/TextInput.flow.win32.js +12 -5
- package/Libraries/Components/TextInput/TextInput.js +14 -5
- package/Libraries/Components/TextInput/TextInput.win32.js +15 -7
- package/Libraries/Components/TextInput/TextInputState.js +1 -1
- package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +2 -3
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableOpacity.js +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.js +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +3 -3
- package/Libraries/Components/View/View.js +81 -167
- package/Libraries/Components/View/View.win32.js +3 -1
- package/Libraries/Core/Devtools/loadBundleFromServer.js +1 -1
- package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +1 -1
- package/Libraries/Core/ExceptionsManager.js +4 -2
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
- package/Libraries/Core/ReactNativeVersion.js +37 -10
- package/Libraries/Core/Timers/JSTimers.js +4 -1
- package/Libraries/Core/Timers/NativeTiming.js +1 -0
- package/Libraries/Core/Timers/immediateShim.js +2 -1
- package/Libraries/Core/Timers/queueMicrotask.js +1 -0
- package/Libraries/Core/setUpPerformance.js +3 -4
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +5 -3
- package/Libraries/Image/Image.android.js +327 -111
- package/Libraries/Image/Image.ios.js +6 -1
- package/Libraries/Image/Image.win32.js +6 -1
- package/Libraries/Image/ImageSourceUtils.js +8 -2
- package/Libraries/Image/assetPaths.js +1 -1
- package/Libraries/Image/resolveAssetSource.js +1 -1
- package/Libraries/Image/resolveAssetSource.win32.js +6 -7
- package/Libraries/Interaction/InteractionManager.js +118 -167
- package/Libraries/Interaction/PanResponder.js +7 -52
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -0
- package/Libraries/Lists/FlatList.js +5 -6
- package/Libraries/LogBox/Data/LogBoxData.js +5 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +2 -2
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +1 -1
- package/Libraries/Modal/Modal.js +3 -3
- package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
- package/Libraries/NativeComponent/ViewConfig.js +2 -2
- package/Libraries/Network/RCTNetworking.android.js +1 -1
- package/Libraries/Network/RCTNetworking.ios.js +1 -1
- package/Libraries/Network/RCTNetworking.win32.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +20 -5
- package/Libraries/Network/convertRequestBody.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +10 -9
- package/Libraries/Pressability/HoverState.js +2 -0
- package/Libraries/Pressability/HoverState.win32.js +2 -0
- package/Libraries/Pressability/Pressability.js +1 -1
- package/Libraries/Pressability/Pressability.win32.js +1 -1
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +2 -2
- package/Libraries/ReactNative/AppRegistryImpl.js +4 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +3 -3
- package/Libraries/ReactNative/RendererImplementation.js +116 -116
- package/Libraries/ReactNative/UIManager.js +3 -3
- package/Libraries/ReactNative/renderApplication.js +1 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +38 -35
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +51 -22
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +54 -24
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +36 -33
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5 -5
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +5 -5
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
- package/Libraries/Share/Share.js +4 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +2 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +4 -0
- package/Libraries/StyleSheet/StyleSheet.d.ts +7 -22
- package/Libraries/StyleSheet/StyleSheetExports.js +2 -8
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +11 -18
- package/Libraries/StyleSheet/flattenStyle.js +2 -2
- package/Libraries/StyleSheet/processAspectRatio.js +2 -0
- package/Libraries/StyleSheet/processFilter.js +5 -5
- package/Libraries/StyleSheet/splitLayoutProps.js +2 -2
- package/Libraries/Text/Text.js +534 -234
- package/Libraries/Text/Text.win32.js +647 -274
- package/Libraries/Text/TextNativeComponent.js +2 -2
- package/Libraries/Text/TextNativeComponent.win32.js +2 -2
- package/Libraries/Utilities/Appearance.d.ts +3 -5
- package/Libraries/Utilities/Appearance.js +5 -17
- package/Libraries/Utilities/HMRClient.js +2 -1
- package/Libraries/Utilities/Platform.android.js +3 -3
- package/Libraries/Utilities/Platform.d.ts +1 -0
- package/Libraries/Utilities/Platform.ios.js +1 -1
- package/Libraries/Utilities/Platform.win32.js +3 -3
- package/Libraries/Utilities/PlatformTypes.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +12 -0
- package/Libraries/Utilities/SceneTracker.js +1 -1
- package/Libraries/Utilities/codegenNativeCommands.js +1 -1
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +32 -0
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
- package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
- package/Libraries/Utilities/useMergeRefs.js +1 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +2 -0
- package/Libraries/promiseRejectionTrackingOptions.js +17 -31
- package/Libraries/vendor/emitter/EventEmitter.js +1 -1
- package/flow/bom.js.flow +223 -1
- package/flow/prettier.js.flow +14 -0
- package/index.js +14 -2
- package/index.win32.js +16 -2
- package/jest/local-setup.js +2 -2
- package/jest/mock.js +1 -1
- package/jest/mockComponent.js +9 -9
- package/jest/mockNativeComponent.js +3 -2
- package/jest/mocks/Modal.js +1 -1
- package/jest/mocks/ScrollView.js +1 -1
- package/jest/mocks/ViewNativeComponent.js +1 -1
- package/jest/setup.js +23 -12
- package/overrides.json +23 -23
- package/package.json +28 -27
- package/saveAssetPlugin.js +2 -2
- package/src/private/animated/NativeAnimatedHelper.js +16 -5
- package/src/private/animated/NativeAnimatedHelper.win32.js +16 -5
- package/src/private/animated/createAnimatedPropsHook.js +11 -60
- package/src/private/animated/createAnimatedPropsMemoHook.js +8 -54
- package/src/private/components/virtualview/VirtualView.js +43 -12
- package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +93 -0
- package/src/private/components/virtualview/VirtualViewNativeComponent.js +6 -0
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +2 -2
- package/src/private/devsupport/devmenu/elementinspector/ReactDevToolsOverlay.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +85 -52
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +15 -6
- package/src/private/renderer/errorhandling/ErrorHandlers.js +3 -3
- package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
- package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
- package/src/private/types/HostInstance.js +4 -1
- package/src/private/webapis/dom/nodes/ReactNativeDocument.js +22 -2
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +5 -3
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +16 -13
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +45 -22
- package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +26 -192
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +15 -12
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +14 -11
- package/src/private/webapis/geometry/DOMRectList.js +2 -2
- package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +19 -74
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +0 -4
- package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
- package/src/private/webapis/performance/EventTiming.js +40 -25
- package/src/private/webapis/performance/LongTasks.js +35 -2
- package/src/private/webapis/performance/Performance.js +347 -166
- package/src/private/webapis/performance/PerformanceEntry.js +40 -23
- package/src/private/webapis/performance/PerformanceObserver.js +37 -29
- package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
- package/src/private/webapis/performance/ResourceTiming.js +29 -18
- package/src/private/webapis/performance/UserTiming.js +92 -34
- package/src/private/webapis/performance/UserTimingExtensibility.js.flow +38 -0
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
- package/src/private/webapis/performance/internals/Utilities.js +9 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +23 -23
- package/src/private/webapis/structuredClone/structuredClone.js +10 -10
- package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
- package/Libraries/Interaction/InteractionManagerStub.js +0 -184
- package/Libraries/Interaction/TaskQueue.js +0 -183
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -31
|
@@ -16,9 +16,8 @@ import {AnimatedEvent} from '../../../Libraries/Animated/AnimatedEvent';
|
|
|
16
16
|
import AnimatedNode from '../../../Libraries/Animated/nodes/AnimatedNode';
|
|
17
17
|
import {isPlainObject} from '../../../Libraries/Animated/nodes/AnimatedObject';
|
|
18
18
|
import flattenStyle from '../../../Libraries/StyleSheet/flattenStyle';
|
|
19
|
-
import * as ReactNativeFeatureFlags from '../featureflags/ReactNativeFeatureFlags';
|
|
20
19
|
import nullthrows from 'nullthrows';
|
|
21
|
-
import {useInsertionEffect, useMemo, useRef
|
|
20
|
+
import {useInsertionEffect, useMemo, useRef} from 'react';
|
|
22
21
|
|
|
23
22
|
type CompositeKey = {
|
|
24
23
|
style?: {[string]: CompositeKeyComponent},
|
|
@@ -64,19 +63,6 @@ export function createAnimatedPropsMemoHook(
|
|
|
64
63
|
return function useAnimatedPropsMemo(
|
|
65
64
|
create: () => AnimatedProps,
|
|
66
65
|
props: $ReadOnly<{[string]: mixed}>,
|
|
67
|
-
): AnimatedProps {
|
|
68
|
-
// NOTE: This feature flag must be evaluated inside the hook because this
|
|
69
|
-
// module factory can be evaluated much sooner, before overrides are set.
|
|
70
|
-
const useAnimatedPropsImpl =
|
|
71
|
-
ReactNativeFeatureFlags.avoidStateUpdateInAnimatedPropsMemo()
|
|
72
|
-
? useAnimatedPropsMemo_ref
|
|
73
|
-
: useAnimatedPropsMemo_state;
|
|
74
|
-
return useAnimatedPropsImpl(create, props);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
function useAnimatedPropsMemo_ref(
|
|
78
|
-
create: () => AnimatedProps,
|
|
79
|
-
props: $ReadOnly<{[string]: mixed}>,
|
|
80
66
|
): AnimatedProps {
|
|
81
67
|
const compositeKey = useMemo(
|
|
82
68
|
() => createCompositeKeyForProps(props, allowlist),
|
|
@@ -102,39 +88,7 @@ export function createAnimatedPropsMemoHook(
|
|
|
102
88
|
}, [next]);
|
|
103
89
|
|
|
104
90
|
return next.node;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function useAnimatedPropsMemo_state(
|
|
108
|
-
create: () => AnimatedProps,
|
|
109
|
-
props: $ReadOnly<{[string]: mixed}>,
|
|
110
|
-
): AnimatedProps {
|
|
111
|
-
const compositeKey = useMemo(
|
|
112
|
-
() => createCompositeKeyForProps(props, allowlist),
|
|
113
|
-
[props],
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
const [state, setState] = useState<{
|
|
117
|
-
allowlist: ?AnimatedPropsAllowlist,
|
|
118
|
-
compositeKey: $ReadOnlyCompositeKey | null,
|
|
119
|
-
value: AnimatedProps,
|
|
120
|
-
}>(() => ({
|
|
121
|
-
allowlist,
|
|
122
|
-
compositeKey,
|
|
123
|
-
value: create(),
|
|
124
|
-
}));
|
|
125
|
-
|
|
126
|
-
if (
|
|
127
|
-
state.allowlist !== allowlist ||
|
|
128
|
-
!areCompositeKeysEqual(state.compositeKey, compositeKey)
|
|
129
|
-
) {
|
|
130
|
-
setState({
|
|
131
|
-
allowlist,
|
|
132
|
-
compositeKey,
|
|
133
|
-
value: create(),
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
return state.value;
|
|
137
|
-
}
|
|
91
|
+
};
|
|
138
92
|
}
|
|
139
93
|
|
|
140
94
|
/**
|
|
@@ -310,9 +264,9 @@ export function areCompositeKeysEqual(
|
|
|
310
264
|
// We know style components are objects with non-mixed values.
|
|
311
265
|
if (
|
|
312
266
|
!areCompositeKeyComponentsEqual(
|
|
313
|
-
// $
|
|
267
|
+
// $FlowFixMe[incompatible-type]
|
|
314
268
|
prevComponent as $ReadOnlyCompositeKeyComponent,
|
|
315
|
-
// $
|
|
269
|
+
// $FlowFixMe[incompatible-type]
|
|
316
270
|
nextComponent as $ReadOnlyCompositeKeyComponent,
|
|
317
271
|
)
|
|
318
272
|
) {
|
|
@@ -335,9 +289,9 @@ export function areCompositeKeysEqual(
|
|
|
335
289
|
} else {
|
|
336
290
|
if (
|
|
337
291
|
!areCompositeKeyComponentsEqual(
|
|
338
|
-
// $
|
|
292
|
+
// $FlowFixMe[incompatible-type]
|
|
339
293
|
prevComponent as $ReadOnlyCompositeKeyComponent,
|
|
340
|
-
// $
|
|
294
|
+
// $FlowFixMe[incompatible-type]
|
|
341
295
|
nextComponent as $ReadOnlyCompositeKeyComponent,
|
|
342
296
|
)
|
|
343
297
|
) {
|
|
@@ -399,8 +353,8 @@ function areCompositeKeyComponentsEqual(
|
|
|
399
353
|
|
|
400
354
|
// Supported versions of JSC do not implement the newer Object.hasOwn. Remove
|
|
401
355
|
// this shim when they do.
|
|
402
|
-
// $
|
|
356
|
+
// $FlowFixMe[method-unbinding]
|
|
403
357
|
const _hasOwnProp = Object.prototype.hasOwnProperty;
|
|
404
358
|
const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
|
|
405
|
-
// $
|
|
359
|
+
// $FlowFixMe[method-unbinding]
|
|
406
360
|
Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
|
|
@@ -10,14 +10,17 @@
|
|
|
10
10
|
|
|
11
11
|
import type {ViewStyleProp} from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
12
12
|
import type {NativeSyntheticEvent} from '../../../../Libraries/Types/CoreEventTypes';
|
|
13
|
-
import type
|
|
13
|
+
import type {HostInstance} from '../../types/HostInstance';
|
|
14
14
|
import type {NativeModeChangeEvent} from './VirtualViewNativeComponent';
|
|
15
15
|
|
|
16
16
|
import StyleSheet from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
17
|
+
import * as ReactNativeFeatureFlags from '../../featureflags/ReactNativeFeatureFlags';
|
|
18
|
+
import VirtualViewExperimentalNativeComponent from './VirtualViewExperimentalNativeComponent';
|
|
17
19
|
import VirtualViewNativeComponent from './VirtualViewNativeComponent';
|
|
18
20
|
import nullthrows from 'nullthrows';
|
|
19
21
|
import * as React from 'react';
|
|
20
|
-
|
|
22
|
+
// $FlowFixMe[missing-export]
|
|
23
|
+
import {startTransition, unstable_Activity as Activity, useState} from 'react';
|
|
21
24
|
|
|
22
25
|
// @see VirtualViewNativeComponent
|
|
23
26
|
export enum VirtualViewMode {
|
|
@@ -43,7 +46,7 @@ export type Rect = $ReadOnly<{
|
|
|
43
46
|
export type ModeChangeEvent = $ReadOnly<{
|
|
44
47
|
...Omit<NativeModeChangeEvent, 'mode'>,
|
|
45
48
|
mode: VirtualViewMode,
|
|
46
|
-
target:
|
|
49
|
+
target: HostInstance,
|
|
47
50
|
}>;
|
|
48
51
|
|
|
49
52
|
type VirtualViewComponent = component(
|
|
@@ -52,6 +55,7 @@ type VirtualViewComponent = component(
|
|
|
52
55
|
ref?: ?React.RefSetter<React.ElementRef<typeof VirtualViewNativeComponent>>,
|
|
53
56
|
style?: ?ViewStyleProp,
|
|
54
57
|
onModeChange?: (event: ModeChangeEvent) => void,
|
|
58
|
+
removeClippedSubviews?: boolean,
|
|
55
59
|
);
|
|
56
60
|
|
|
57
61
|
type HiddenHeight = number;
|
|
@@ -59,15 +63,23 @@ const NotHidden = null;
|
|
|
59
63
|
|
|
60
64
|
type State = HiddenHeight | typeof NotHidden;
|
|
61
65
|
|
|
62
|
-
function createVirtualView(
|
|
66
|
+
function createVirtualView(
|
|
67
|
+
initialState: State,
|
|
68
|
+
experimental: boolean,
|
|
69
|
+
): VirtualViewComponent {
|
|
63
70
|
const initialHidden = initialState !== NotHidden;
|
|
64
71
|
|
|
72
|
+
const NativeComponent = experimental
|
|
73
|
+
? VirtualViewExperimentalNativeComponent
|
|
74
|
+
: VirtualViewNativeComponent;
|
|
75
|
+
|
|
65
76
|
component VirtualView(
|
|
66
77
|
children?: React.Node,
|
|
67
78
|
nativeID?: string,
|
|
68
79
|
ref?: ?React.RefSetter<React.ElementRef<typeof VirtualViewNativeComponent>>,
|
|
69
80
|
style?: ?ViewStyleProp,
|
|
70
81
|
onModeChange?: (event: ModeChangeEvent) => void,
|
|
82
|
+
removeClippedSubviews?: boolean,
|
|
71
83
|
) {
|
|
72
84
|
const [state, setState] = useState<State>(initialState);
|
|
73
85
|
if (__DEV__) {
|
|
@@ -84,8 +96,8 @@ function createVirtualView(initialState: State): VirtualViewComponent {
|
|
|
84
96
|
? null
|
|
85
97
|
: onModeChange.bind(null, {
|
|
86
98
|
mode,
|
|
87
|
-
// $
|
|
88
|
-
target: event.currentTarget as
|
|
99
|
+
// $FlowFixMe[incompatible-type] - we know this is a HostInstance
|
|
100
|
+
target: event.currentTarget as HostInstance,
|
|
89
101
|
targetRect: event.nativeEvent.targetRect,
|
|
90
102
|
thresholdRect: event.nativeEvent.thresholdRect,
|
|
91
103
|
});
|
|
@@ -112,10 +124,11 @@ function createVirtualView(initialState: State): VirtualViewComponent {
|
|
|
112
124
|
};
|
|
113
125
|
|
|
114
126
|
return (
|
|
115
|
-
<
|
|
127
|
+
<NativeComponent
|
|
116
128
|
initialHidden={initialHidden}
|
|
117
129
|
nativeID={nativeID}
|
|
118
130
|
ref={ref}
|
|
131
|
+
removeClippedSubviews={removeClippedSubviews}
|
|
119
132
|
renderState={
|
|
120
133
|
(isHidden
|
|
121
134
|
? VirtualViewRenderState.None
|
|
@@ -129,17 +142,35 @@ function createVirtualView(initialState: State): VirtualViewComponent {
|
|
|
129
142
|
: style
|
|
130
143
|
}
|
|
131
144
|
onModeChange={handleModeChange}>
|
|
132
|
-
{
|
|
133
|
-
|
|
145
|
+
{
|
|
146
|
+
match (ReactNativeFeatureFlags.virtualViewActivityBehavior()) {
|
|
147
|
+
'activity-without-mode' =>
|
|
148
|
+
<Activity>{isHidden ? null : children}</Activity>,
|
|
149
|
+
'activity-with-hidden-mode' =>
|
|
150
|
+
<Activity mode={isHidden ? 'hidden' : 'visible'}>
|
|
151
|
+
{children}
|
|
152
|
+
</Activity>,
|
|
153
|
+
'no-activity' | _ => isHidden ? null : children,
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
</NativeComponent>
|
|
134
157
|
);
|
|
135
158
|
}
|
|
136
159
|
return VirtualView;
|
|
137
160
|
}
|
|
138
161
|
|
|
139
|
-
export default createVirtualView(NotHidden) as VirtualViewComponent;
|
|
162
|
+
export default createVirtualView(NotHidden, false) as VirtualViewComponent;
|
|
140
163
|
|
|
141
|
-
export
|
|
142
|
-
|
|
164
|
+
export const VirtualViewExperimental = createVirtualView(
|
|
165
|
+
NotHidden,
|
|
166
|
+
true,
|
|
167
|
+
) as VirtualViewComponent;
|
|
168
|
+
|
|
169
|
+
export function createHiddenVirtualView(
|
|
170
|
+
height: number,
|
|
171
|
+
experimental: boolean,
|
|
172
|
+
): VirtualViewComponent {
|
|
173
|
+
return createVirtualView(height as HiddenHeight, experimental);
|
|
143
174
|
}
|
|
144
175
|
|
|
145
176
|
export const _logs: {states?: Array<State>} = {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
+
import type {
|
|
13
|
+
DirectEventHandler,
|
|
14
|
+
Double,
|
|
15
|
+
Int32,
|
|
16
|
+
} from '../../../../Libraries/Types/CodegenTypes';
|
|
17
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
18
|
+
|
|
19
|
+
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
20
|
+
|
|
21
|
+
export type NativeModeChangeEvent = $ReadOnly<{
|
|
22
|
+
/**
|
|
23
|
+
* Virtualization mode of the target view.
|
|
24
|
+
*
|
|
25
|
+
* - `0`: Target view is visible.
|
|
26
|
+
* - `1`: Target view is hidden, but can be prerendered.
|
|
27
|
+
* - `2`: Target view is hidden.
|
|
28
|
+
*
|
|
29
|
+
* WORKAROUND: As of this writing, codegen doesn't support enums, so we need
|
|
30
|
+
* to convert `number` into an enum in `VirtualView`.
|
|
31
|
+
*/
|
|
32
|
+
mode: Int32,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Rect of the target view, relative to the nearest ancestor scroll container.
|
|
36
|
+
*/
|
|
37
|
+
targetRect: $ReadOnly<{
|
|
38
|
+
x: Double,
|
|
39
|
+
y: Double,
|
|
40
|
+
width: Double,
|
|
41
|
+
height: Double,
|
|
42
|
+
}>,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Rect of the threshold that determines the mode of the target view, relative
|
|
46
|
+
* to the nearest ancestor scroll container.
|
|
47
|
+
*
|
|
48
|
+
* - `Visible`: Rect in which the target view is visible.
|
|
49
|
+
* - `Prerender`: Rect in which the target view is prerendered.
|
|
50
|
+
* - `Hidden`: Unused, without any guarantees.
|
|
51
|
+
*
|
|
52
|
+
* This can be used to determine whether and how much new content to render.
|
|
53
|
+
*/
|
|
54
|
+
thresholdRect: $ReadOnly<{
|
|
55
|
+
x: Double,
|
|
56
|
+
y: Double,
|
|
57
|
+
width: Double,
|
|
58
|
+
height: Double,
|
|
59
|
+
}>,
|
|
60
|
+
}>;
|
|
61
|
+
|
|
62
|
+
type VirtualViewExperimentalNativeProps = $ReadOnly<{
|
|
63
|
+
...ViewProps,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Whether the initial mode should be `Hidden`.
|
|
67
|
+
*/
|
|
68
|
+
initialHidden?: boolean,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Render state of children.
|
|
72
|
+
*
|
|
73
|
+
* - `0`: Reserved to represent unknown future values.
|
|
74
|
+
* - `1`: Children are rendered.
|
|
75
|
+
* - `2`: Children are not rendered.
|
|
76
|
+
*
|
|
77
|
+
* WORKAROUND: As of this writing, codegen doesn't support enums, so we need
|
|
78
|
+
* to convert `number` into an enum in `VirtualView`.
|
|
79
|
+
*/
|
|
80
|
+
renderState: Int32,
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* See `NativeModeChangeEvent`.
|
|
84
|
+
*/
|
|
85
|
+
onModeChange?: ?DirectEventHandler<NativeModeChangeEvent>,
|
|
86
|
+
}>;
|
|
87
|
+
|
|
88
|
+
export default codegenNativeComponent<VirtualViewExperimentalNativeProps>(
|
|
89
|
+
'VirtualViewExperimental',
|
|
90
|
+
{
|
|
91
|
+
interfaceOnly: true,
|
|
92
|
+
},
|
|
93
|
+
) as HostComponent<VirtualViewExperimentalNativeProps>;
|
|
@@ -67,6 +67,12 @@ type VirtualViewNativeProps = $ReadOnly<{
|
|
|
67
67
|
*/
|
|
68
68
|
initialHidden?: boolean,
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* This was needed to get VirtualViewManagerDelegate to set this property.
|
|
72
|
+
* TODO: Investigate why spread ViewProps doesn't call setter
|
|
73
|
+
*/
|
|
74
|
+
removeClippedSubviews?: boolean,
|
|
75
|
+
|
|
70
76
|
/**
|
|
71
77
|
* Render state of children.
|
|
72
78
|
*
|
|
@@ -82,7 +82,7 @@ function Inspector({
|
|
|
82
82
|
const {measure, props} = hierarchyItem.getInspectorData(findNodeHandle);
|
|
83
83
|
|
|
84
84
|
measure((x, y, width, height, left, top) => {
|
|
85
|
-
// $FlowFixMe[incompatible-
|
|
85
|
+
// $FlowFixMe[incompatible-type] `props` from InspectorData are defined as <string, string> dictionary, which is incompatible with ViewStyleProp
|
|
86
86
|
setInspectedElement({
|
|
87
87
|
frame: {left, top, width, height},
|
|
88
88
|
style: props.style,
|
|
@@ -119,7 +119,7 @@ function Inspector({
|
|
|
119
119
|
);
|
|
120
120
|
setSelectionIndex(selectedIndex);
|
|
121
121
|
setElementsHierarchy(hierarchy);
|
|
122
|
-
// $FlowFixMe[incompatible-
|
|
122
|
+
// $FlowFixMe[incompatible-type] `props` from InspectorData are defined as <string, string> dictionary, which is incompatible with ViewStyleProp
|
|
123
123
|
setInspectedElement({
|
|
124
124
|
frame,
|
|
125
125
|
style: props.style,
|
|
@@ -15,8 +15,8 @@ import type {ReactDevToolsAgent} from '../../../../../Libraries/Types/ReactDevTo
|
|
|
15
15
|
import type {InspectedElement} from './Inspector';
|
|
16
16
|
|
|
17
17
|
import View from '../../../../../Libraries/Components/View/View';
|
|
18
|
-
import ReactNativeFeatureFlags from '../../../../../Libraries/ReactNative/ReactNativeFeatureFlags';
|
|
19
18
|
import StyleSheet from '../../../../../Libraries/StyleSheet/StyleSheet';
|
|
19
|
+
import * as ReactNativeFeatureFlags from '../../../../../src/private/featureflags/ReactNativeFeatureFlags';
|
|
20
20
|
import ElementBox from './ElementBox';
|
|
21
21
|
import * as React from 'react';
|
|
22
22
|
|
|
@@ -129,7 +129,7 @@ export default function ReactDevToolsOverlay({
|
|
|
129
129
|
if (isInspecting) {
|
|
130
130
|
const events =
|
|
131
131
|
// Pointer events only work on fabric
|
|
132
|
-
ReactNativeFeatureFlags.
|
|
132
|
+
ReactNativeFeatureFlags.shouldPressibilityUseW3CPointerEventsForHover()
|
|
133
133
|
? {
|
|
134
134
|
onPointerMove,
|
|
135
135
|
onPointerDown: onPointerMove,
|