@office-iss/react-native-win32 0.0.0-canary.302 → 0.0.0-canary.303
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 +2 -2
- package/CHANGELOG.json +28 -1
- package/CHANGELOG.md +15 -5
- package/IntegrationTests/IntegrationTestsApp.js +1 -1
- package/IntegrationTests/LayoutEventsTest.js +3 -3
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +3 -3
- package/Libraries/Alert/RCTAlertManager.android.js +2 -2
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +2 -2
- package/Libraries/Animated/AnimatedMock.js +1 -1
- package/Libraries/Animated/NativeAnimatedAllowlist.js +1 -0
- package/Libraries/Animated/animations/Animation.js +5 -6
- package/Libraries/Animated/components/AnimatedScrollView.js +1 -1
- package/Libraries/Animated/nodes/AnimatedColor.js +9 -9
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -4
- package/Libraries/Animated/nodes/AnimatedProps.js +2 -2
- package/Libraries/Animated/nodes/AnimatedStyle.js +6 -4
- package/Libraries/Animated/nodes/AnimatedTransform.js +1 -1
- package/Libraries/AppState/AppState.js +5 -1
- package/Libraries/BatchedBridge/NativeModules.js +1 -1
- package/Libraries/Blob/BlobManager.js +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.win32.js +1 -1
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +3 -2
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.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 +9 -4
- package/Libraries/Components/TextInput/TextInput.win32.js +9 -6
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +2 -3
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -1
- 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 +2 -2
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/Timers/JSTimers.js +1 -1
- package/Libraries/Core/Timers/immediateShim.js +1 -1
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +5 -3
- package/Libraries/Image/Image.android.js +318 -111
- package/Libraries/Image/ImageSourceUtils.js +8 -2
- package/Libraries/Image/resolveAssetSource.js +1 -1
- package/Libraries/Interaction/InteractionManager.js +1 -1
- package/Libraries/Interaction/PanResponder.js +1 -1
- package/Libraries/Lists/FlatList.js +5 -6
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +1 -1
- package/Libraries/Modal/Modal.js +2 -2
- package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
- package/Libraries/NativeComponent/ViewConfig.js +1 -1
- 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/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/PushNotificationIOS/PushNotificationIOS.js +2 -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/ReactPrivate/ReactNativePrivateInterface.js +1 -1
- package/Libraries/Renderer/shims/ReactFabric.js +1 -3
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +1 -3
- package/Libraries/Renderer/shims/ReactNative.js +1 -3
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +1 -3
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +1 -3
- 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/flattenStyle.js +2 -2
- package/Libraries/StyleSheet/splitLayoutProps.js +2 -2
- package/Libraries/Text/Text.js +509 -235
- package/Libraries/Text/Text.win32.js +622 -275
- package/Libraries/Text/TextNativeComponent.js +2 -2
- package/Libraries/Text/TextNativeComponent.win32.js +2 -2
- package/Libraries/Utilities/HMRClient.js +0 -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/codegenNativeCommands.js +1 -1
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.js +1 -1
- package/index.js +3 -0
- package/index.win32.js +4 -0
- package/jest/local-setup.js +2 -2
- package/jest/mock.js +1 -1
- package/jest/mockComponent.js +8 -8
- 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 +12 -12
- package/overrides.json +16 -16
- package/package.json +12 -12
- package/src/private/animated/NativeAnimatedHelper.js +3 -3
- package/src/private/animated/NativeAnimatedHelper.win32.js +3 -3
- package/src/private/animated/createAnimatedPropsHook.js +9 -11
- package/src/private/animated/createAnimatedPropsMemoHook.js +6 -6
- package/src/private/components/virtualview/VirtualView.js +7 -4
- package/src/private/components/virtualview/VirtualViewNativeComponent.js +6 -0
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +9 -8
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +1 -2
- package/src/private/renderer/errorhandling/ErrorHandlers.js +3 -3
- 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 +14 -11
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +13 -10
- package/src/private/webapis/geometry/DOMRectList.js +1 -1
- package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +1 -1
- package/src/private/webapis/performance/EventTiming.js +1 -1
- package/src/private/webapis/performance/Performance.js +12 -30
- package/src/private/webapis/performance/specs/NativePerformance.js +4 -4
- package/src/private/webapis/structuredClone/structuredClone.js +9 -9
|
@@ -127,7 +127,7 @@ function createNativeOperations(): $NonMaybeType<typeof NativeAnimatedModule> {
|
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
// $FlowExpectedError[incompatible-
|
|
130
|
+
// $FlowExpectedError[incompatible-type] - Dynamism.
|
|
131
131
|
return nativeOperations;
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -145,7 +145,7 @@ const API = {
|
|
|
145
145
|
if (saveValueCallback) {
|
|
146
146
|
eventListenerGetValueCallbacks[tag] = saveValueCallback;
|
|
147
147
|
}
|
|
148
|
-
/* $FlowExpectedError[incompatible-
|
|
148
|
+
/* $FlowExpectedError[incompatible-type] - `saveValueCallback` is handled
|
|
149
149
|
differently when `isSingleOpBatching` is enabled. */
|
|
150
150
|
NativeOperations.getValue(tag);
|
|
151
151
|
}
|
|
@@ -274,7 +274,7 @@ const API = {
|
|
|
274
274
|
if (endCallback) {
|
|
275
275
|
eventListenerAnimationFinishedCallbacks[animationId] = endCallback;
|
|
276
276
|
}
|
|
277
|
-
/* $FlowExpectedError[incompatible-
|
|
277
|
+
/* $FlowExpectedError[incompatible-type] - `endCallback` is handled
|
|
278
278
|
differently when `isSingleOpBatching` is enabled. */
|
|
279
279
|
NativeOperations.startAnimatingNode(animationId, nodeTag, config);
|
|
280
280
|
}
|
|
@@ -108,7 +108,7 @@ export default function createAnimatedPropsHook(
|
|
|
108
108
|
(instance: TInstance) => {
|
|
109
109
|
// NOTE: This may be called more often than necessary (e.g. when `props`
|
|
110
110
|
// changes), but `setNativeView` already optimizes for that.
|
|
111
|
-
// $FlowFixMe[incompatible-
|
|
111
|
+
// $FlowFixMe[incompatible-type]
|
|
112
112
|
node.setNativeView(instance);
|
|
113
113
|
|
|
114
114
|
// NOTE: When using the JS animation driver, this callback is called on
|
|
@@ -125,13 +125,11 @@ export default function createAnimatedPropsHook(
|
|
|
125
125
|
if (node.__isNative) {
|
|
126
126
|
// Check 2: this is an animation driven by native.
|
|
127
127
|
// In native driven animations, this callback is only called once the animation completes.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
!(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
)
|
|
134
|
-
) {
|
|
128
|
+
const shouldRemoveJsSync =
|
|
129
|
+
ReactNativeFeatureFlags.cxxNativeAnimatedEnabled() &&
|
|
130
|
+
!ReactNativeFeatureFlags.disableFabricCommitInCXXAnimated() &&
|
|
131
|
+
ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync();
|
|
132
|
+
if (isFabricNode && !shouldRemoveJsSync) {
|
|
135
133
|
// Call `scheduleUpdate` to synchronise Fiber and Shadow tree.
|
|
136
134
|
// Must not be called in Paper.
|
|
137
135
|
scheduleUpdate();
|
|
@@ -149,7 +147,7 @@ export default function createAnimatedPropsHook(
|
|
|
149
147
|
|
|
150
148
|
if (!isFabricNode) {
|
|
151
149
|
// Check 4: this is a paper instance, call setNativeProps.
|
|
152
|
-
// $
|
|
150
|
+
// $FlowFixMe[not-a-function] - Assume it's still a function.
|
|
153
151
|
// $FlowFixMe[incompatible-use]
|
|
154
152
|
return instance.setNativeProps(node.__getAnimatedValue());
|
|
155
153
|
}
|
|
@@ -161,7 +159,7 @@ export default function createAnimatedPropsHook(
|
|
|
161
159
|
|
|
162
160
|
// This is a Fabric instance and setNativeProps is supported.
|
|
163
161
|
|
|
164
|
-
// $
|
|
162
|
+
// $FlowFixMe[not-a-function] - Assume it's still a function.
|
|
165
163
|
// $FlowFixMe[incompatible-use]
|
|
166
164
|
instance.setNativeProps(node.__getAnimatedValue());
|
|
167
165
|
|
|
@@ -190,7 +188,7 @@ export default function createAnimatedPropsHook(
|
|
|
190
188
|
|
|
191
189
|
for (const [propName, propValue] of eventTuples) {
|
|
192
190
|
propValue.__attach(target, propName);
|
|
193
|
-
// $FlowFixMe[incompatible-
|
|
191
|
+
// $FlowFixMe[incompatible-type] - the `addListenersToPropsValue` drills down the propValue.
|
|
194
192
|
addListenersToPropsValue(propValue, animatedValueListeners);
|
|
195
193
|
}
|
|
196
194
|
|
|
@@ -264,9 +264,9 @@ export function areCompositeKeysEqual(
|
|
|
264
264
|
// We know style components are objects with non-mixed values.
|
|
265
265
|
if (
|
|
266
266
|
!areCompositeKeyComponentsEqual(
|
|
267
|
-
// $
|
|
267
|
+
// $FlowFixMe[incompatible-type]
|
|
268
268
|
prevComponent as $ReadOnlyCompositeKeyComponent,
|
|
269
|
-
// $
|
|
269
|
+
// $FlowFixMe[incompatible-type]
|
|
270
270
|
nextComponent as $ReadOnlyCompositeKeyComponent,
|
|
271
271
|
)
|
|
272
272
|
) {
|
|
@@ -289,9 +289,9 @@ export function areCompositeKeysEqual(
|
|
|
289
289
|
} else {
|
|
290
290
|
if (
|
|
291
291
|
!areCompositeKeyComponentsEqual(
|
|
292
|
-
// $
|
|
292
|
+
// $FlowFixMe[incompatible-type]
|
|
293
293
|
prevComponent as $ReadOnlyCompositeKeyComponent,
|
|
294
|
-
// $
|
|
294
|
+
// $FlowFixMe[incompatible-type]
|
|
295
295
|
nextComponent as $ReadOnlyCompositeKeyComponent,
|
|
296
296
|
)
|
|
297
297
|
) {
|
|
@@ -353,8 +353,8 @@ function areCompositeKeyComponentsEqual(
|
|
|
353
353
|
|
|
354
354
|
// Supported versions of JSC do not implement the newer Object.hasOwn. Remove
|
|
355
355
|
// this shim when they do.
|
|
356
|
-
// $
|
|
356
|
+
// $FlowFixMe[method-unbinding]
|
|
357
357
|
const _hasOwnProp = Object.prototype.hasOwnProperty;
|
|
358
358
|
const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean =
|
|
359
|
-
// $
|
|
359
|
+
// $FlowFixMe[method-unbinding]
|
|
360
360
|
Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop));
|
|
@@ -10,7 +10,7 @@
|
|
|
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';
|
|
@@ -44,7 +44,7 @@ export type Rect = $ReadOnly<{
|
|
|
44
44
|
export type ModeChangeEvent = $ReadOnly<{
|
|
45
45
|
...Omit<NativeModeChangeEvent, 'mode'>,
|
|
46
46
|
mode: VirtualViewMode,
|
|
47
|
-
target:
|
|
47
|
+
target: HostInstance,
|
|
48
48
|
}>;
|
|
49
49
|
|
|
50
50
|
type VirtualViewComponent = component(
|
|
@@ -53,6 +53,7 @@ type VirtualViewComponent = component(
|
|
|
53
53
|
ref?: ?React.RefSetter<React.ElementRef<typeof VirtualViewNativeComponent>>,
|
|
54
54
|
style?: ?ViewStyleProp,
|
|
55
55
|
onModeChange?: (event: ModeChangeEvent) => void,
|
|
56
|
+
removeClippedSubviews?: boolean,
|
|
56
57
|
);
|
|
57
58
|
|
|
58
59
|
type HiddenHeight = number;
|
|
@@ -76,6 +77,7 @@ function createVirtualView(
|
|
|
76
77
|
ref?: ?React.RefSetter<React.ElementRef<typeof VirtualViewNativeComponent>>,
|
|
77
78
|
style?: ?ViewStyleProp,
|
|
78
79
|
onModeChange?: (event: ModeChangeEvent) => void,
|
|
80
|
+
removeClippedSubviews?: boolean,
|
|
79
81
|
) {
|
|
80
82
|
const [state, setState] = useState<State>(initialState);
|
|
81
83
|
if (__DEV__) {
|
|
@@ -92,8 +94,8 @@ function createVirtualView(
|
|
|
92
94
|
? null
|
|
93
95
|
: onModeChange.bind(null, {
|
|
94
96
|
mode,
|
|
95
|
-
// $
|
|
96
|
-
target: event.currentTarget as
|
|
97
|
+
// $FlowFixMe[incompatible-type] - we know this is a HostInstance
|
|
98
|
+
target: event.currentTarget as HostInstance,
|
|
97
99
|
targetRect: event.nativeEvent.targetRect,
|
|
98
100
|
thresholdRect: event.nativeEvent.thresholdRect,
|
|
99
101
|
});
|
|
@@ -124,6 +126,7 @@ function createVirtualView(
|
|
|
124
126
|
initialHidden={initialHidden}
|
|
125
127
|
nativeID={nativeID}
|
|
126
128
|
ref={ref}
|
|
129
|
+
removeClippedSubviews={removeClippedSubviews}
|
|
127
130
|
renderState={
|
|
128
131
|
(isHidden
|
|
129
132
|
? VirtualViewRenderState.None
|
|
@@ -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,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<f082e99b49f5206e95cf0ca3f92d2c1c>>
|
|
8
8
|
* @flow strict
|
|
9
9
|
* @noformat
|
|
10
10
|
*/
|
|
@@ -35,6 +35,7 @@ export type ReactNativeFeatureFlagsJsOnly = $ReadOnly<{
|
|
|
35
35
|
enableAccessToHostTreeInFabric: Getter<boolean>,
|
|
36
36
|
fixVirtualizeListCollapseWindowSize: Getter<boolean>,
|
|
37
37
|
isLayoutAnimationEnabled: Getter<boolean>,
|
|
38
|
+
reduceDefaultPropsInImage: Getter<boolean>,
|
|
38
39
|
reduceDefaultPropsInText: Getter<boolean>,
|
|
39
40
|
shouldUseAnimatedObjectForTransform: Getter<boolean>,
|
|
40
41
|
shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean>,
|
|
@@ -66,7 +67,6 @@ export type ReactNativeFeatureFlags = $ReadOnly<{
|
|
|
66
67
|
enableEagerRootViewAttachment: Getter<boolean>,
|
|
67
68
|
enableFabricLogs: Getter<boolean>,
|
|
68
69
|
enableFabricRenderer: Getter<boolean>,
|
|
69
|
-
enableFixForParentTagDuringReparenting: Getter<boolean>,
|
|
70
70
|
enableFontScaleChangesUpdatingLayout: Getter<boolean>,
|
|
71
71
|
enableIOSTextBaselineOffsetPerLine: Getter<boolean>,
|
|
72
72
|
enableIOSViewClipToPaddingBox: Getter<boolean>,
|
|
@@ -139,7 +139,7 @@ export const deferFlatListFocusChangeRenderUpdate: Getter<boolean> = createJavaS
|
|
|
139
139
|
/**
|
|
140
140
|
* Enables access to the host tree in Fabric using DOM-compatible APIs.
|
|
141
141
|
*/
|
|
142
|
-
export const enableAccessToHostTreeInFabric: Getter<boolean> = createJavaScriptFlagGetter('enableAccessToHostTreeInFabric',
|
|
142
|
+
export const enableAccessToHostTreeInFabric: Getter<boolean> = createJavaScriptFlagGetter('enableAccessToHostTreeInFabric', true);
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* Fixing an edge case where the current window size is not properly calculated with fast scrolling. Window size collapsed to 1 element even if windowSize more than the current amount of elements
|
|
@@ -151,6 +151,11 @@ export const fixVirtualizeListCollapseWindowSize: Getter<boolean> = createJavaSc
|
|
|
151
151
|
*/
|
|
152
152
|
export const isLayoutAnimationEnabled: Getter<boolean> = createJavaScriptFlagGetter('isLayoutAnimationEnabled', true);
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Optimize how default props are processed in Image to avoid unnecessary keys.
|
|
156
|
+
*/
|
|
157
|
+
export const reduceDefaultPropsInImage: Getter<boolean> = createJavaScriptFlagGetter('reduceDefaultPropsInImage', false);
|
|
158
|
+
|
|
154
159
|
/**
|
|
155
160
|
* Optimize how default props are processed in Text to avoid unnecessary keys.
|
|
156
161
|
*/
|
|
@@ -255,14 +260,10 @@ export const enableFabricLogs: Getter<boolean> = createNativeFlagGetter('enableF
|
|
|
255
260
|
* Enables the use of the Fabric renderer in the whole app.
|
|
256
261
|
*/
|
|
257
262
|
export const enableFabricRenderer: Getter<boolean> = createNativeFlagGetter('enableFabricRenderer', false);
|
|
258
|
-
/**
|
|
259
|
-
* This feature flag enables a fix for reparenting fix in differentiator
|
|
260
|
-
*/
|
|
261
|
-
export const enableFixForParentTagDuringReparenting: Getter<boolean> = createNativeFlagGetter('enableFixForParentTagDuringReparenting', false);
|
|
262
263
|
/**
|
|
263
264
|
* Enables font scale changes updating layout for measurable nodes.
|
|
264
265
|
*/
|
|
265
|
-
export const enableFontScaleChangesUpdatingLayout: Getter<boolean> = createNativeFlagGetter('enableFontScaleChangesUpdatingLayout',
|
|
266
|
+
export const enableFontScaleChangesUpdatingLayout: Getter<boolean> = createNativeFlagGetter('enableFontScaleChangesUpdatingLayout', true);
|
|
266
267
|
/**
|
|
267
268
|
* Applies base offset for each line of text separately on iOS.
|
|
268
269
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<604963e3616f21f84b65b0291fecb182>>
|
|
8
8
|
* @flow strict
|
|
9
9
|
* @noformat
|
|
10
10
|
*/
|
|
@@ -45,7 +45,6 @@ export interface Spec extends TurboModule {
|
|
|
45
45
|
+enableEagerRootViewAttachment?: () => boolean;
|
|
46
46
|
+enableFabricLogs?: () => boolean;
|
|
47
47
|
+enableFabricRenderer?: () => boolean;
|
|
48
|
-
+enableFixForParentTagDuringReparenting?: () => boolean;
|
|
49
48
|
+enableFontScaleChangesUpdatingLayout?: () => boolean;
|
|
50
49
|
+enableIOSTextBaselineOffsetPerLine?: () => boolean;
|
|
51
50
|
+enableIOSViewClipToPaddingBox?: () => boolean;
|
|
@@ -32,17 +32,17 @@ function getExtendedError(
|
|
|
32
32
|
if (errorValue instanceof Error) {
|
|
33
33
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
34
34
|
* this parameters */
|
|
35
|
-
// $FlowFixMe[incompatible-
|
|
35
|
+
// $FlowFixMe[incompatible-type]
|
|
36
36
|
error = (errorValue: ExtendedError);
|
|
37
37
|
} else if (typeof errorValue === 'string') {
|
|
38
38
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
39
39
|
* this parameters */
|
|
40
|
-
// $FlowFixMe[incompatible-
|
|
40
|
+
// $FlowFixMe[incompatible-type]
|
|
41
41
|
error = (new SyntheticError(errorValue): ExtendedError);
|
|
42
42
|
} else {
|
|
43
43
|
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
44
44
|
* this parameters */
|
|
45
|
-
// $FlowFixMe[incompatible-
|
|
45
|
+
// $FlowFixMe[incompatible-type]
|
|
46
46
|
error = (new SyntheticError('Unspecified error'): ExtendedError);
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
// $FlowExpectedError[nonstrict-import] Making this module `strict-local` would require too many modules to revert back to `strict-local` as well.
|
|
12
|
+
import type ReactNativeElement from '../webapis/dom/nodes/ReactNativeElement';
|
|
13
|
+
|
|
11
14
|
export type MeasureOnSuccessCallback = (
|
|
12
15
|
x: number,
|
|
13
16
|
y: number,
|
|
@@ -105,7 +108,7 @@ export interface LegacyHostInstanceMethods {
|
|
|
105
108
|
setNativeProps(nativeProps: {...}): void;
|
|
106
109
|
}
|
|
107
110
|
|
|
108
|
-
export type HostInstance =
|
|
111
|
+
export type HostInstance = ReactNativeElement;
|
|
109
112
|
|
|
110
113
|
/** @deprecated Use HostInstance instead */
|
|
111
114
|
export type NativeMethods = LegacyHostInstanceMethods;
|
|
@@ -14,9 +14,9 @@ import type {RootTag} from '../../../../../Libraries/ReactNative/RootTag';
|
|
|
14
14
|
import type {ViewConfig} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
15
15
|
import type HTMLCollection from '../oldstylecollections/HTMLCollection';
|
|
16
16
|
import type {ReactNativeDocumentInstanceHandle} from './internals/ReactNativeDocumentInstanceHandle';
|
|
17
|
-
import type ReadOnlyElement from './ReadOnlyElement';
|
|
18
17
|
|
|
19
18
|
import {createHTMLCollection} from '../oldstylecollections/HTMLCollection';
|
|
19
|
+
import {getPublicInstanceFromInstanceHandle} from './internals/NodeInternals';
|
|
20
20
|
import {
|
|
21
21
|
createReactNativeDocumentElementInstanceHandle,
|
|
22
22
|
setNativeElementReferenceForReactNativeDocumentElementInstanceHandle,
|
|
@@ -24,10 +24,12 @@ import {
|
|
|
24
24
|
} from './internals/ReactNativeDocumentElementInstanceHandle';
|
|
25
25
|
import {createReactNativeDocumentInstanceHandle} from './internals/ReactNativeDocumentInstanceHandle';
|
|
26
26
|
import ReactNativeElement from './ReactNativeElement';
|
|
27
|
+
import ReadOnlyElement from './ReadOnlyElement';
|
|
27
28
|
import ReadOnlyNode from './ReadOnlyNode';
|
|
28
29
|
import NativeDOM from './specs/NativeDOM';
|
|
29
30
|
|
|
30
31
|
export default class ReactNativeDocument extends ReadOnlyNode {
|
|
32
|
+
_rootTag: RootTag;
|
|
31
33
|
_documentElement: ReactNativeElement;
|
|
32
34
|
|
|
33
35
|
constructor(
|
|
@@ -35,6 +37,7 @@ export default class ReactNativeDocument extends ReadOnlyNode {
|
|
|
35
37
|
instanceHandle: ReactNativeDocumentInstanceHandle,
|
|
36
38
|
) {
|
|
37
39
|
super(instanceHandle, null);
|
|
40
|
+
this._rootTag = rootTag;
|
|
38
41
|
this._documentElement = createDocumentElement(rootTag, this);
|
|
39
42
|
}
|
|
40
43
|
|
|
@@ -71,10 +74,27 @@ export default class ReactNativeDocument extends ReadOnlyNode {
|
|
|
71
74
|
return null;
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
// $FlowExpectedError[incompatible-
|
|
77
|
+
// $FlowExpectedError[incompatible-type] This is defined as returning string in Node, but it's actually null in Document.
|
|
75
78
|
get textContent(): null {
|
|
76
79
|
return null;
|
|
77
80
|
}
|
|
81
|
+
|
|
82
|
+
getElementById(id: string): ReadOnlyElement | null {
|
|
83
|
+
const elementByIdInstanceHandle = NativeDOM.getElementById(
|
|
84
|
+
this._rootTag,
|
|
85
|
+
id,
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
if (elementByIdInstanceHandle == null) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const elementById = getPublicInstanceFromInstanceHandle(
|
|
93
|
+
elementByIdInstanceHandle,
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
return elementById instanceof ReadOnlyElement ? elementById : null;
|
|
97
|
+
}
|
|
78
98
|
}
|
|
79
99
|
|
|
80
100
|
function createDocumentElement(
|
|
@@ -220,9 +220,11 @@ export default class ReadOnlyElement extends ReadOnlyNode {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
function getChildElements(node: ReadOnlyNode): $ReadOnlyArray<ReadOnlyElement> {
|
|
223
|
-
// $FlowFixMe[incompatible-
|
|
224
|
-
return getChildNodes(
|
|
225
|
-
|
|
223
|
+
// $FlowFixMe[incompatible-type]
|
|
224
|
+
return getChildNodes(
|
|
225
|
+
node,
|
|
226
|
+
(childNode: ReadOnlyNode) =>
|
|
227
|
+
childNode.nodeType === ReadOnlyNode.ELEMENT_NODE,
|
|
226
228
|
);
|
|
227
229
|
}
|
|
228
230
|
|
|
@@ -118,7 +118,11 @@ export default class ReadOnlyNode {
|
|
|
118
118
|
get parentElement(): ReadOnlyElement | null {
|
|
119
119
|
const parentNode = this.parentNode;
|
|
120
120
|
|
|
121
|
-
if (
|
|
121
|
+
if (
|
|
122
|
+
parentNode != null &&
|
|
123
|
+
parentNode.nodeType === ReadOnlyNode.ELEMENT_NODE
|
|
124
|
+
) {
|
|
125
|
+
// $FlowExpectedError[incompatible-type] parentNode is an instance of ReadOnlyElement as per the `nodeType` check
|
|
122
126
|
return parentNode;
|
|
123
127
|
}
|
|
124
128
|
|
|
@@ -292,6 +296,7 @@ setPlatformObject(ReadOnlyNode);
|
|
|
292
296
|
|
|
293
297
|
export function getChildNodes(
|
|
294
298
|
node: ReadOnlyNode,
|
|
299
|
+
filter?: (node: ReadOnlyNode) => boolean,
|
|
295
300
|
): $ReadOnlyArray<ReadOnlyNode> {
|
|
296
301
|
const shadowNode = getNativeNodeReference(node);
|
|
297
302
|
|
|
@@ -300,9 +305,16 @@ export function getChildNodes(
|
|
|
300
305
|
}
|
|
301
306
|
|
|
302
307
|
const childNodeInstanceHandles = NativeDOM.getChildNodes(shadowNode);
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
308
|
+
const childNodes = [];
|
|
309
|
+
for (const childNodeInstanceHandle of childNodeInstanceHandles) {
|
|
310
|
+
const childNode = getPublicInstanceFromInstanceHandle(
|
|
311
|
+
childNodeInstanceHandle,
|
|
312
|
+
);
|
|
313
|
+
if (childNode != null && (filter == null || filter(childNode))) {
|
|
314
|
+
childNodes.push(childNode);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return childNodes;
|
|
306
318
|
}
|
|
307
319
|
|
|
308
320
|
function getNodeSiblingsAndPosition(
|
|
@@ -323,12 +335,3 @@ function getNodeSiblingsAndPosition(
|
|
|
323
335
|
|
|
324
336
|
return [siblings, position];
|
|
325
337
|
}
|
|
326
|
-
|
|
327
|
-
let ReadOnlyElementClass;
|
|
328
|
-
function getReadOnlyElementClass(): Class<ReadOnlyElement> {
|
|
329
|
-
if (ReadOnlyElementClass == null) {
|
|
330
|
-
// We initialize this lazily to avoid a require cycle.
|
|
331
|
-
ReadOnlyElementClass = require('./ReadOnlyElement').default;
|
|
332
|
-
}
|
|
333
|
-
return ReadOnlyElementClass;
|
|
334
|
-
}
|
|
@@ -37,14 +37,30 @@ export type InstanceHandle =
|
|
|
37
37
|
| ReactNativeDocumentElementInstanceHandle // root element managed by React Native
|
|
38
38
|
| ReactNativeDocumentInstanceHandle; // document node managed by React Native
|
|
39
39
|
|
|
40
|
-
let
|
|
41
|
-
function
|
|
42
|
-
|
|
40
|
+
let cachedGetNodeFromInternalInstanceHandle;
|
|
41
|
+
function getNodeFromInternalInstanceHandle(
|
|
42
|
+
instanceHandle: InternalInstanceHandle,
|
|
43
|
+
) {
|
|
44
|
+
if (cachedGetNodeFromInternalInstanceHandle == null) {
|
|
43
45
|
// Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
|
|
44
46
|
// With a static import we can't use these classes for Paper-only variants.
|
|
45
|
-
|
|
47
|
+
cachedGetNodeFromInternalInstanceHandle =
|
|
48
|
+
require('../../../../../../Libraries/ReactNative/RendererProxy').getNodeFromInternalInstanceHandle;
|
|
46
49
|
}
|
|
47
|
-
return
|
|
50
|
+
return cachedGetNodeFromInternalInstanceHandle(instanceHandle);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let cachedGetPublicInstanceFromInternalInstanceHandle;
|
|
54
|
+
function getPublicInstanceFromInternalInstanceHandle(
|
|
55
|
+
instanceHandle: InternalInstanceHandle,
|
|
56
|
+
) {
|
|
57
|
+
if (cachedGetPublicInstanceFromInternalInstanceHandle == null) {
|
|
58
|
+
// Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
|
|
59
|
+
// With a static import we can't use these classes for Paper-only variants.
|
|
60
|
+
cachedGetPublicInstanceFromInternalInstanceHandle =
|
|
61
|
+
require('../../../../../../Libraries/ReactNative/RendererProxy').getPublicInstanceFromInternalInstanceHandle;
|
|
62
|
+
}
|
|
63
|
+
return cachedGetPublicInstanceFromInternalInstanceHandle(instanceHandle);
|
|
48
64
|
}
|
|
49
65
|
|
|
50
66
|
const INSTANCE_HANDLE_KEY = Symbol('internalInstanceHandle');
|
|
@@ -81,6 +97,15 @@ export function setOwnerDocument(
|
|
|
81
97
|
export function getPublicInstanceFromInstanceHandle(
|
|
82
98
|
instanceHandle: InstanceHandle,
|
|
83
99
|
): ?ReadOnlyNode {
|
|
100
|
+
const mixedPublicInstance =
|
|
101
|
+
// $FlowExpectedError[incompatible-type]
|
|
102
|
+
getPublicInstanceFromInternalInstanceHandle(instanceHandle);
|
|
103
|
+
|
|
104
|
+
if (mixedPublicInstance != null) {
|
|
105
|
+
// $FlowExpectedError[incompatible-type] React defines public instances as "mixed" because it can't access the definition from React Native.
|
|
106
|
+
return mixedPublicInstance;
|
|
107
|
+
}
|
|
108
|
+
|
|
84
109
|
if (isReactNativeDocumentInstanceHandle(instanceHandle)) {
|
|
85
110
|
return getPublicInstanceFromReactNativeDocumentInstanceHandle(
|
|
86
111
|
instanceHandle,
|
|
@@ -92,14 +117,6 @@ export function getPublicInstanceFromInstanceHandle(
|
|
|
92
117
|
instanceHandle,
|
|
93
118
|
);
|
|
94
119
|
}
|
|
95
|
-
|
|
96
|
-
const mixedPublicInstance =
|
|
97
|
-
getRendererProxy().getPublicInstanceFromInternalInstanceHandle(
|
|
98
|
-
instanceHandle,
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
// $FlowExpectedError[incompatible-return] React defines public instances as "mixed" because it can't access the definition from React Native.
|
|
102
|
-
return mixedPublicInstance;
|
|
103
120
|
}
|
|
104
121
|
|
|
105
122
|
export function getNativeNodeReference(
|
|
@@ -107,6 +124,15 @@ export function getNativeNodeReference(
|
|
|
107
124
|
): ?NativeNodeReference {
|
|
108
125
|
const instanceHandle = getInstanceHandle(node);
|
|
109
126
|
|
|
127
|
+
// Try React nodes first
|
|
128
|
+
const nativeReference =
|
|
129
|
+
// $FlowExpectedError[incompatible-type]
|
|
130
|
+
getNodeFromInternalInstanceHandle(instanceHandle);
|
|
131
|
+
if (nativeReference != null) {
|
|
132
|
+
// $FlowExpectedError[incompatible-type]
|
|
133
|
+
return nativeReference;
|
|
134
|
+
}
|
|
135
|
+
|
|
110
136
|
if (isReactNativeDocumentInstanceHandle(instanceHandle)) {
|
|
111
137
|
return getNativeNodeReferenceFromReactNativeDocumentInstanceHandle(
|
|
112
138
|
instanceHandle,
|
|
@@ -118,15 +144,12 @@ export function getNativeNodeReference(
|
|
|
118
144
|
instanceHandle,
|
|
119
145
|
);
|
|
120
146
|
}
|
|
121
|
-
|
|
122
|
-
// $FlowExpectedError[incompatible-return]
|
|
123
|
-
return getRendererProxy().getNodeFromInternalInstanceHandle(instanceHandle);
|
|
124
147
|
}
|
|
125
148
|
|
|
126
149
|
export function getNativeElementReference(
|
|
127
150
|
node: ReadOnlyElement,
|
|
128
151
|
): ?NativeElementReference {
|
|
129
|
-
// $FlowExpectedError[incompatible-
|
|
152
|
+
// $FlowExpectedError[incompatible-type] We know ReadOnlyElement instances provide InternalInstanceHandle
|
|
130
153
|
const instanceHandle = getInstanceHandle(node) as InternalInstanceHandle;
|
|
131
154
|
|
|
132
155
|
if (isReactNativeDocumentElementInstanceHandle(instanceHandle)) {
|
|
@@ -135,16 +158,16 @@ export function getNativeElementReference(
|
|
|
135
158
|
);
|
|
136
159
|
}
|
|
137
160
|
|
|
138
|
-
// $FlowExpectedError[incompatible-
|
|
139
|
-
return
|
|
161
|
+
// $FlowExpectedError[incompatible-type]
|
|
162
|
+
return getNodeFromInternalInstanceHandle(instanceHandle);
|
|
140
163
|
}
|
|
141
164
|
|
|
142
165
|
export function getNativeTextReference(
|
|
143
166
|
node: ReadOnlyCharacterData,
|
|
144
167
|
): ?NativeTextReference {
|
|
145
|
-
// $FlowExpectedError[incompatible-
|
|
168
|
+
// $FlowExpectedError[incompatible-type] We know ReadOnlyText instances provide InternalInstanceHandle
|
|
146
169
|
const instanceHandle = getInstanceHandle(node) as InternalInstanceHandle;
|
|
147
170
|
|
|
148
|
-
// $FlowExpectedError[incompatible-
|
|
149
|
-
return
|
|
171
|
+
// $FlowExpectedError[incompatible-type]
|
|
172
|
+
return getNodeFromInternalInstanceHandle(instanceHandle);
|
|
150
173
|
}
|
|
@@ -31,7 +31,7 @@ export function getNativeNodeReferenceFromReactNativeDocumentInstanceHandle(
|
|
|
31
31
|
export function getPublicInstanceFromReactNativeDocumentInstanceHandle(
|
|
32
32
|
instanceHandle: ReactNativeDocumentInstanceHandle,
|
|
33
33
|
): ?ReactNativeDocument {
|
|
34
|
-
// $FlowExpectedError[incompatible-
|
|
34
|
+
// $FlowExpectedError[incompatible-type] React defines public instances as "mixed" because it can't access the definition from React Native.
|
|
35
35
|
return RendererProxy.getPublicInstanceFromRootTag(Number(instanceHandle));
|
|
36
36
|
}
|
|
37
37
|
|