@office-iss/react-native-win32 0.69.0-preview.4 → 0.70.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/.eslintrc.js +0 -1
- package/.flowconfig +5 -1
- package/CHANGELOG.json +228 -24
- package/CHANGELOG.md +92 -14
- package/IntegrationTests/AsyncStorageTest.js +20 -4
- package/IntegrationTests/BUCK +2 -2
- package/IntegrationTests/LayoutEventsTest.js +4 -1
- package/IntegrationTests/{launchWebSocketServer.command → launchWebSocketServer.sh} +3 -9
- package/Libraries/Alert/Alert.js +18 -4
- package/Libraries/Alert/Alert.win32.js +2 -0
- package/Libraries/Alert/NativeAlertManager.js +1 -0
- package/Libraries/Animated/Animated.js +2 -2
- package/Libraries/Animated/AnimatedEvent.js +7 -4
- package/Libraries/Animated/AnimatedImplementation.js +17 -3
- package/Libraries/Animated/AnimatedMock.js +7 -2
- package/Libraries/Animated/NativeAnimatedHelper.js +220 -95
- package/Libraries/Animated/NativeAnimatedModule.js +3 -0
- package/Libraries/Animated/NativeAnimatedTurboModule.js +3 -0
- package/Libraries/Animated/animations/SpringAnimation.js +3 -3
- package/Libraries/Animated/animations/TimingAnimation.js +3 -3
- package/Libraries/Animated/createAnimatedComponent.js +8 -1
- package/Libraries/Animated/nodes/AnimatedAddition.js +3 -1
- package/Libraries/Animated/nodes/AnimatedColor.js +50 -29
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +3 -1
- package/Libraries/Animated/nodes/AnimatedDivision.js +3 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +22 -21
- package/Libraries/Animated/nodes/AnimatedModulo.js +3 -1
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +3 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +20 -12
- package/Libraries/Animated/nodes/AnimatedStyle.js +19 -16
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +3 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +5 -5
- package/Libraries/Animated/nodes/AnimatedValue.js +14 -5
- package/Libraries/Animated/nodes/AnimatedValueXY.js +28 -1
- package/Libraries/Animated/useAnimatedProps.js +1 -0
- package/Libraries/AppState/AppState.js +0 -32
- package/Libraries/BatchedBridge/MessageQueue.js +21 -15
- package/Libraries/BatchedBridge/NativeModules.js +3 -4
- package/Libraries/Blob/FileReader.js +0 -6
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +0 -20
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +0 -20
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
- package/Libraries/Components/Keyboard/Keyboard.js +0 -11
- package/Libraries/Components/Pressable/Pressable.js +2 -0
- package/Libraries/Components/Pressable/Pressable.win32.js +2 -0
- package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +1 -3
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +3 -30
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +4 -32
- package/Libraries/Components/ScrollView/ScrollView.js +13 -11
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -3
- package/Libraries/Components/StatusBar/StatusBar.js +10 -7
- package/Libraries/Components/TextInput/InputAccessoryView.js +14 -13
- package/Libraries/Components/TextInput/TextInput.js +12 -2
- package/Libraries/Components/Touchable/PooledClass.js +16 -4
- package/Libraries/Components/Touchable/Touchable.js +50 -1
- package/Libraries/Components/Touchable/Touchable.win32.js +972 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +0 -7
- package/Libraries/Components/View/ViewPropTypes.js +3 -8
- package/Libraries/Components/View/ViewPropTypes.win32.js +3 -8
- package/Libraries/Core/ExceptionsManager.js +2 -0
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/Timers/JSTimers.js +2 -2
- package/Libraries/Core/polyfillPromise.js +0 -32
- package/Libraries/Core/setUpBatchedBridge.js +5 -1
- package/Libraries/Core/setUpPerformance.js +1 -1
- package/Libraries/EventEmitter/NativeEventEmitter.js +0 -13
- package/Libraries/Image/AssetSourceResolver.js +2 -2
- package/Libraries/Image/Image.android.js +5 -3
- package/Libraries/Image/Image.ios.js +6 -3
- package/Libraries/Image/Image.win32.js +6 -3
- package/Libraries/Image/ImageSource.js +7 -5
- package/Libraries/Inspector/ElementBox.js +2 -2
- package/Libraries/Inspector/NetworkOverlay.js +13 -8
- package/Libraries/Interaction/PanResponder.js +16 -14
- package/Libraries/Linking/Linking.js +0 -11
- package/Libraries/Lists/FlatList.js +3 -2
- package/Libraries/Lists/SectionList.js +2 -0
- package/Libraries/Lists/ViewabilityHelper.js +7 -3
- package/Libraries/Lists/VirtualizeUtils.js +33 -20
- package/Libraries/Lists/VirtualizedList.js +93 -47
- package/Libraries/Lists/VirtualizedListContext.js +1 -0
- package/Libraries/Lists/VirtualizedSectionList.js +14 -9
- package/Libraries/Lists/__tests__/VirtualizeUtils-test.js +19 -18
- package/Libraries/Lists/__tests__/VirtualizedList-test.js +10 -6
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/LogBox.js +3 -1
- package/Libraries/LogBox/UI/AnsiHighlight.js +2 -0
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +3 -0
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +0 -3
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +8 -3
- package/Libraries/NativeComponent/BaseViewConfig.android.js +9 -18
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +26 -12
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +26 -12
- package/Libraries/Network/XMLHttpRequest.js +9 -11
- package/Libraries/Performance/PureComponentDebug.js +1 -0
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +9 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +16 -0
- package/Libraries/Pressability/Pressability.js +26 -16
- package/Libraries/Pressability/Pressability.win32.js +26 -16
- package/Libraries/Promise.js +0 -1
- package/Libraries/ReactNative/AppRegistry.js +16 -13
- package/Libraries/ReactNative/BridgelessUIManager.js +2 -0
- package/Libraries/ReactNative/PaperUIManager.js +9 -9
- package/Libraries/ReactNative/PaperUIManager.win32.js +7 -8
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +12 -0
- package/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js +68 -0
- package/Libraries/ReactNative/getNativeComponentAttributes.js +6 -7
- package/Libraries/ReactNative/renderApplication.js +1 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +4443 -3615
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +1496 -1170
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1694 -1356
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +4439 -3588
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1583 -1249
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1719 -1372
- package/Libraries/Storage/AsyncStorage.js +7 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +8 -0
- package/Libraries/StyleSheet/flattenStyle.js +1 -1
- package/Libraries/StyleSheet/processTransform.js +2 -0
- package/Libraries/StyleSheet/splitLayoutProps.js +2 -0
- package/Libraries/Text/Text.js +15 -7
- package/Libraries/Types/CoreEventTypes.js +137 -11
- package/Libraries/Types/CoreEventTypes.win32.js +147 -22
- package/Libraries/Utilities/Dimensions.js +0 -13
- package/Libraries/Utilities/Dimensions.win32.js +0 -9
- package/Libraries/Utilities/HMRClient.js +3 -3
- package/Libraries/Utilities/Platform.ios.js +0 -7
- package/Libraries/Utilities/ReactNativeTestTools.js +3 -1
- package/Libraries/Utilities/codegenNativeCommands.js +11 -2
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
- package/Libraries/Utilities/stringifySafe.js +3 -1
- package/Libraries/Utilities/truncate.js +1 -1
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +2 -2
- package/Libraries/Vibration/Vibration.js +1 -1
- package/Libraries/WebSocket/WebSocket.js +1 -0
- package/Libraries/vendor/emitter/EventEmitter.js +105 -12
- package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +73 -117
- package/flow/JSITimerInternalType.js +30 -0
- package/jest/assetFileTransformer.js +3 -2
- package/jest/setup.js +4 -0
- package/jest.config.js +0 -1
- package/overrides.json +23 -16
- package/package.json +21 -22
- package/rntypes/index.d.ts +0 -1
- package/src/rntypes/index.d.ts +0 -1
- package/Libraries/vendor/emitter/EventSubscription.js +0 -19
- package/Libraries/vendor/emitter/_EmitterSubscription.js +0 -62
- package/Libraries/vendor/emitter/_EventEmitter.js +0 -184
- package/Libraries/vendor/emitter/_EventSubscription.js +0 -45
- package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +0 -108
- package/jest/preprocessor.js +0 -40
- package/jest/preprocessor_DO_NOT_USE.js +0 -122
- package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizeUtils-test.js.snap +0 -3
|
@@ -312,11 +312,15 @@ class TouchableNativeFeedback extends React.Component<Props, State> {
|
|
|
312
312
|
|
|
313
313
|
const getBackgroundProp =
|
|
314
314
|
Platform.OS === 'android'
|
|
315
|
-
? (
|
|
315
|
+
? /* $FlowFixMe[missing-local-annot] The type annotation(s) required by
|
|
316
|
+
* Flow's LTI update could not be added via codemod */
|
|
317
|
+
(background, useForeground: boolean) =>
|
|
316
318
|
useForeground && TouchableNativeFeedback.canUseNativeForeground()
|
|
317
319
|
? {nativeForegroundAndroid: background}
|
|
318
320
|
: {nativeBackgroundAndroid: background}
|
|
319
|
-
: (
|
|
321
|
+
: /* $FlowFixMe[missing-local-annot] The type annotation(s) required by
|
|
322
|
+
* Flow's LTI update could not be added via codemod */
|
|
323
|
+
(background, useForeground: boolean) => null;
|
|
320
324
|
|
|
321
325
|
TouchableNativeFeedback.displayName = 'TouchableNativeFeedback';
|
|
322
326
|
|
|
@@ -85,14 +85,7 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
|
|
|
85
85
|
/**
|
|
86
86
|
* Transform
|
|
87
87
|
*/
|
|
88
|
-
decomposedMatrix: true, // @deprecated
|
|
89
|
-
rotation: true, // @deprecated
|
|
90
|
-
scaleX: true, // @deprecated
|
|
91
|
-
scaleY: true, // @deprecated
|
|
92
88
|
transform: {process: processTransform},
|
|
93
|
-
transformMatrix: true, // @deprecated
|
|
94
|
-
translateX: true, // @deprecated
|
|
95
|
-
translateY: true, // @deprecated
|
|
96
89
|
|
|
97
90
|
/**
|
|
98
91
|
* View
|
|
@@ -92,22 +92,17 @@ type MouseEventProps = $ReadOnly<{|
|
|
|
92
92
|
// Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use)
|
|
93
93
|
type PointerEventProps = $ReadOnly<{|
|
|
94
94
|
onPointerEnter?: ?(event: PointerEvent) => void,
|
|
95
|
+
onPointerEnterCapture?: ?(event: PointerEvent) => void,
|
|
95
96
|
onPointerLeave?: ?(event: PointerEvent) => void,
|
|
97
|
+
onPointerLeaveCapture?: ?(event: PointerEvent) => void,
|
|
96
98
|
onPointerMove?: ?(event: PointerEvent) => void,
|
|
99
|
+
onPointerMoveCapture?: ?(event: PointerEvent) => void,
|
|
97
100
|
onPointerCancel?: ?(e: PointerEvent) => void,
|
|
98
101
|
onPointerCancelCapture?: ?(e: PointerEvent) => void,
|
|
99
102
|
onPointerDown?: ?(e: PointerEvent) => void,
|
|
100
103
|
onPointerDownCapture?: ?(e: PointerEvent) => void,
|
|
101
104
|
onPointerUp?: ?(e: PointerEvent) => void,
|
|
102
105
|
onPointerUpCapture?: ?(e: PointerEvent) => void,
|
|
103
|
-
|
|
104
|
-
// FIXME: these events are temporary while we converge pointer event handling
|
|
105
|
-
onPointerEnter2?: ?(e: PointerEvent) => void,
|
|
106
|
-
onPointerEnter2Capture?: ?(e: PointerEvent) => void,
|
|
107
|
-
onPointerLeave2?: ?(e: PointerEvent) => void,
|
|
108
|
-
onPointerLeave2Capture?: ?(e: PointerEvent) => void,
|
|
109
|
-
onPointerMove2?: ?(e: PointerEvent) => void,
|
|
110
|
-
onPointerMove2Capture?: ?(e: PointerEvent) => void,
|
|
111
106
|
|}>;
|
|
112
107
|
|
|
113
108
|
type TouchEventProps = $ReadOnly<{|
|
|
@@ -93,22 +93,17 @@ type MouseEventProps = $ReadOnly<{|
|
|
|
93
93
|
// Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use)
|
|
94
94
|
type PointerEventProps = $ReadOnly<{|
|
|
95
95
|
onPointerEnter?: ?(event: PointerEvent) => void,
|
|
96
|
+
onPointerEnterCapture?: ?(event: PointerEvent) => void,
|
|
96
97
|
onPointerLeave?: ?(event: PointerEvent) => void,
|
|
98
|
+
onPointerLeaveCapture?: ?(event: PointerEvent) => void,
|
|
97
99
|
onPointerMove?: ?(event: PointerEvent) => void,
|
|
100
|
+
onPointerMoveCapture?: ?(event: PointerEvent) => void,
|
|
98
101
|
onPointerCancel?: ?(e: PointerEvent) => void,
|
|
99
102
|
onPointerCancelCapture?: ?(e: PointerEvent) => void,
|
|
100
103
|
onPointerDown?: ?(e: PointerEvent) => void,
|
|
101
104
|
onPointerDownCapture?: ?(e: PointerEvent) => void,
|
|
102
105
|
onPointerUp?: ?(e: PointerEvent) => void,
|
|
103
106
|
onPointerUpCapture?: ?(e: PointerEvent) => void,
|
|
104
|
-
|
|
105
|
-
// FIXME: these events are temporary while we converge pointer event handling
|
|
106
|
-
onPointerEnter2?: ?(e: PointerEvent) => void,
|
|
107
|
-
onPointerEnter2Capture?: ?(e: PointerEvent) => void,
|
|
108
|
-
onPointerLeave2?: ?(e: PointerEvent) => void,
|
|
109
|
-
onPointerLeave2Capture?: ?(e: PointerEvent) => void,
|
|
110
|
-
onPointerMove2?: ?(e: PointerEvent) => void,
|
|
111
|
-
onPointerMove2Capture?: ?(e: PointerEvent) => void,
|
|
112
107
|
|}>;
|
|
113
108
|
|
|
114
109
|
type TouchEventProps = $ReadOnly<{|
|
|
@@ -144,6 +144,8 @@ function handleException(e: mixed, isFatal: boolean) {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
148
|
+
* LTI update could not be added via codemod */
|
|
147
149
|
function reactConsoleErrorHandler(...args) {
|
|
148
150
|
// bubble up to any original handlers
|
|
149
151
|
console._errorOriginal(...args);
|
|
@@ -274,7 +274,7 @@ const JSTimers = {
|
|
|
274
274
|
const timeout = options && options.timeout;
|
|
275
275
|
const id = _allocateCallback(
|
|
276
276
|
timeout != null
|
|
277
|
-
? deadline => {
|
|
277
|
+
? (deadline: any) => {
|
|
278
278
|
const timeoutId = requestIdleCallbackTimeouts[id];
|
|
279
279
|
if (timeoutId) {
|
|
280
280
|
JSTimers.clearTimeout(timeoutId);
|
|
@@ -364,7 +364,7 @@ const JSTimers = {
|
|
|
364
364
|
// error one at a time
|
|
365
365
|
for (let ii = 1; ii < errorCount; ii++) {
|
|
366
366
|
JSTimers.setTimeout(
|
|
367
|
-
(error => {
|
|
367
|
+
((error: Error) => {
|
|
368
368
|
throw error;
|
|
369
369
|
}).bind(null, errors[ii]),
|
|
370
370
|
0,
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
const {polyfillGlobal} = require('../Utilities/PolyfillFunctions');
|
|
14
|
-
const warnOnce = require('../Utilities/warnOnce');
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Set up Promise. The native Promise implementation throws the following error:
|
|
@@ -37,34 +36,3 @@ if (global?.HermesInternal?.hasPromise?.()) {
|
|
|
37
36
|
} else {
|
|
38
37
|
polyfillGlobal('Promise', () => require('../Promise'));
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
if (__DEV__) {
|
|
42
|
-
// $FlowFixMe
|
|
43
|
-
const done = Promise.prototype.done;
|
|
44
|
-
if (done != null) {
|
|
45
|
-
let depth = 0;
|
|
46
|
-
/* eslint-disable no-extend-native */
|
|
47
|
-
// $FlowFixMe
|
|
48
|
-
Promise.prototype.done = function () {
|
|
49
|
-
++depth;
|
|
50
|
-
try {
|
|
51
|
-
// Avoid infinite recursion if done() happens to be triggered by warnOnce.
|
|
52
|
-
if (depth === 1) {
|
|
53
|
-
// Warn once per unique call stack. Not super efficient, but we're in
|
|
54
|
-
// __DEV__ and .done() calls are rare to begin with.
|
|
55
|
-
const key = new Error().stack;
|
|
56
|
-
warnOnce(
|
|
57
|
-
key,
|
|
58
|
-
'Promise.prototype.done(): This nonstandard polyfill ' +
|
|
59
|
-
'has been deprecated and will be removed in a future release. ' +
|
|
60
|
-
'Please instead use `.then()`.',
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
} finally {
|
|
64
|
-
--depth;
|
|
65
|
-
}
|
|
66
|
-
return done.apply(this, arguments);
|
|
67
|
-
};
|
|
68
|
-
/* eslint-enable no-extend-native */
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -27,12 +27,16 @@ if (global.RN$Bridgeless === true && global.RN$registerCallableModule) {
|
|
|
27
27
|
| $TEMPORARY$string<'RCTNativeAppEventEmitter'>
|
|
28
28
|
| $TEMPORARY$string<'SamplingProfiler'>
|
|
29
29
|
| $TEMPORARY$string<'Systrace'>,
|
|
30
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by
|
|
31
|
+
* Flow's LTI update could not be added via codemod */
|
|
30
32
|
factory,
|
|
31
33
|
) => BatchedBridge.registerLazyCallableModule(moduleName, factory);
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
registerModule('Systrace', () => require('../Performance/Systrace'));
|
|
35
|
-
|
|
37
|
+
if (!(global.RN$Bridgeless === true)) {
|
|
38
|
+
registerModule('JSTimers', () => require('./Timers/JSTimers'));
|
|
39
|
+
}
|
|
36
40
|
registerModule('HeapCapture', () => require('../HeapCapture/HeapCapture'));
|
|
37
41
|
registerModule('SamplingProfiler', () =>
|
|
38
42
|
require('../Performance/SamplingProfiler'),
|
|
@@ -95,19 +95,6 @@ export default class NativeEventEmitter<TEventToArgsMap: {...}>
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
/**
|
|
99
|
-
* @deprecated Use `remove` on the EventSubscription from `addListener`.
|
|
100
|
-
*/
|
|
101
|
-
removeListener<TEvent: $Keys<TEventToArgsMap>>(
|
|
102
|
-
eventType: TEvent,
|
|
103
|
-
listener: (...args: $ElementType<TEventToArgsMap, TEvent>) => mixed,
|
|
104
|
-
): void {
|
|
105
|
-
this._nativeModule?.removeListeners(1);
|
|
106
|
-
// NOTE: This will report a deprecation notice via `console.error`.
|
|
107
|
-
// $FlowFixMe[prop-missing] - `removeListener` exists but is deprecated.
|
|
108
|
-
RCTDeviceEventEmitter.removeListener(eventType, listener);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
98
|
emit<TEvent: $Keys<TEventToArgsMap>>(
|
|
112
99
|
eventType: TEvent,
|
|
113
100
|
...args: $ElementType<TEventToArgsMap, TEvent>
|
|
@@ -35,7 +35,7 @@ const {
|
|
|
35
35
|
/**
|
|
36
36
|
* Returns a path like 'assets/AwesomeModule/icon@2x.png'
|
|
37
37
|
*/
|
|
38
|
-
function getScaledAssetPath(asset): string {
|
|
38
|
+
function getScaledAssetPath(asset: PackagerAsset): string {
|
|
39
39
|
const scale = pickScale(asset.scales, PixelRatio.get());
|
|
40
40
|
const scaleSuffix = scale === 1 ? '' : '@' + scale + 'x';
|
|
41
41
|
const assetDir = getBasePath(asset);
|
|
@@ -45,7 +45,7 @@ function getScaledAssetPath(asset): string {
|
|
|
45
45
|
/**
|
|
46
46
|
* Returns a path like 'drawable-mdpi/icon.png'
|
|
47
47
|
*/
|
|
48
|
-
function getAssetPathInDrawableFolder(asset): string {
|
|
48
|
+
function getAssetPathInDrawableFolder(asset: PackagerAsset): string {
|
|
49
49
|
const scale = pickScale(asset.scales, PixelRatio.get());
|
|
50
50
|
const drawbleFolder = getAndroidResourceFolderName(asset, scale);
|
|
51
51
|
const fileName = getAndroidResourceIdentifier(asset);
|
|
@@ -123,7 +123,9 @@ export type ImageComponentStatics = $ReadOnly<{|
|
|
|
123
123
|
*
|
|
124
124
|
* See https://reactnative.dev/docs/image
|
|
125
125
|
*/
|
|
126
|
-
|
|
126
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
127
|
+
* LTI update could not be added via codemod */
|
|
128
|
+
const BaseImage = (props: ImagePropsType, forwardedRef) => {
|
|
127
129
|
let source = resolveAssetSource(props.source);
|
|
128
130
|
const defaultSource = resolveAssetSource(props.defaultSource);
|
|
129
131
|
const loadingIndicatorSource = resolveAssetSource(
|
|
@@ -221,11 +223,11 @@ let Image = (props: ImagePropsType, forwardedRef) => {
|
|
|
221
223
|
);
|
|
222
224
|
};
|
|
223
225
|
|
|
224
|
-
Image = React.forwardRef<
|
|
226
|
+
let Image = React.forwardRef<
|
|
225
227
|
ImagePropsType,
|
|
226
228
|
| React.ElementRef<typeof TextInlineImageNativeComponent>
|
|
227
229
|
| React.ElementRef<typeof ImageViewNativeComponent>,
|
|
228
|
-
>(
|
|
230
|
+
>(BaseImage);
|
|
229
231
|
|
|
230
232
|
if (ImageInjection.unstable_createImageComponent != null) {
|
|
231
233
|
Image = ImageInjection.unstable_createImageComponent(Image);
|
|
@@ -102,7 +102,9 @@ export type ImageComponentStatics = $ReadOnly<{|
|
|
|
102
102
|
*
|
|
103
103
|
* See https://reactnative.dev/docs/image
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
106
|
+
* LTI update could not be added via codemod */
|
|
107
|
+
const BaseImage = (props: ImagePropsType, forwardedRef) => {
|
|
106
108
|
const source = resolveAssetSource(props.source) || {
|
|
107
109
|
uri: undefined,
|
|
108
110
|
width: undefined,
|
|
@@ -158,11 +160,12 @@ let Image = (props: ImagePropsType, forwardedRef) => {
|
|
|
158
160
|
);
|
|
159
161
|
};
|
|
160
162
|
|
|
161
|
-
|
|
163
|
+
const ImageForwardRef = React.forwardRef<
|
|
162
164
|
ImagePropsType,
|
|
163
165
|
React.ElementRef<typeof ImageViewNativeComponent>,
|
|
164
|
-
>(
|
|
166
|
+
>(BaseImage);
|
|
165
167
|
|
|
168
|
+
let Image = ImageForwardRef;
|
|
166
169
|
if (ImageInjection.unstable_createImageComponent != null) {
|
|
167
170
|
Image = ImageInjection.unstable_createImageComponent(Image);
|
|
168
171
|
}
|
|
@@ -124,7 +124,9 @@ export type ImageComponentStatics = $ReadOnly<{|
|
|
|
124
124
|
*
|
|
125
125
|
* See https://reactnative.dev/docs/image
|
|
126
126
|
*/
|
|
127
|
-
|
|
127
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
128
|
+
* LTI update could not be added via codemod */
|
|
129
|
+
const BaseImage = (props: ImagePropsType, forwardedRef) => {
|
|
128
130
|
const source = resolveAssetSource(props.source) || {
|
|
129
131
|
uri: undefined,
|
|
130
132
|
width: undefined,
|
|
@@ -193,11 +195,12 @@ let Image = (props: ImagePropsType, forwardedRef) => {
|
|
|
193
195
|
);
|
|
194
196
|
};
|
|
195
197
|
|
|
196
|
-
|
|
198
|
+
const ImageForwardRef = React.forwardRef<
|
|
197
199
|
ImagePropsType,
|
|
198
200
|
React.ElementRef<typeof ImageViewNativeComponent>,
|
|
199
|
-
>(
|
|
201
|
+
>(BaseImage);
|
|
200
202
|
|
|
203
|
+
let Image = ImageForwardRef;
|
|
201
204
|
if (ImageInjection.unstable_createImageComponent != null) {
|
|
202
205
|
Image = ImageInjection.unstable_createImageComponent(Image);
|
|
203
206
|
}
|
|
@@ -91,9 +91,7 @@ export type ImageSource =
|
|
|
91
91
|
| ImageURISource
|
|
92
92
|
| $ReadOnlyArray<ImageURISource>;
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
imageSource: ImageURISource,
|
|
96
|
-
): $ReadOnly<{
|
|
94
|
+
type ImageSourceProperties = {
|
|
97
95
|
body?: ?string,
|
|
98
96
|
bundle?: ?string,
|
|
99
97
|
cache?: ?('default' | 'reload' | 'force-cache' | 'only-if-cached'),
|
|
@@ -104,8 +102,12 @@ export function getImageSourceProperties(
|
|
|
104
102
|
uri?: ?string,
|
|
105
103
|
width?: ?number,
|
|
106
104
|
...
|
|
107
|
-
}
|
|
108
|
-
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export function getImageSourceProperties(
|
|
108
|
+
imageSource: ImageURISource,
|
|
109
|
+
): $ReadOnly<ImageSourceProperties> {
|
|
110
|
+
const object: ImageSourceProperties = {};
|
|
109
111
|
if (imageSource.body != null) {
|
|
110
112
|
object.body = imageSource.body;
|
|
111
113
|
}
|
|
@@ -26,7 +26,7 @@ class ElementBox extends React.Component<$FlowFixMeProps> {
|
|
|
26
26
|
let padding = resolveBoxStyle('padding', style);
|
|
27
27
|
|
|
28
28
|
const frameStyle = {...this.props.frame};
|
|
29
|
-
const contentStyle = {
|
|
29
|
+
const contentStyle: {width: number, height: number} = {
|
|
30
30
|
width: this.props.frame.width,
|
|
31
31
|
height: this.props.frame.height,
|
|
32
32
|
};
|
|
@@ -102,7 +102,7 @@ type Style = {
|
|
|
102
102
|
* @return a modified copy
|
|
103
103
|
*/
|
|
104
104
|
function resolveRelativeSizes(style: $ReadOnly<Style>): Style {
|
|
105
|
-
let resolvedStyle =
|
|
105
|
+
let resolvedStyle = {...style};
|
|
106
106
|
resolveSizeInPlace(resolvedStyle, 'top', 'height');
|
|
107
107
|
resolveSizeInPlace(resolvedStyle, 'right', 'width');
|
|
108
108
|
resolveSizeInPlace(resolvedStyle, 'bottom', 'height');
|
|
@@ -10,15 +10,17 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
import type {RenderItemProps} from '../Lists/VirtualizedList';
|
|
14
|
+
|
|
15
15
|
const ScrollView = require('../Components/ScrollView/ScrollView');
|
|
16
|
-
const StyleSheet = require('../StyleSheet/StyleSheet');
|
|
17
|
-
const Text = require('../Text/Text');
|
|
18
16
|
const TouchableHighlight = require('../Components/Touchable/TouchableHighlight');
|
|
19
17
|
const View = require('../Components/View/View');
|
|
20
|
-
const
|
|
18
|
+
const FlatList = require('../Lists/FlatList');
|
|
21
19
|
const XHRInterceptor = require('../Network/XHRInterceptor');
|
|
20
|
+
const StyleSheet = require('../StyleSheet/StyleSheet');
|
|
21
|
+
const Text = require('../Text/Text');
|
|
22
|
+
const WebSocketInterceptor = require('../WebSocket/WebSocketInterceptor');
|
|
23
|
+
const React = require('react');
|
|
22
24
|
|
|
23
25
|
const LISTVIEW_CELL_HEIGHT = 15;
|
|
24
26
|
|
|
@@ -100,7 +102,7 @@ class NetworkOverlay extends React.Component<Props, State> {
|
|
|
100
102
|
};
|
|
101
103
|
|
|
102
104
|
// Map of `socketId` -> `index in `this.state.requests`.
|
|
103
|
-
_socketIdMap = {};
|
|
105
|
+
_socketIdMap: {[string]: number} = {};
|
|
104
106
|
// Map of `xhr._index` -> `index in `this.state.requests`.
|
|
105
107
|
_xhrIdMap: {[key: number]: number, ...} = {};
|
|
106
108
|
|
|
@@ -326,7 +328,10 @@ class NetworkOverlay extends React.Component<Props, State> {
|
|
|
326
328
|
WebSocketInterceptor.disableInterception();
|
|
327
329
|
}
|
|
328
330
|
|
|
329
|
-
_renderItem = ({
|
|
331
|
+
_renderItem = ({
|
|
332
|
+
item,
|
|
333
|
+
index,
|
|
334
|
+
}: RenderItemProps<NetworkRequestInfo>): React.Element<any> => {
|
|
330
335
|
const tableRowViewStyle = [
|
|
331
336
|
styles.tableRow,
|
|
332
337
|
index % 2 === 1 ? styles.tableRowOdd : styles.tableRowEven,
|
|
@@ -358,7 +363,7 @@ class NetworkOverlay extends React.Component<Props, State> {
|
|
|
358
363
|
);
|
|
359
364
|
};
|
|
360
365
|
|
|
361
|
-
_renderItemDetail(id) {
|
|
366
|
+
_renderItemDetail(id: number) {
|
|
362
367
|
const requestItem = this.state.requests[id];
|
|
363
368
|
const details = Object.keys(requestItem).map(key => {
|
|
364
369
|
if (key === 'id') {
|
|
@@ -190,6 +190,21 @@ type ActiveCallback = (
|
|
|
190
190
|
|
|
191
191
|
type PassiveCallback = (event: PressEvent, gestureState: GestureState) => mixed;
|
|
192
192
|
|
|
193
|
+
type PanHandlers = {|
|
|
194
|
+
onMoveShouldSetResponder: (event: PressEvent) => boolean,
|
|
195
|
+
onMoveShouldSetResponderCapture: (event: PressEvent) => boolean,
|
|
196
|
+
onResponderEnd: (event: PressEvent) => void,
|
|
197
|
+
onResponderGrant: (event: PressEvent) => boolean,
|
|
198
|
+
onResponderMove: (event: PressEvent) => void,
|
|
199
|
+
onResponderReject: (event: PressEvent) => void,
|
|
200
|
+
onResponderRelease: (event: PressEvent) => void,
|
|
201
|
+
onResponderStart: (event: PressEvent) => void,
|
|
202
|
+
onResponderTerminate: (event: PressEvent) => void,
|
|
203
|
+
onResponderTerminationRequest: (event: PressEvent) => boolean,
|
|
204
|
+
onStartShouldSetResponder: (event: PressEvent) => boolean,
|
|
205
|
+
onStartShouldSetResponderCapture: (event: PressEvent) => boolean,
|
|
206
|
+
|};
|
|
207
|
+
|
|
193
208
|
type PanResponderConfig = $ReadOnly<{|
|
|
194
209
|
onMoveShouldSetPanResponder?: ?ActiveCallback,
|
|
195
210
|
onMoveShouldSetPanResponderCapture?: ?ActiveCallback,
|
|
@@ -385,20 +400,7 @@ const PanResponder = {
|
|
|
385
400
|
*/
|
|
386
401
|
create(config: PanResponderConfig): $TEMPORARY$object<{|
|
|
387
402
|
getInteractionHandle: () => ?number,
|
|
388
|
-
panHandlers:
|
|
389
|
-
onMoveShouldSetResponder: (event: PressEvent) => boolean,
|
|
390
|
-
onMoveShouldSetResponderCapture: (event: PressEvent) => boolean,
|
|
391
|
-
onResponderEnd: (event: PressEvent) => void,
|
|
392
|
-
onResponderGrant: (event: PressEvent) => boolean,
|
|
393
|
-
onResponderMove: (event: PressEvent) => void,
|
|
394
|
-
onResponderReject: (event: PressEvent) => void,
|
|
395
|
-
onResponderRelease: (event: PressEvent) => void,
|
|
396
|
-
onResponderStart: (event: PressEvent) => void,
|
|
397
|
-
onResponderTerminate: (event: PressEvent) => void,
|
|
398
|
-
onResponderTerminationRequest: (event: PressEvent) => boolean,
|
|
399
|
-
onStartShouldSetResponder: (event: PressEvent) => boolean,
|
|
400
|
-
onStartShouldSetResponderCapture: (event: PressEvent) => boolean,
|
|
401
|
-
|}>,
|
|
403
|
+
panHandlers: PanHandlers,
|
|
402
404
|
|}> {
|
|
403
405
|
const interactionState = {
|
|
404
406
|
handle: (null: ?number),
|
|
@@ -46,17 +46,6 @@ class Linking extends NativeEventEmitter<LinkingEventDefinitions> {
|
|
|
46
46
|
return this.addListener(eventType, listener);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated Use `remove` on the EventSubscription from `addEventListener`.
|
|
51
|
-
*/
|
|
52
|
-
removeEventListener<K: $Keys<LinkingEventDefinitions>>(
|
|
53
|
-
eventType: K,
|
|
54
|
-
listener: (...$ElementType<LinkingEventDefinitions, K>) => mixed,
|
|
55
|
-
): void {
|
|
56
|
-
// NOTE: This will report a deprecation notice via `console.error`.
|
|
57
|
-
this.removeListener(eventType, listener);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
49
|
/**
|
|
61
50
|
* Try to open the given `url` with any of the installed apps.
|
|
62
51
|
*
|
|
@@ -459,7 +459,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
459
459
|
_listRef: ?React.ElementRef<typeof VirtualizedList>;
|
|
460
460
|
_virtualizedListPairs: Array<ViewabilityConfigCallbackPair> = [];
|
|
461
461
|
|
|
462
|
-
_captureRef = ref => {
|
|
462
|
+
_captureRef = (ref: ?React.ElementRef<typeof VirtualizedList>) => {
|
|
463
463
|
this._listRef = ref;
|
|
464
464
|
};
|
|
465
465
|
|
|
@@ -596,7 +596,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
596
596
|
? 'ListItemComponent'
|
|
597
597
|
: 'renderItem';
|
|
598
598
|
|
|
599
|
-
const renderer = (props): React.Node => {
|
|
599
|
+
const renderer = (props: RenderItemProps<ItemT>): React.Node => {
|
|
600
600
|
if (ListItemComponent) {
|
|
601
601
|
// $FlowFixMe[not-a-component] Component isn't valid
|
|
602
602
|
// $FlowFixMe[incompatible-type-arg] Component isn't valid
|
|
@@ -625,6 +625,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
625
625
|
<View style={StyleSheet.compose(styles.row, columnWrapperStyle)}>
|
|
626
626
|
{item.map((it, kk) => {
|
|
627
627
|
const element = renderer({
|
|
628
|
+
// $FlowFixMe[incompatible-call]
|
|
628
629
|
item: it,
|
|
629
630
|
index: index * cols + kk,
|
|
630
631
|
separators: info.separators,
|
|
@@ -255,6 +255,8 @@ export default class SectionList<
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
_wrapperListRef: ?React.ElementRef<typeof VirtualizedSectionList>;
|
|
258
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
259
|
+
* LTI update could not be added via codemod */
|
|
258
260
|
_captureRef = ref => {
|
|
259
261
|
this._wrapperListRef = ref;
|
|
260
262
|
};
|
|
@@ -259,9 +259,13 @@ class ViewabilityHelper {
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
_onUpdateSync(
|
|
262
|
-
viewableIndicesToCheck
|
|
263
|
-
onViewableItemsChanged
|
|
264
|
-
|
|
262
|
+
viewableIndicesToCheck: Array<number>,
|
|
263
|
+
onViewableItemsChanged: ({
|
|
264
|
+
changed: Array<ViewToken>,
|
|
265
|
+
viewableItems: Array<ViewToken>,
|
|
266
|
+
...
|
|
267
|
+
}) => void,
|
|
268
|
+
createViewToken: (index: number, isViewable: boolean) => ViewToken,
|
|
265
269
|
) {
|
|
266
270
|
// Filter out indices that have gone out of view since this call was scheduled.
|
|
267
271
|
viewableIndicesToCheck = viewableIndicesToCheck.filter(ii =>
|
|
@@ -25,28 +25,38 @@ export function elementsThatOverlapOffsets(
|
|
|
25
25
|
offset: number,
|
|
26
26
|
...
|
|
27
27
|
},
|
|
28
|
+
zoomScale: number = 1,
|
|
28
29
|
): Array<number> {
|
|
29
|
-
const
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
const result = [];
|
|
31
|
+
for (let offsetIndex = 0; offsetIndex < offsets.length; offsetIndex++) {
|
|
32
|
+
const currentOffset = offsets[offsetIndex];
|
|
33
|
+
let left = 0;
|
|
34
|
+
let right = itemCount - 1;
|
|
35
|
+
|
|
36
|
+
while (left <= right) {
|
|
37
|
+
// eslint-disable-next-line no-bitwise
|
|
38
|
+
const mid = left + ((right - left) >>> 1);
|
|
39
|
+
const frame = getFrameMetrics(mid);
|
|
40
|
+
const scaledOffsetStart = frame.offset * zoomScale;
|
|
41
|
+
const scaledOffsetEnd = (frame.offset + frame.length) * zoomScale;
|
|
42
|
+
|
|
43
|
+
// We want the first frame that contains the offset, with inclusive bounds. Thus, for the
|
|
44
|
+
// first frame the scaledOffsetStart is inclusive, while for other frames it is exclusive.
|
|
45
|
+
if (
|
|
46
|
+
(mid === 0 && currentOffset < scaledOffsetStart) ||
|
|
47
|
+
(mid !== 0 && currentOffset <= scaledOffsetStart)
|
|
48
|
+
) {
|
|
49
|
+
right = mid - 1;
|
|
50
|
+
} else if (currentOffset > scaledOffsetEnd) {
|
|
51
|
+
left = mid + 1;
|
|
52
|
+
} else {
|
|
53
|
+
result[offsetIndex] = mid;
|
|
54
|
+
break;
|
|
46
55
|
}
|
|
47
56
|
}
|
|
48
57
|
}
|
|
49
|
-
|
|
58
|
+
|
|
59
|
+
return result;
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
/**
|
|
@@ -104,6 +114,7 @@ export function computeWindowedRenderLimits(
|
|
|
104
114
|
offset: number,
|
|
105
115
|
velocity: number,
|
|
106
116
|
visibleLength: number,
|
|
117
|
+
zoomScale: number,
|
|
107
118
|
...
|
|
108
119
|
},
|
|
109
120
|
): {
|
|
@@ -115,7 +126,7 @@ export function computeWindowedRenderLimits(
|
|
|
115
126
|
if (itemCount === 0) {
|
|
116
127
|
return prev;
|
|
117
128
|
}
|
|
118
|
-
const {offset, velocity, visibleLength} = scrollMetrics;
|
|
129
|
+
const {offset, velocity, visibleLength, zoomScale = 1} = scrollMetrics;
|
|
119
130
|
|
|
120
131
|
// Start with visible area, then compute maximum overscan region by expanding from there, biased
|
|
121
132
|
// in the direction of scroll. Total overscan area is capped, which should cap memory consumption
|
|
@@ -136,7 +147,8 @@ export function computeWindowedRenderLimits(
|
|
|
136
147
|
);
|
|
137
148
|
const overscanEnd = Math.max(0, visibleEnd + leadFactor * overscanLength);
|
|
138
149
|
|
|
139
|
-
const lastItemOffset =
|
|
150
|
+
const lastItemOffset =
|
|
151
|
+
getFrameMetricsApprox(itemCount - 1).offset * zoomScale;
|
|
140
152
|
if (lastItemOffset < overscanBegin) {
|
|
141
153
|
// Entire list is before our overscan window
|
|
142
154
|
return {
|
|
@@ -150,6 +162,7 @@ export function computeWindowedRenderLimits(
|
|
|
150
162
|
[overscanBegin, visibleBegin, visibleEnd, overscanEnd],
|
|
151
163
|
itemCount,
|
|
152
164
|
getFrameMetricsApprox,
|
|
165
|
+
zoomScale,
|
|
153
166
|
);
|
|
154
167
|
overscanFirst = overscanFirst == null ? 0 : overscanFirst;
|
|
155
168
|
first = first == null ? Math.max(0, overscanFirst) : first;
|