@office-iss/react-native-win32 0.82.0 → 0.83.0-preview.0
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 +43 -40
- package/CHANGELOG.md +15 -20
- package/IntegrationTests/ImageCachePolicyTest.js +1 -1
- package/Libraries/Animated/components/AnimatedFlatList.js +5 -3
- package/Libraries/Animated/components/AnimatedImage.js +4 -3
- package/Libraries/Animated/components/AnimatedSectionList.js +2 -2
- package/Libraries/Animated/components/AnimatedText.js +7 -3
- package/Libraries/Animated/components/AnimatedView.js +3 -2
- package/Libraries/Animated/createAnimatedComponent.js +24 -12
- package/Libraries/Animated/nodes/AnimatedColor.js +26 -10
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +43 -15
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +43 -15
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +2 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +2 -2
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts +2 -2
- package/Libraries/Components/RefreshControl/RefreshControl.d.ts +3 -3
- package/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +2 -2
- package/Libraries/Components/ScrollView/ScrollView.js +1 -0
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -6
- package/Libraries/Components/Switch/Switch.d.ts +2 -2
- package/Libraries/Components/TextInput/TextInput.d.ts +2 -5
- package/Libraries/Components/TextInput/TextInput.js +6 -0
- package/Libraries/Components/TextInput/TextInput.win32.js +18 -12
- package/Libraries/Components/TextInput/TextInputState.win32.js +2 -2
- package/Libraries/Components/Touchable/TouchableBounce.js +7 -7
- package/Libraries/Components/Touchable/TouchableWin32.js +9 -6
- package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +19 -1
- package/Libraries/Components/View/View.d.ts +2 -2
- package/Libraries/Components/View/View.win32.js +17 -15
- package/Libraries/Components/View/ViewNativeComponent.js +13 -1
- package/Libraries/Components/View/ViewWin32.d.ts +2 -2
- package/Libraries/Components/View/ViewWin32.js +1 -1
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/setUpPerformance.js +2 -0
- package/Libraries/Debugging/DebuggingOverlay.js +14 -14
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +8 -2
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +5 -2
- package/Libraries/Image/Image.d.ts +3 -3
- package/Libraries/Image/ImageInjection.js +3 -6
- package/Libraries/Image/ImageTypes.flow.js +3 -7
- package/Libraries/Lists/FlatList.js +8 -8
- package/Libraries/Lists/SectionList.d.ts +5 -1
- package/Libraries/Lists/ViewabilityHelper.js +1 -1
- package/Libraries/Lists/VirtualizedList.js +1 -0
- package/Libraries/LogBox/UI/AnsiHighlight.js +4 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +11 -2
- package/Libraries/NativeComponent/NativeComponentRegistry.d.ts +98 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +2 -0
- package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +3 -1
- package/Libraries/Network/RCTNetworking.android.js +3 -1
- package/Libraries/Network/RCTNetworking.ios.js +3 -0
- package/Libraries/Network/RCTNetworking.win32.js +3 -0
- package/Libraries/Network/XMLHttpRequest.js +1 -41
- package/Libraries/Pressability/Pressability.win32.js +5 -5
- package/Libraries/Pressability/usePressability.js +14 -3
- package/Libraries/ReactNative/PaperUIManager.win32.js +7 -7
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +20 -82
- package/Libraries/ReactNative/getNativeComponentAttributes.js +12 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +6759 -4478
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3169 -3119
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4732 -3535
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +6646 -4070
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3136 -2825
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4761 -3312
- package/Libraries/Renderer/shims/ReactNative.js +3 -1
- package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
- package/Libraries/Renderer/shims/ReactNativeTypes.win32.js +2 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +44 -0
- package/Libraries/StyleSheet/processBackgroundPosition.js +284 -0
- package/Libraries/StyleSheet/processBackgroundRepeat.js +105 -0
- package/Libraries/StyleSheet/processBackgroundSize.js +104 -0
- package/Libraries/Text/Text.d.ts +2 -2
- package/Libraries/Text/TextNativeComponent.js +10 -0
- package/Libraries/Text/TextNativeComponent.win32.js +10 -0
- package/Libraries/TurboModule/TurboModuleRegistry.js +3 -9
- package/Libraries/Utilities/DevLoadingView.js +14 -6
- package/Libraries/Utilities/FocusManager.win32.js +2 -2
- package/Libraries/Utilities/HMRClient.js +13 -5
- package/flow/bom.js.flow +1 -0
- package/index.js +6 -0
- package/index.win32.js +130 -207
- package/index.win32.js.flow +488 -0
- package/jest/mockComponent.js +6 -6
- package/jest/setup.js +15 -10
- package/overrides.json +16 -10
- package/package.json +39 -26
- package/src/private/components/virtualview/VirtualView.js +22 -27
- package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +6 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +100 -19
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +18 -3
- package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
- package/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +1 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +12 -2
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +76 -15
- package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/performance/ResourceTiming.js +31 -4
- package/src/private/webapis/performance/internals/RawPerformanceEntry.js +4 -1
- package/src/private/webapis/performance/specs/NativePerformance.js +3 -0
- package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +6 -3
- package/src-win/Libraries/Components/View/ViewWin32.d.ts +2 -2
- package/src-win/Libraries/Text/Text.d.ts +2 -2
- package/src-win/index.win32.js.flow +488 -0
- package/types/index.d.ts +1 -0
- package/types/public/ReactNativeTypes.d.ts +115 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +0 -152
|
@@ -13,8 +13,8 @@ import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
|
|
|
13
13
|
import type {
|
|
14
14
|
ListRenderItem,
|
|
15
15
|
ListRenderItemInfo,
|
|
16
|
+
ListViewToken,
|
|
16
17
|
ViewabilityConfigCallbackPair,
|
|
17
|
-
ViewToken,
|
|
18
18
|
VirtualizedListProps,
|
|
19
19
|
} from '@react-native/virtualized-lists';
|
|
20
20
|
|
|
@@ -573,7 +573,7 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
|
|
|
573
573
|
return keyExtractor(items, index);
|
|
574
574
|
};
|
|
575
575
|
|
|
576
|
-
_pushMultiColumnViewable(arr: Array<
|
|
576
|
+
_pushMultiColumnViewable(arr: Array<ListViewToken>, v: ListViewToken): void {
|
|
577
577
|
const numColumns = numColumnsOrDefault(this.props.numColumns);
|
|
578
578
|
const keyExtractor = this.props.keyExtractor ?? defaultKeyExtractor;
|
|
579
579
|
v.item.forEach((item, ii) => {
|
|
@@ -585,22 +585,22 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
|
|
|
585
585
|
|
|
586
586
|
_createOnViewableItemsChanged(
|
|
587
587
|
onViewableItemsChanged: ?(info: {
|
|
588
|
-
viewableItems: Array<
|
|
589
|
-
changed: Array<
|
|
588
|
+
viewableItems: Array<ListViewToken>,
|
|
589
|
+
changed: Array<ListViewToken>,
|
|
590
590
|
...
|
|
591
591
|
}) => void,
|
|
592
592
|
// $FlowFixMe[missing-local-annot]
|
|
593
593
|
) {
|
|
594
594
|
return (info: {
|
|
595
|
-
viewableItems: Array<
|
|
596
|
-
changed: Array<
|
|
595
|
+
viewableItems: Array<ListViewToken>,
|
|
596
|
+
changed: Array<ListViewToken>,
|
|
597
597
|
...
|
|
598
598
|
}) => {
|
|
599
599
|
const numColumns = numColumnsOrDefault(this.props.numColumns);
|
|
600
600
|
if (onViewableItemsChanged) {
|
|
601
601
|
if (numColumns > 1) {
|
|
602
|
-
const changed: Array<
|
|
603
|
-
const viewableItems: Array<
|
|
602
|
+
const changed: Array<ListViewToken> = [];
|
|
603
|
+
const viewableItems: Array<ListViewToken> = [];
|
|
604
604
|
info.viewableItems.forEach(v =>
|
|
605
605
|
this._pushMultiColumnViewable(viewableItems, v),
|
|
606
606
|
);
|
|
@@ -35,7 +35,11 @@ export interface SectionBase<ItemT, SectionT = DefaultSectionT> {
|
|
|
35
35
|
|
|
36
36
|
renderItem?: SectionListRenderItem<ItemT, SectionT> | undefined;
|
|
37
37
|
|
|
38
|
-
ItemSeparatorComponent?:
|
|
38
|
+
ItemSeparatorComponent?:
|
|
39
|
+
| React.ComponentType<any>
|
|
40
|
+
| React.ReactElement
|
|
41
|
+
| null
|
|
42
|
+
| undefined;
|
|
39
43
|
|
|
40
44
|
keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
|
|
41
45
|
}
|
|
@@ -87,7 +87,7 @@ export default function Ansi({
|
|
|
87
87
|
<View style={styles.container}>
|
|
88
88
|
{parsedLines.map((items, i) => (
|
|
89
89
|
<View style={styles.line} key={i}>
|
|
90
|
-
<Text>
|
|
90
|
+
<Text style={styles.text}>
|
|
91
91
|
{items.map((bundle, key) => {
|
|
92
92
|
const textStyle =
|
|
93
93
|
bundle.fg && COLORS[bundle.fg]
|
|
@@ -122,4 +122,7 @@ const styles = StyleSheet.create({
|
|
|
122
122
|
line: {
|
|
123
123
|
flexDirection: 'row',
|
|
124
124
|
},
|
|
125
|
+
text: {
|
|
126
|
+
flexGrow: 1,
|
|
127
|
+
},
|
|
125
128
|
});
|
|
@@ -179,8 +179,17 @@ const validAttributesForNonEventProps = {
|
|
|
179
179
|
backgroundColor: {process: require('../StyleSheet/processColor').default},
|
|
180
180
|
transform: true,
|
|
181
181
|
transformOrigin: true,
|
|
182
|
-
experimental_backgroundImage:
|
|
183
|
-
|
|
182
|
+
experimental_backgroundImage: ReactNativeFeatureFlags.enableNativeCSSParsing()
|
|
183
|
+
? (true as const)
|
|
184
|
+
: {process: require('../StyleSheet/processBackgroundImage').default},
|
|
185
|
+
experimental_backgroundSize: {
|
|
186
|
+
process: require('../StyleSheet/processBackgroundSize').default,
|
|
187
|
+
},
|
|
188
|
+
experimental_backgroundPosition: {
|
|
189
|
+
process: require('../StyleSheet/processBackgroundPosition').default,
|
|
190
|
+
},
|
|
191
|
+
experimental_backgroundRepeat: {
|
|
192
|
+
process: require('../StyleSheet/processBackgroundRepeat').default,
|
|
184
193
|
},
|
|
185
194
|
boxShadow: ReactNativeFeatureFlags.enableNativeCSSParsing()
|
|
186
195
|
? (true as const)
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {HostComponent} from '../../types/public/ReactNativeTypes';
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Configures a function that is called to determine whether a given component
|
|
15
|
+
* should be registered using reflection of the native component at runtime.
|
|
16
|
+
*
|
|
17
|
+
* The provider should return null if the native component is unavailable in
|
|
18
|
+
* the current environment.
|
|
19
|
+
*/
|
|
20
|
+
export function setRuntimeConfigProvider(
|
|
21
|
+
runtimeConfigProvider: (name: string) => {
|
|
22
|
+
native: boolean;
|
|
23
|
+
verify: boolean;
|
|
24
|
+
} | null,
|
|
25
|
+
): void;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Gets a `NativeComponent` that can be rendered by React Native.
|
|
29
|
+
*
|
|
30
|
+
* The supplied `viewConfigProvider` may or may not be invoked and utilized,
|
|
31
|
+
* depending on how `setRuntimeConfigProvider` is configured.
|
|
32
|
+
*/
|
|
33
|
+
export function get<Config extends object>(
|
|
34
|
+
name: string,
|
|
35
|
+
viewConfigProvider: () => PartialViewConfig,
|
|
36
|
+
): HostComponent<Config>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Same as `NativeComponentRegistry.get(...)`, except this will check either
|
|
40
|
+
* the `setRuntimeConfigProvider` configuration or use native reflection (slow)
|
|
41
|
+
* to determine whether this native component is available.
|
|
42
|
+
*
|
|
43
|
+
* If the native component is not available, a stub component is returned. Note
|
|
44
|
+
* that the return value of this is not `HostComponent` because the returned
|
|
45
|
+
* component instance is not guaranteed to have native methods.
|
|
46
|
+
*/
|
|
47
|
+
export function getWithFallback_DEPRECATED<Config extends object>(
|
|
48
|
+
name: string,
|
|
49
|
+
viewConfigProvider: () => PartialViewConfig,
|
|
50
|
+
): React.ComponentType<Config>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Unstable API. Do not use!
|
|
54
|
+
*
|
|
55
|
+
* This method returns if there is a StaticViewConfig registered for the
|
|
56
|
+
* component name received as a parameter.
|
|
57
|
+
*/
|
|
58
|
+
export function unstable_hasStaticViewConfig(name: string): boolean;
|
|
59
|
+
|
|
60
|
+
type AttributeType<T, V> =
|
|
61
|
+
| true
|
|
62
|
+
| {
|
|
63
|
+
readonly diff?: ((arg1: T, arg2: T) => boolean) | undefined;
|
|
64
|
+
readonly process?: ((arg1: V) => T) | undefined;
|
|
65
|
+
};
|
|
66
|
+
type AnyAttributeType = AttributeType<any, any>;
|
|
67
|
+
type AttributeConfiguration = {
|
|
68
|
+
readonly [propName: string]: AnyAttributeType | void;
|
|
69
|
+
readonly style?:
|
|
70
|
+
| {
|
|
71
|
+
readonly [propName: string]: AnyAttributeType;
|
|
72
|
+
}
|
|
73
|
+
| undefined;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
type PartialViewConfig = Readonly<{
|
|
77
|
+
bubblingEventTypes?:
|
|
78
|
+
| {
|
|
79
|
+
readonly [eventName: string]: {
|
|
80
|
+
readonly phasedRegistrationNames: {
|
|
81
|
+
readonly bubbled: string;
|
|
82
|
+
readonly captured: string;
|
|
83
|
+
readonly skipBubbling?: boolean | undefined;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
| undefined;
|
|
88
|
+
directEventTypes?:
|
|
89
|
+
| {
|
|
90
|
+
readonly [eventName: string]: {
|
|
91
|
+
readonly registrationName: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
| undefined;
|
|
95
|
+
supportsRawText?: boolean | undefined;
|
|
96
|
+
uiViewClassName: string;
|
|
97
|
+
validAttributes?: AttributeConfiguration | undefined;
|
|
98
|
+
}>;
|
|
@@ -129,11 +129,13 @@ export function getWithFallback_DEPRECATED<Config: {...}>(
|
|
|
129
129
|
// `getRuntimeConfig == null` when static view configs are disabled
|
|
130
130
|
// If `setRuntimeConfigProvider` is not configured, use native reflection.
|
|
131
131
|
if (hasNativeViewConfig(name)) {
|
|
132
|
+
/* $FlowFixMe[incompatible-type] Extra ref prop */
|
|
132
133
|
return get<Config>(name, viewConfigProvider);
|
|
133
134
|
}
|
|
134
135
|
} else {
|
|
135
136
|
// If there is no runtime config, then the native component is unavailable.
|
|
136
137
|
if (getRuntimeConfig(name) != null) {
|
|
138
|
+
/* $FlowFixMe[incompatible-type] Extra ref prop */
|
|
137
139
|
return get<Config>(name, viewConfigProvider);
|
|
138
140
|
}
|
|
139
141
|
}
|
|
@@ -23,7 +23,9 @@ export function unstable_hasComponent(name: string): boolean {
|
|
|
23
23
|
hasNativeComponent = global.__nativeComponentRegistry__hasComponent(name);
|
|
24
24
|
componentNameToExists.set(name, hasNativeComponent);
|
|
25
25
|
} else {
|
|
26
|
-
throw
|
|
26
|
+
throw new Error(
|
|
27
|
+
`unstable_hasComponent('${name}'): Global function is not registered`,
|
|
28
|
+
);
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
return hasNativeComponent;
|
|
@@ -77,12 +77,14 @@ const RCTNetworking = {
|
|
|
77
77
|
}));
|
|
78
78
|
}
|
|
79
79
|
const requestId = generateRequestId();
|
|
80
|
+
const devToolsRequestId =
|
|
81
|
+
global.__NETWORK_REPORTER__?.createDevToolsRequestId();
|
|
80
82
|
NativeNetworkingAndroid.sendRequest(
|
|
81
83
|
method,
|
|
82
84
|
url,
|
|
83
85
|
requestId,
|
|
84
86
|
convertHeadersMapToArray(headers),
|
|
85
|
-
{...body, trackingName},
|
|
87
|
+
{...body, trackingName, devToolsRequestId},
|
|
86
88
|
responseType,
|
|
87
89
|
incrementalUpdates,
|
|
88
90
|
timeout,
|
|
@@ -40,6 +40,8 @@ const RCTNetworking = {
|
|
|
40
40
|
withCredentials: boolean,
|
|
41
41
|
) {
|
|
42
42
|
const body = convertRequestBody(data);
|
|
43
|
+
const devToolsRequestId =
|
|
44
|
+
global.__NETWORK_REPORTER__?.createDevToolsRequestId();
|
|
43
45
|
NativeNetworkingIOS.sendRequest(
|
|
44
46
|
{
|
|
45
47
|
method,
|
|
@@ -50,6 +52,7 @@ const RCTNetworking = {
|
|
|
50
52
|
incrementalUpdates,
|
|
51
53
|
timeout,
|
|
52
54
|
withCredentials,
|
|
55
|
+
unstable_devToolsRequestId: devToolsRequestId,
|
|
53
56
|
},
|
|
54
57
|
callback,
|
|
55
58
|
);
|
|
@@ -40,6 +40,8 @@ const RCTNetworking = {
|
|
|
40
40
|
withCredentials: boolean,
|
|
41
41
|
) {
|
|
42
42
|
const body = convertRequestBody(data);
|
|
43
|
+
const devToolsRequestId =
|
|
44
|
+
global.__NETWORK_REPORTER__?.createDevToolsRequestId();
|
|
43
45
|
NativeNetworkingIOS.sendRequest(
|
|
44
46
|
{
|
|
45
47
|
method,
|
|
@@ -50,6 +52,7 @@ const RCTNetworking = {
|
|
|
50
52
|
incrementalUpdates,
|
|
51
53
|
timeout,
|
|
52
54
|
withCredentials,
|
|
55
|
+
unstable_devToolsRequestId: devToolsRequestId,
|
|
53
56
|
},
|
|
54
57
|
callback,
|
|
55
58
|
);
|
|
@@ -14,7 +14,6 @@ import type {
|
|
|
14
14
|
EventCallback,
|
|
15
15
|
EventListener,
|
|
16
16
|
} from '../../src/private/webapis/dom/events/EventTarget';
|
|
17
|
-
import type Performance from '../../src/private/webapis/performance/Performance';
|
|
18
17
|
import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
|
|
19
18
|
|
|
20
19
|
import Event from '../../src/private/webapis/dom/events/Event';
|
|
@@ -34,13 +33,7 @@ const RCTNetworking = require('./RCTNetworking').default;
|
|
|
34
33
|
const base64 = require('base64-js');
|
|
35
34
|
const invariant = require('invariant');
|
|
36
35
|
|
|
37
|
-
const PERFORMANCE_TRACK_NAME = 'Network (JS-initiated only)';
|
|
38
|
-
const PERFORMANCE_TRACK_GROUP = 'Chrome DevTools Temp Compat';
|
|
39
|
-
|
|
40
|
-
declare var performance: Performance;
|
|
41
|
-
|
|
42
36
|
const DEBUG_NETWORK_SEND_DELAY: false = false; // Set to a number of milliseconds when debugging
|
|
43
|
-
const LABEL_FOR_MISSING_URL_FOR_PROFILING = 'Unknown URL';
|
|
44
37
|
|
|
45
38
|
export type NativeResponseType = 'base64' | 'blob' | 'text';
|
|
46
39
|
export type ResponseType =
|
|
@@ -141,7 +134,6 @@ class XMLHttpRequest extends EventTarget {
|
|
|
141
134
|
static DONE: number = DONE;
|
|
142
135
|
|
|
143
136
|
static _interceptor: ?XHRInterceptor = null;
|
|
144
|
-
static _profiling: boolean = false;
|
|
145
137
|
|
|
146
138
|
UNSENT: number = UNSENT;
|
|
147
139
|
OPENED: number = OPENED;
|
|
@@ -182,10 +174,6 @@ class XMLHttpRequest extends EventTarget {
|
|
|
182
174
|
XMLHttpRequest._interceptor = interceptor;
|
|
183
175
|
}
|
|
184
176
|
|
|
185
|
-
static enableProfiling(enableProfiling: boolean): void {
|
|
186
|
-
XMLHttpRequest._profiling = enableProfiling;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
177
|
constructor() {
|
|
190
178
|
super();
|
|
191
179
|
this._reset();
|
|
@@ -389,23 +377,12 @@ class XMLHttpRequest extends EventTarget {
|
|
|
389
377
|
return;
|
|
390
378
|
}
|
|
391
379
|
|
|
392
|
-
const start = XMLHttpRequest._profiling ? performance.now() : undefined;
|
|
393
|
-
|
|
394
380
|
if (!this._response) {
|
|
395
381
|
this._response = responseText;
|
|
396
382
|
} else {
|
|
397
383
|
this._response += responseText;
|
|
398
384
|
}
|
|
399
385
|
|
|
400
|
-
if (XMLHttpRequest._profiling) {
|
|
401
|
-
console.timeStamp(
|
|
402
|
-
'Incremental Data: ' + this._getMeasureURL(),
|
|
403
|
-
start,
|
|
404
|
-
undefined,
|
|
405
|
-
PERFORMANCE_TRACK_NAME,
|
|
406
|
-
PERFORMANCE_TRACK_GROUP,
|
|
407
|
-
);
|
|
408
|
-
}
|
|
409
386
|
XMLHttpRequest._interceptor &&
|
|
410
387
|
XMLHttpRequest._interceptor.dataReceived(requestId, responseText);
|
|
411
388
|
|
|
@@ -450,16 +427,7 @@ class XMLHttpRequest extends EventTarget {
|
|
|
450
427
|
this._clearSubscriptions();
|
|
451
428
|
this._requestId = null;
|
|
452
429
|
this.setReadyState(this.DONE);
|
|
453
|
-
|
|
454
|
-
const start = this._startTime;
|
|
455
|
-
console.timeStamp(
|
|
456
|
-
this._getMeasureURL(),
|
|
457
|
-
start,
|
|
458
|
-
undefined,
|
|
459
|
-
PERFORMANCE_TRACK_NAME,
|
|
460
|
-
PERFORMANCE_TRACK_GROUP,
|
|
461
|
-
);
|
|
462
|
-
}
|
|
430
|
+
|
|
463
431
|
if (error) {
|
|
464
432
|
XMLHttpRequest._interceptor &&
|
|
465
433
|
XMLHttpRequest._interceptor.loadingFailed(requestId, error);
|
|
@@ -649,8 +617,6 @@ class XMLHttpRequest extends EventTarget {
|
|
|
649
617
|
this._url,
|
|
650
618
|
this._headers,
|
|
651
619
|
data,
|
|
652
|
-
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
|
|
653
|
-
* when making Flow check .android.js files. */
|
|
654
620
|
nativeResponseType,
|
|
655
621
|
incrementalEvents,
|
|
656
622
|
this.timeout,
|
|
@@ -731,12 +697,6 @@ class XMLHttpRequest extends EventTarget {
|
|
|
731
697
|
super.addEventListener(type, listener);
|
|
732
698
|
}
|
|
733
699
|
|
|
734
|
-
_getMeasureURL(): string {
|
|
735
|
-
return (
|
|
736
|
-
this._trackingName ?? this._url ?? LABEL_FOR_MISSING_URL_FOR_PROFILING
|
|
737
|
-
);
|
|
738
|
-
}
|
|
739
|
-
|
|
740
700
|
/*
|
|
741
701
|
* `on<event>` event handling (without JS prototype magic).
|
|
742
702
|
*/
|
|
@@ -603,9 +603,9 @@ export default class Pressability {
|
|
|
603
603
|
this._isKeyDown
|
|
604
604
|
) {
|
|
605
605
|
const {onPressOut, onPress} = this._config;
|
|
606
|
-
// $FlowFixMe
|
|
606
|
+
// $FlowFixMe[incompatible-type] PressEvents don't mesh with keyboarding APIs. Keep legacy behavior of passing KeyEvents instead
|
|
607
607
|
onPressOut && onPressOut(event);
|
|
608
|
-
// $FlowFixMe
|
|
608
|
+
// $FlowFixMe[incompatible-type] PressEvents don't mesh with keyboarding APIs. Keep legacy behavior of passing KeyEvents instead
|
|
609
609
|
onPress && onPress(event);
|
|
610
610
|
}
|
|
611
611
|
// Native windows app clears the key pressed state when another key press interrupts the current
|
|
@@ -623,7 +623,7 @@ export default class Pressability {
|
|
|
623
623
|
) {
|
|
624
624
|
const {onPressIn} = this._config;
|
|
625
625
|
this._isKeyDown = true;
|
|
626
|
-
// $FlowFixMe
|
|
626
|
+
// $FlowFixMe[incompatible-type] PressEvents don't mesh with keyboarding APIs. Keep legacy behavior of passing KeyEvents instead
|
|
627
627
|
onPressIn && onPressIn(event);
|
|
628
628
|
}
|
|
629
629
|
},
|
|
@@ -788,8 +788,8 @@ export default class Pressability {
|
|
|
788
788
|
}
|
|
789
789
|
|
|
790
790
|
// [Win32]
|
|
791
|
-
// $FlowFixMe - button typing
|
|
792
|
-
_isDefaultPressButton(button): boolean {
|
|
791
|
+
// $FlowFixMe[unclear-type] - button typing
|
|
792
|
+
_isDefaultPressButton(button: any): boolean {
|
|
793
793
|
return !button; // Treat 0 or undefined as default press
|
|
794
794
|
}
|
|
795
795
|
|
|
@@ -8,15 +8,26 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
|
|
11
12
|
import Pressability, {
|
|
12
13
|
type EventHandlers,
|
|
13
14
|
type PressabilityConfig,
|
|
14
15
|
} from './Pressability';
|
|
15
|
-
import {useEffect, useRef} from 'react';
|
|
16
|
+
import {useEffect, useInsertionEffect, useRef} from 'react';
|
|
16
17
|
|
|
17
18
|
declare function usePressability(config: PressabilityConfig): EventHandlers;
|
|
18
19
|
declare function usePressability(config: null | void): null | EventHandlers;
|
|
19
20
|
|
|
21
|
+
// Experiments with using `useInsertionEffect` instead of `useEffect`, which
|
|
22
|
+
// changes whether `Pressability` is configured or reset when inm a hidden
|
|
23
|
+
// Activity. With `useInsertionEffect`, `Pressability` behaves more like a
|
|
24
|
+
// platform control (e.g. Pointer Events), especially with respect to events
|
|
25
|
+
// like focus and blur.
|
|
26
|
+
const useConfigurationEffect =
|
|
27
|
+
ReactNativeFeatureFlags.configurePressabilityDuringInsertion()
|
|
28
|
+
? useInsertionEffect
|
|
29
|
+
: useEffect;
|
|
30
|
+
|
|
20
31
|
/**
|
|
21
32
|
* Creates a persistent instance of `Pressability` that automatically configures
|
|
22
33
|
* itself and resets. Accepts null `config` to support lazy initialization. Once
|
|
@@ -40,7 +51,7 @@ export default function usePressability(
|
|
|
40
51
|
|
|
41
52
|
// On the initial mount, this is a no-op. On updates, `pressability` will be
|
|
42
53
|
// re-configured to use the new configuration.
|
|
43
|
-
|
|
54
|
+
useConfigurationEffect(() => {
|
|
44
55
|
if (config != null && pressability != null) {
|
|
45
56
|
pressability.configure(config);
|
|
46
57
|
}
|
|
@@ -48,7 +59,7 @@ export default function usePressability(
|
|
|
48
59
|
|
|
49
60
|
// On unmount, reset pending state and timers inside `pressability`. This is
|
|
50
61
|
// a separate effect because we do not want to reset when `config` changes.
|
|
51
|
-
|
|
62
|
+
useConfigurationEffect(() => {
|
|
52
63
|
if (pressability != null) {
|
|
53
64
|
return () => {
|
|
54
65
|
pressability.reset();
|
|
@@ -101,22 +101,22 @@ const UIManagerJS: UIManagerJSInterface = {
|
|
|
101
101
|
for (const propName of Object.getOwnPropertyNames(
|
|
102
102
|
Object.getPrototypeOf(NativeUIManager),
|
|
103
103
|
)) {
|
|
104
|
-
// $FlowFixMe
|
|
104
|
+
// $FlowFixMe[incompatible-type]
|
|
105
105
|
UIManagerJS[propName] = NativeUIManager[propName];
|
|
106
106
|
}
|
|
107
107
|
// Windows]
|
|
108
108
|
|
|
109
|
-
/* $FlowFixMe(>=0.123.0 site=react_native_fb) This comment suppresses an error
|
|
109
|
+
/* $FlowFixMe[cannot-write] (>=0.123.0 site=react_native_fb) This comment suppresses an error
|
|
110
110
|
* found when Flow v0.123.0 was deployed. To see the error, delete this comment
|
|
111
111
|
* and run Flow. */
|
|
112
112
|
//const UIManagerJS = {
|
|
113
113
|
// ...NativeUIManager,
|
|
114
|
-
// $FlowFixMe
|
|
114
|
+
// $FlowFixMe[cannot-write]
|
|
115
115
|
UIManagerJS.getConstants = getConstants;
|
|
116
116
|
// },
|
|
117
|
-
// $FlowFixMe
|
|
117
|
+
// $FlowFixMe[cannot-write]
|
|
118
118
|
UIManagerJS.getViewManagerConfig = getViewManagerConfig;
|
|
119
|
-
// $FlowFixMe
|
|
119
|
+
// $FlowFixMe[cannot-write]
|
|
120
120
|
UIManagerJS.hasViewManagerConfig = (viewManagerName: string) =>
|
|
121
121
|
getViewManagerConfig(viewManagerName) != null;
|
|
122
122
|
|
|
@@ -130,7 +130,7 @@ UIManagerJS.hasViewManagerConfig = (viewManagerName: string) =>
|
|
|
130
130
|
// getViewManagerConfig is implemented on the JSI object, so we don't
|
|
131
131
|
// need to hook this unless we are running in webdebugger
|
|
132
132
|
if (!global.nativeCallSyncHook)
|
|
133
|
-
// $FlowFixMe
|
|
133
|
+
// $FlowFixMe[prop-missing]
|
|
134
134
|
NativeUIManager.getViewManagerConfig = UIManagerJS.getViewManagerConfig;
|
|
135
135
|
|
|
136
136
|
function lazifyViewManagerConfig(viewName: string) {
|
|
@@ -199,7 +199,7 @@ if (!global.nativeCallSyncHook) {
|
|
|
199
199
|
`Accessing view manager configs directly off UIManager via UIManager['${viewManagerName}'] ` +
|
|
200
200
|
`is no longer supported. Use UIManager.getViewManagerConfig('${viewManagerName}') instead.`,
|
|
201
201
|
);
|
|
202
|
-
// $FlowFixMe
|
|
202
|
+
// $FlowFixMe[incompatible-return]
|
|
203
203
|
return UIManagerJS.getViewManagerConfig(viewManagerName);
|
|
204
204
|
},
|
|
205
205
|
});
|
|
@@ -13,124 +13,62 @@
|
|
|
13
13
|
* instances and get some data from them (like their instance handle / fiber).
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import type ReactNativeDocumentT from '../../../src/private/webapis/dom/nodes/ReactNativeDocument';
|
|
17
|
-
import typeof * as ReactNativeDocumentModuleT from '../../../src/private/webapis/dom/nodes/ReactNativeDocument';
|
|
18
|
-
import type ReactNativeElementT from '../../../src/private/webapis/dom/nodes/ReactNativeElement';
|
|
19
|
-
import type ReadOnlyTextT from '../../../src/private/webapis/dom/nodes/ReadOnlyText';
|
|
20
|
-
import typeof * as RendererProxyT from '../../ReactNative/RendererProxy';
|
|
21
16
|
import type {
|
|
22
17
|
InternalInstanceHandle,
|
|
23
18
|
Node,
|
|
24
19
|
ViewConfig,
|
|
25
20
|
} from '../../Renderer/shims/ReactNativeTypes';
|
|
26
21
|
import type {RootTag} from '../RootTag';
|
|
27
|
-
import type ReactFabricHostComponentT from './ReactFabricHostComponent';
|
|
28
22
|
|
|
29
|
-
import
|
|
23
|
+
import ReactNativeDocument, {
|
|
24
|
+
createReactNativeDocument,
|
|
25
|
+
} from '../../../src/private/webapis/dom/nodes/ReactNativeDocument';
|
|
26
|
+
import ReactNativeElement from '../../../src/private/webapis/dom/nodes/ReactNativeElement';
|
|
27
|
+
import ReadOnlyText from '../../../src/private/webapis/dom/nodes/ReadOnlyText';
|
|
28
|
+
import * as RendererProxy from '../../ReactNative/RendererProxy';
|
|
30
29
|
|
|
31
30
|
export opaque type PublicRootInstance = mixed;
|
|
32
31
|
|
|
33
|
-
// Lazy loaded to avoid evaluating the module when using the legacy renderer.
|
|
34
|
-
let ReactNativeDocumentModuleObject: ?ReactNativeDocumentModuleT;
|
|
35
|
-
let ReactFabricHostComponentClass: Class<ReactFabricHostComponentT>;
|
|
36
|
-
let ReactNativeElementClass: Class<ReactNativeElementT>;
|
|
37
|
-
let ReadOnlyTextClass: Class<ReadOnlyTextT>;
|
|
38
|
-
let RendererProxy: RendererProxyT;
|
|
39
|
-
|
|
40
|
-
function getReactNativeDocumentModule(): ReactNativeDocumentModuleT {
|
|
41
|
-
if (ReactNativeDocumentModuleObject == null) {
|
|
42
|
-
// We initialize this lazily to avoid a require cycle.
|
|
43
|
-
ReactNativeDocumentModuleObject = require('../../../src/private/webapis/dom/nodes/ReactNativeDocument');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return ReactNativeDocumentModuleObject;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function getReactNativeElementClass(): Class<ReactNativeElementT> {
|
|
50
|
-
if (ReactNativeElementClass == null) {
|
|
51
|
-
ReactNativeElementClass =
|
|
52
|
-
require('../../../src/private/webapis/dom/nodes/ReactNativeElement').default;
|
|
53
|
-
}
|
|
54
|
-
return ReactNativeElementClass;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function getReactFabricHostComponentClass(): Class<ReactFabricHostComponentT> {
|
|
58
|
-
if (ReactFabricHostComponentClass == null) {
|
|
59
|
-
ReactFabricHostComponentClass =
|
|
60
|
-
require('./ReactFabricHostComponent').default;
|
|
61
|
-
}
|
|
62
|
-
return ReactFabricHostComponentClass;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function getReadOnlyTextClass(): Class<ReadOnlyTextT> {
|
|
66
|
-
if (ReadOnlyTextClass == null) {
|
|
67
|
-
ReadOnlyTextClass =
|
|
68
|
-
require('../../../src/private/webapis/dom/nodes/ReadOnlyText').default;
|
|
69
|
-
}
|
|
70
|
-
return ReadOnlyTextClass;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
32
|
export function createPublicRootInstance(rootTag: RootTag): PublicRootInstance {
|
|
74
|
-
if (ReactNativeFeatureFlags.enableAccessToHostTreeInFabric()) {
|
|
75
|
-
const ReactNativeDocumentModule = getReactNativeDocumentModule();
|
|
76
|
-
|
|
77
|
-
// $FlowExpectedError[incompatible-return]
|
|
78
|
-
return ReactNativeDocumentModule.createReactNativeDocument(rootTag);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
33
|
// $FlowExpectedError[incompatible-return]
|
|
82
|
-
return
|
|
34
|
+
return createReactNativeDocument(rootTag);
|
|
83
35
|
}
|
|
84
36
|
|
|
85
37
|
export function createPublicInstance(
|
|
86
38
|
tag: number,
|
|
87
39
|
viewConfig: ViewConfig,
|
|
88
40
|
internalInstanceHandle: InternalInstanceHandle,
|
|
89
|
-
ownerDocument:
|
|
90
|
-
):
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
ownerDocument,
|
|
98
|
-
);
|
|
99
|
-
} else {
|
|
100
|
-
const ReactFabricHostComponent = getReactFabricHostComponentClass();
|
|
101
|
-
return new ReactFabricHostComponent(
|
|
102
|
-
tag,
|
|
103
|
-
viewConfig,
|
|
104
|
-
internalInstanceHandle,
|
|
105
|
-
);
|
|
106
|
-
}
|
|
41
|
+
ownerDocument: ReactNativeDocument,
|
|
42
|
+
): ReactNativeElement {
|
|
43
|
+
return new ReactNativeElement(
|
|
44
|
+
tag,
|
|
45
|
+
viewConfig,
|
|
46
|
+
internalInstanceHandle,
|
|
47
|
+
ownerDocument,
|
|
48
|
+
);
|
|
107
49
|
}
|
|
108
50
|
|
|
109
51
|
export function createPublicTextInstance(
|
|
110
52
|
internalInstanceHandle: InternalInstanceHandle,
|
|
111
|
-
ownerDocument:
|
|
112
|
-
):
|
|
113
|
-
const ReadOnlyText = getReadOnlyTextClass();
|
|
53
|
+
ownerDocument: ReactNativeDocument,
|
|
54
|
+
): ReadOnlyText {
|
|
114
55
|
return new ReadOnlyText(internalInstanceHandle, ownerDocument);
|
|
115
56
|
}
|
|
116
57
|
|
|
117
58
|
export function getNativeTagFromPublicInstance(
|
|
118
|
-
publicInstance:
|
|
59
|
+
publicInstance: ReactNativeElement,
|
|
119
60
|
): number {
|
|
120
61
|
return publicInstance.__nativeTag;
|
|
121
62
|
}
|
|
122
63
|
|
|
123
64
|
export function getNodeFromPublicInstance(
|
|
124
|
-
publicInstance:
|
|
65
|
+
publicInstance: ReactNativeElement,
|
|
125
66
|
): ?Node {
|
|
126
67
|
// Avoid loading ReactFabric if using an instance from the legacy renderer.
|
|
127
68
|
if (publicInstance.__internalInstanceHandle == null) {
|
|
128
69
|
return null;
|
|
129
70
|
}
|
|
130
71
|
|
|
131
|
-
if (RendererProxy == null) {
|
|
132
|
-
RendererProxy = require('../../ReactNative/RendererProxy');
|
|
133
|
-
}
|
|
134
72
|
return RendererProxy.getNodeFromInternalInstanceHandle(
|
|
135
73
|
// $FlowExpectedError[incompatible-type] __internalInstanceHandle is always an InternalInstanceHandle from React when we get here.
|
|
136
74
|
publicInstance.__internalInstanceHandle,
|
|
@@ -138,7 +76,7 @@ export function getNodeFromPublicInstance(
|
|
|
138
76
|
}
|
|
139
77
|
|
|
140
78
|
export function getInternalInstanceHandleFromPublicInstance(
|
|
141
|
-
publicInstance:
|
|
79
|
+
publicInstance: ReactNativeElement,
|
|
142
80
|
): InternalInstanceHandle {
|
|
143
81
|
// TODO(T174762768): Remove this once OSS versions of renderers will be synced.
|
|
144
82
|
// $FlowExpectedError[prop-missing] Keeping this for backwards-compatibility with the renderers versions in open source.
|