@office-iss/react-native-win32 0.69.0 → 0.70.0-preview.1
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 +194 -32
- package/CHANGELOG.md +79 -19
- 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 +23 -24
- 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
|
@@ -198,6 +198,8 @@ const AsyncStorage = {
|
|
|
198
198
|
*
|
|
199
199
|
* See https://reactnative.dev/docs/asyncstorage#flushgetrequests
|
|
200
200
|
* */
|
|
201
|
+
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
|
202
|
+
* Flow's LTI update could not be added via codemod */
|
|
201
203
|
flushGetRequests: function (): void {
|
|
202
204
|
const getRequests = this._getRequests;
|
|
203
205
|
const getKeys = this._getKeys;
|
|
@@ -213,7 +215,7 @@ const AsyncStorage = {
|
|
|
213
215
|
//
|
|
214
216
|
// Is there a way to avoid using the map but fix the bug in this breaking test?
|
|
215
217
|
// https://github.com/facebook/react-native/commit/8dd8ad76579d7feef34c014d387bf02065692264
|
|
216
|
-
const map = {};
|
|
218
|
+
const map: {[string]: string} = {};
|
|
217
219
|
result &&
|
|
218
220
|
result.forEach(([key, value]) => {
|
|
219
221
|
map[key] = value;
|
|
@@ -237,6 +239,8 @@ const AsyncStorage = {
|
|
|
237
239
|
*
|
|
238
240
|
* See https://reactnative.dev/docs/asyncstorage#multiget
|
|
239
241
|
*/
|
|
242
|
+
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
|
243
|
+
* Flow's LTI update could not be added via codemod */
|
|
240
244
|
multiGet: function (
|
|
241
245
|
keys: Array<string>,
|
|
242
246
|
callback?: ?(errors: ?Array<Error>, result: ?Array<Array<string>>) => void,
|
|
@@ -366,6 +370,8 @@ function convertErrors(
|
|
|
366
370
|
|
|
367
371
|
declare function convertError(void | null): null;
|
|
368
372
|
declare function convertError({message: string, key?: string}): Error;
|
|
373
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
374
|
+
* LTI update could not be added via codemod */
|
|
369
375
|
function convertError(error) {
|
|
370
376
|
if (!error) {
|
|
371
377
|
return null;
|
|
@@ -58,9 +58,13 @@ export const normalizeColorObject = (
|
|
|
58
58
|
const dynamic = color.dynamic;
|
|
59
59
|
const dynamicColor: NativeColorValue = {
|
|
60
60
|
dynamic: {
|
|
61
|
+
// $FlowFixMe[incompatible-use]
|
|
61
62
|
light: normalizeColor(dynamic.light),
|
|
63
|
+
// $FlowFixMe[incompatible-use]
|
|
62
64
|
dark: normalizeColor(dynamic.dark),
|
|
65
|
+
// $FlowFixMe[incompatible-use]
|
|
63
66
|
highContrastLight: normalizeColor(dynamic.highContrastLight),
|
|
67
|
+
// $FlowFixMe[incompatible-use]
|
|
64
68
|
highContrastDark: normalizeColor(dynamic.highContrastDark),
|
|
65
69
|
},
|
|
66
70
|
};
|
|
@@ -78,9 +82,13 @@ export const processColorObject = (
|
|
|
78
82
|
const dynamic = color.dynamic;
|
|
79
83
|
const dynamicColor: NativeColorValue = {
|
|
80
84
|
dynamic: {
|
|
85
|
+
// $FlowFixMe[incompatible-use]
|
|
81
86
|
light: processColor(dynamic.light),
|
|
87
|
+
// $FlowFixMe[incompatible-use]
|
|
82
88
|
dark: processColor(dynamic.dark),
|
|
89
|
+
// $FlowFixMe[incompatible-use]
|
|
83
90
|
highContrastLight: processColor(dynamic.highContrastLight),
|
|
91
|
+
// $FlowFixMe[incompatible-use]
|
|
84
92
|
highContrastDark: processColor(dynamic.highContrastDark),
|
|
85
93
|
},
|
|
86
94
|
};
|
|
@@ -24,7 +24,7 @@ function flattenStyle<+TStyleProp: DangerouslyImpreciseStyleProp>(
|
|
|
24
24
|
return style;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const result = {};
|
|
27
|
+
const result: {[string]: $FlowFixMe} = {};
|
|
28
28
|
for (let i = 0, styleLength = style.length; i < styleLength; ++i) {
|
|
29
29
|
const computedStyle = flattenStyle(style[i]);
|
|
30
30
|
if (computedStyle) {
|
|
@@ -116,6 +116,8 @@ function processTransform(
|
|
|
116
116
|
/**
|
|
117
117
|
* Performs a destructive operation on a transform matrix.
|
|
118
118
|
*/
|
|
119
|
+
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
|
120
|
+
* Flow's LTI update could not be added via codemod */
|
|
119
121
|
function _multiplyTransform(
|
|
120
122
|
result: Array<number>,
|
|
121
123
|
matrixMathFunction: Function,
|
|
@@ -50,10 +50,12 @@ export default function splitLayoutProps(props: ?____ViewStyle_Internal): {
|
|
|
50
50
|
case 'top':
|
|
51
51
|
case 'transform':
|
|
52
52
|
// $FlowFixMe[cannot-write]
|
|
53
|
+
// $FlowFixMe[incompatible-use]
|
|
53
54
|
outer[prop] = props[prop];
|
|
54
55
|
break;
|
|
55
56
|
default:
|
|
56
57
|
// $FlowFixMe[cannot-write]
|
|
58
|
+
// $FlowFixMe[incompatible-use]
|
|
57
59
|
inner[prop] = props[prop];
|
|
58
60
|
break;
|
|
59
61
|
}
|
package/Libraries/Text/Text.js
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import type {PressEvent} from '../Types/CoreEventTypes';
|
|
12
|
+
|
|
13
|
+
import Platform from '../Utilities/Platform';
|
|
11
14
|
import * as PressabilityDebug from '../Pressability/PressabilityDebug';
|
|
12
15
|
import usePressability from '../Pressability/usePressability';
|
|
13
16
|
import StyleSheet from '../StyleSheet/StyleSheet';
|
|
@@ -72,11 +75,11 @@ const Text: React.AbstractComponent<
|
|
|
72
75
|
pressRectOffset: pressRetentionOffset,
|
|
73
76
|
onLongPress,
|
|
74
77
|
onPress,
|
|
75
|
-
onPressIn(event) {
|
|
78
|
+
onPressIn(event: PressEvent) {
|
|
76
79
|
setHighlighted(!suppressHighlighting);
|
|
77
80
|
onPressIn?.(event);
|
|
78
81
|
},
|
|
79
|
-
onPressOut(event) {
|
|
82
|
+
onPressOut(event: PressEvent) {
|
|
80
83
|
setHighlighted(false);
|
|
81
84
|
onPressOut?.(event);
|
|
82
85
|
},
|
|
@@ -105,25 +108,25 @@ const Text: React.AbstractComponent<
|
|
|
105
108
|
eventHandlers == null
|
|
106
109
|
? null
|
|
107
110
|
: {
|
|
108
|
-
onResponderGrant(event) {
|
|
111
|
+
onResponderGrant(event: PressEvent) {
|
|
109
112
|
eventHandlers.onResponderGrant(event);
|
|
110
113
|
if (onResponderGrant != null) {
|
|
111
114
|
onResponderGrant(event);
|
|
112
115
|
}
|
|
113
116
|
},
|
|
114
|
-
onResponderMove(event) {
|
|
117
|
+
onResponderMove(event: PressEvent) {
|
|
115
118
|
eventHandlers.onResponderMove(event);
|
|
116
119
|
if (onResponderMove != null) {
|
|
117
120
|
onResponderMove(event);
|
|
118
121
|
}
|
|
119
122
|
},
|
|
120
|
-
onResponderRelease(event) {
|
|
123
|
+
onResponderRelease(event: PressEvent) {
|
|
121
124
|
eventHandlers.onResponderRelease(event);
|
|
122
125
|
if (onResponderRelease != null) {
|
|
123
126
|
onResponderRelease(event);
|
|
124
127
|
}
|
|
125
128
|
},
|
|
126
|
-
onResponderTerminate(event) {
|
|
129
|
+
onResponderTerminate(event: PressEvent) {
|
|
127
130
|
eventHandlers.onResponderTerminate(event);
|
|
128
131
|
if (onResponderTerminate != null) {
|
|
129
132
|
onResponderTerminate(event);
|
|
@@ -168,6 +171,11 @@ const Text: React.AbstractComponent<
|
|
|
168
171
|
|
|
169
172
|
const hasTextAncestor = useContext(TextAncestor);
|
|
170
173
|
|
|
174
|
+
const _accessible = Platform.select({
|
|
175
|
+
ios: accessible !== false,
|
|
176
|
+
default: accessible,
|
|
177
|
+
});
|
|
178
|
+
|
|
171
179
|
return hasTextAncestor ? (
|
|
172
180
|
<NativeVirtualText
|
|
173
181
|
{...restProps}
|
|
@@ -185,7 +193,7 @@ const Text: React.AbstractComponent<
|
|
|
185
193
|
{...restProps}
|
|
186
194
|
{...eventHandlersForText}
|
|
187
195
|
disabled={_disabled}
|
|
188
|
-
accessible={
|
|
196
|
+
accessible={_accessible}
|
|
189
197
|
accessibilityState={_accessibilityState}
|
|
190
198
|
allowFontScaling={allowFontScaling !== false}
|
|
191
199
|
ellipsizeMode={ellipsizeMode ?? 'tail'}
|
|
@@ -83,17 +83,143 @@ export type TextLayoutEvent = SyntheticEvent<
|
|
|
83
83
|
|}>,
|
|
84
84
|
>;
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
/**
|
|
87
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/UIEvent
|
|
88
|
+
*/
|
|
89
|
+
export interface NativeUIEvent {
|
|
90
|
+
/**
|
|
91
|
+
* Returns a long with details about the event, depending on the event type.
|
|
92
|
+
*/
|
|
93
|
+
+detail: number;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
|
|
98
|
+
*/
|
|
99
|
+
export interface NativeMouseEvent extends NativeUIEvent {
|
|
100
|
+
/**
|
|
101
|
+
* The X coordinate of the mouse pointer in global (screen) coordinates.
|
|
102
|
+
*/
|
|
103
|
+
+screenX: number;
|
|
104
|
+
/**
|
|
105
|
+
* The Y coordinate of the mouse pointer in global (screen) coordinates.
|
|
106
|
+
*/
|
|
107
|
+
+screenY: number;
|
|
108
|
+
/**
|
|
109
|
+
* The X coordinate of the mouse pointer relative to the whole document.
|
|
110
|
+
*/
|
|
111
|
+
+pageX: number;
|
|
112
|
+
/**
|
|
113
|
+
* The Y coordinate of the mouse pointer relative to the whole document.
|
|
114
|
+
*/
|
|
115
|
+
+pageY: number;
|
|
116
|
+
/**
|
|
117
|
+
* The X coordinate of the mouse pointer in local (DOM content) coordinates.
|
|
118
|
+
*/
|
|
119
|
+
+clientX: number;
|
|
120
|
+
/**
|
|
121
|
+
* The Y coordinate of the mouse pointer in local (DOM content) coordinates.
|
|
122
|
+
*/
|
|
123
|
+
+clientY: number;
|
|
124
|
+
/**
|
|
125
|
+
* Alias for NativeMouseEvent.clientX
|
|
126
|
+
*/
|
|
127
|
+
+x: number;
|
|
128
|
+
/**
|
|
129
|
+
* Alias for NativeMouseEvent.clientY
|
|
130
|
+
*/
|
|
131
|
+
+y: number;
|
|
132
|
+
/**
|
|
133
|
+
* Returns true if the control key was down when the mouse event was fired.
|
|
134
|
+
*/
|
|
135
|
+
+ctrlKey: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Returns true if the shift key was down when the mouse event was fired.
|
|
138
|
+
*/
|
|
139
|
+
+shiftKey: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Returns true if the alt key was down when the mouse event was fired.
|
|
142
|
+
*/
|
|
143
|
+
+altKey: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Returns true if the meta key was down when the mouse event was fired.
|
|
146
|
+
*/
|
|
147
|
+
+metaKey: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* The button number that was pressed (if applicable) when the mouse event was fired.
|
|
150
|
+
*/
|
|
151
|
+
+button: number;
|
|
152
|
+
/**
|
|
153
|
+
* The buttons being depressed (if any) when the mouse event was fired.
|
|
154
|
+
*/
|
|
155
|
+
+buttons: number;
|
|
156
|
+
/**
|
|
157
|
+
* The secondary target for the event, if there is one.
|
|
158
|
+
*/
|
|
159
|
+
+relatedTarget: null | number | React.ElementRef<HostComponent<mixed>>;
|
|
160
|
+
// offset is proposed: https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
|
|
161
|
+
/**
|
|
162
|
+
* The X coordinate of the mouse pointer between that event and the padding edge of the target node
|
|
163
|
+
*/
|
|
164
|
+
+offsetX: number;
|
|
165
|
+
/**
|
|
166
|
+
* The Y coordinate of the mouse pointer between that event and the padding edge of the target node
|
|
167
|
+
*/
|
|
168
|
+
+offsetY: number;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent
|
|
173
|
+
*/
|
|
174
|
+
export interface NativePointerEvent extends NativeMouseEvent {
|
|
175
|
+
/**
|
|
176
|
+
* A unique identifier for the pointer causing the event.
|
|
177
|
+
*/
|
|
178
|
+
+pointerId: number;
|
|
179
|
+
/**
|
|
180
|
+
* The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer
|
|
181
|
+
*/
|
|
182
|
+
+width: number;
|
|
183
|
+
/**
|
|
184
|
+
* The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer.
|
|
185
|
+
*/
|
|
186
|
+
+height: number;
|
|
187
|
+
/**
|
|
188
|
+
* The normalized pressure of the pointer input in the range 0 to 1, where 0 and 1 represent
|
|
189
|
+
* the minimum and maximum pressure the hardware is capable of detecting, respectively.
|
|
190
|
+
*/
|
|
191
|
+
+pressure: number;
|
|
192
|
+
/**
|
|
193
|
+
* The normalized tangential pressure of the pointer input (also known as barrel pressure or
|
|
194
|
+
* cylinder stress) in the range -1 to 1, where 0 is the neutral position of the control.
|
|
195
|
+
*/
|
|
196
|
+
+tangentialPressure: number;
|
|
197
|
+
/**
|
|
198
|
+
* The plane angle (in degrees, in the range of -90 to 90) between the Y–Z plane and the plane
|
|
199
|
+
* containing both the pointer (e.g. pen stylus) axis and the Y axis.
|
|
200
|
+
*/
|
|
201
|
+
+tiltX: number;
|
|
202
|
+
/**
|
|
203
|
+
* The plane angle (in degrees, in the range of -90 to 90) between the X–Z plane and the plane
|
|
204
|
+
* containing both the pointer (e.g. pen stylus) axis and the X axis.
|
|
205
|
+
*/
|
|
206
|
+
+tiltY: number;
|
|
207
|
+
/**
|
|
208
|
+
* The clockwise rotation of the pointer (e.g. pen stylus) around its major axis in degrees,
|
|
209
|
+
* with a value in the range 0 to 359.
|
|
210
|
+
*/
|
|
211
|
+
+twist: number;
|
|
212
|
+
/**
|
|
213
|
+
* Indicates the device type that caused the event (mouse, pen, touch, etc.)
|
|
214
|
+
*/
|
|
215
|
+
+pointerType: string;
|
|
216
|
+
/**
|
|
217
|
+
* Indicates if the pointer represents the primary pointer of this pointer type.
|
|
218
|
+
*/
|
|
219
|
+
+isPrimary: boolean;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export type PointerEvent = SyntheticEvent<NativePointerEvent>;
|
|
97
223
|
|
|
98
224
|
export type PressEvent = ResponderSyntheticEvent<
|
|
99
225
|
$ReadOnly<{|
|
|
@@ -83,28 +83,153 @@ export type TextLayoutEvent = SyntheticEvent<
|
|
|
83
83
|
|}>,
|
|
84
84
|
>;
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
86
|
+
/**
|
|
87
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/UIEvent
|
|
88
|
+
*/
|
|
89
|
+
export interface NativeUIEvent {
|
|
90
|
+
/**
|
|
91
|
+
* Returns a long with details about the event, depending on the event type.
|
|
92
|
+
*/
|
|
93
|
+
+detail: number;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
|
|
98
|
+
*/
|
|
99
|
+
export interface NativeMouseEvent extends NativeUIEvent {
|
|
100
|
+
/**
|
|
101
|
+
* The X coordinate of the mouse pointer in global (screen) coordinates.
|
|
102
|
+
*/
|
|
103
|
+
+screenX: number;
|
|
104
|
+
/**
|
|
105
|
+
* The Y coordinate of the mouse pointer in global (screen) coordinates.
|
|
106
|
+
*/
|
|
107
|
+
+screenY: number;
|
|
108
|
+
/**
|
|
109
|
+
* The X coordinate of the mouse pointer relative to the whole document.
|
|
110
|
+
*/
|
|
111
|
+
+pageX: number;
|
|
112
|
+
/**
|
|
113
|
+
* The Y coordinate of the mouse pointer relative to the whole document.
|
|
114
|
+
*/
|
|
115
|
+
+pageY: number;
|
|
116
|
+
/**
|
|
117
|
+
* The X coordinate of the mouse pointer in local (DOM content) coordinates.
|
|
118
|
+
*/
|
|
119
|
+
+clientX: number;
|
|
120
|
+
/**
|
|
121
|
+
* The Y coordinate of the mouse pointer in local (DOM content) coordinates.
|
|
122
|
+
*/
|
|
123
|
+
+clientY: number;
|
|
124
|
+
/**
|
|
125
|
+
* Alias for NativeMouseEvent.clientX
|
|
126
|
+
*/
|
|
127
|
+
+x: number;
|
|
128
|
+
/**
|
|
129
|
+
* Alias for NativeMouseEvent.clientY
|
|
130
|
+
*/
|
|
131
|
+
+y: number;
|
|
132
|
+
/**
|
|
133
|
+
* Returns true if the control key was down when the mouse event was fired.
|
|
134
|
+
*/
|
|
135
|
+
+ctrlKey: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Returns true if the shift key was down when the mouse event was fired.
|
|
138
|
+
*/
|
|
139
|
+
+shiftKey: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Returns true if the alt key was down when the mouse event was fired.
|
|
142
|
+
*/
|
|
143
|
+
+altKey: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Returns true if the meta key was down when the mouse event was fired.
|
|
146
|
+
*/
|
|
147
|
+
+metaKey: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* The button number that was pressed (if applicable) when the mouse event was fired.
|
|
150
|
+
*/
|
|
151
|
+
+button: number;
|
|
152
|
+
/**
|
|
153
|
+
* The buttons being depressed (if any) when the mouse event was fired.
|
|
154
|
+
*/
|
|
155
|
+
+buttons: number;
|
|
156
|
+
/**
|
|
157
|
+
* The secondary target for the event, if there is one.
|
|
158
|
+
*/
|
|
159
|
+
+relatedTarget: null | number | React.ElementRef<HostComponent<mixed>>;
|
|
160
|
+
// offset is proposed: https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
|
|
161
|
+
/**
|
|
162
|
+
* The X coordinate of the mouse pointer between that event and the padding edge of the target node
|
|
163
|
+
*/
|
|
164
|
+
+offsetX: number;
|
|
165
|
+
/**
|
|
166
|
+
* The Y coordinate of the mouse pointer between that event and the padding edge of the target node
|
|
167
|
+
*/
|
|
168
|
+
+offsetY: number;
|
|
169
|
+
|
|
170
|
+
// [Windows
|
|
171
|
+
+isLeftButton: boolean;
|
|
172
|
+
+isRightButton: boolean;
|
|
173
|
+
+isMiddleButton: boolean;
|
|
174
|
+
+isBarrelButtonPressed: boolean;
|
|
175
|
+
+isHorizontalScrollWheel: boolean;
|
|
176
|
+
+isEraser: boolean;
|
|
177
|
+
+target: ?number;
|
|
178
|
+
// Windows]
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent
|
|
183
|
+
*/
|
|
184
|
+
export interface NativePointerEvent extends NativeMouseEvent {
|
|
185
|
+
/**
|
|
186
|
+
* A unique identifier for the pointer causing the event.
|
|
187
|
+
*/
|
|
188
|
+
+pointerId: number;
|
|
189
|
+
/**
|
|
190
|
+
* The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer
|
|
191
|
+
*/
|
|
192
|
+
+width: number;
|
|
193
|
+
/**
|
|
194
|
+
* The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer.
|
|
195
|
+
*/
|
|
196
|
+
+height: number;
|
|
197
|
+
/**
|
|
198
|
+
* The normalized pressure of the pointer input in the range 0 to 1, where 0 and 1 represent
|
|
199
|
+
* the minimum and maximum pressure the hardware is capable of detecting, respectively.
|
|
200
|
+
*/
|
|
201
|
+
+pressure: number;
|
|
202
|
+
/**
|
|
203
|
+
* The normalized tangential pressure of the pointer input (also known as barrel pressure or
|
|
204
|
+
* cylinder stress) in the range -1 to 1, where 0 is the neutral position of the control.
|
|
205
|
+
*/
|
|
206
|
+
+tangentialPressure: number;
|
|
207
|
+
/**
|
|
208
|
+
* The plane angle (in degrees, in the range of -90 to 90) between the Y–Z plane and the plane
|
|
209
|
+
* containing both the pointer (e.g. pen stylus) axis and the Y axis.
|
|
210
|
+
*/
|
|
211
|
+
+tiltX: number;
|
|
212
|
+
/**
|
|
213
|
+
* The plane angle (in degrees, in the range of -90 to 90) between the X–Z plane and the plane
|
|
214
|
+
* containing both the pointer (e.g. pen stylus) axis and the X axis.
|
|
215
|
+
*/
|
|
216
|
+
+tiltY: number;
|
|
217
|
+
/**
|
|
218
|
+
* The clockwise rotation of the pointer (e.g. pen stylus) around its major axis in degrees,
|
|
219
|
+
* with a value in the range 0 to 359.
|
|
220
|
+
*/
|
|
221
|
+
+twist: number;
|
|
222
|
+
/**
|
|
223
|
+
* Indicates the device type that caused the event (mouse, pen, touch, etc.)
|
|
224
|
+
*/
|
|
225
|
+
+pointerType: string;
|
|
226
|
+
/**
|
|
227
|
+
* Indicates if the pointer represents the primary pointer of this pointer type.
|
|
228
|
+
*/
|
|
229
|
+
+isPrimary: boolean;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export type PointerEvent = SyntheticEvent<NativePointerEvent>;
|
|
108
233
|
|
|
109
234
|
export type PressEvent = ResponderSyntheticEvent<
|
|
110
235
|
$ReadOnly<{|
|
|
@@ -108,19 +108,6 @@ class Dimensions {
|
|
|
108
108
|
);
|
|
109
109
|
return eventEmitter.addListener(type, handler);
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @deprecated Use `remove` on the EventSubscription from `addEventListener`.
|
|
114
|
-
*/
|
|
115
|
-
static removeEventListener(type: 'change', handler: Function) {
|
|
116
|
-
invariant(
|
|
117
|
-
type === 'change',
|
|
118
|
-
'Trying to remove listener for unknown event: "%s"',
|
|
119
|
-
type,
|
|
120
|
-
);
|
|
121
|
-
// NOTE: This will report a deprecation notice via `console.error`.
|
|
122
|
-
eventEmitter.removeListener(type, handler);
|
|
123
|
-
}
|
|
124
111
|
}
|
|
125
112
|
|
|
126
113
|
let initialDims: ?$ReadOnly<DimensionsPayload> =
|
|
@@ -29,15 +29,6 @@ class Dimensions {
|
|
|
29
29
|
'Having a global Dimensions object is too simplistic for Win32, so this API does not work',
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated Use `remove` on the EventSubscription from `addEventListener`.
|
|
35
|
-
*/
|
|
36
|
-
static removeEventListener(type: 'change', handler: Function) {
|
|
37
|
-
throw new Error(
|
|
38
|
-
'Having a global Dimensions object is too simplistic for Win32, so this API does not work',
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
32
|
}
|
|
42
33
|
|
|
43
34
|
module.exports = Dimensions;
|
|
@@ -256,7 +256,7 @@ Error: ${e.message}`;
|
|
|
256
256
|
},
|
|
257
257
|
};
|
|
258
258
|
|
|
259
|
-
function setHMRUnavailableReason(reason) {
|
|
259
|
+
function setHMRUnavailableReason(reason: string) {
|
|
260
260
|
invariant(hmrClient, 'Expected HMRClient.setup() call at startup.');
|
|
261
261
|
if (hmrUnavailableReason !== null) {
|
|
262
262
|
// Don't show more than one warning.
|
|
@@ -273,7 +273,7 @@ function setHMRUnavailableReason(reason) {
|
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
function registerBundleEntryPoints(client) {
|
|
276
|
+
function registerBundleEntryPoints(client: MetroHMRClient) {
|
|
277
277
|
if (hmrUnavailableReason != null) {
|
|
278
278
|
DevSettings.reload('Bundle Splitting – Metro disconnected');
|
|
279
279
|
return;
|
|
@@ -290,7 +290,7 @@ function registerBundleEntryPoints(client) {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
function flushEarlyLogs(client) {
|
|
293
|
+
function flushEarlyLogs(client: MetroHMRClient) {
|
|
294
294
|
try {
|
|
295
295
|
pendingLogs.forEach(([level, data]) => {
|
|
296
296
|
HMRClient.log(level, data);
|
|
@@ -47,13 +47,6 @@ const Platform = {
|
|
|
47
47
|
get isPad(): boolean {
|
|
48
48
|
return this.constants.interfaceIdiom === 'pad';
|
|
49
49
|
},
|
|
50
|
-
/**
|
|
51
|
-
* Deprecated, use `isTV` instead.
|
|
52
|
-
*/
|
|
53
|
-
// $FlowFixMe[unsafe-getters-setters]
|
|
54
|
-
get isTVOS(): boolean {
|
|
55
|
-
return Platform.isTV;
|
|
56
|
-
},
|
|
57
50
|
// $FlowFixMe[unsafe-getters-setters]
|
|
58
51
|
get isTV(): boolean {
|
|
59
52
|
return this.constants.interfaceIdiom === 'tv';
|
|
@@ -180,7 +180,9 @@ function renderAndEnforceStrictMode(element: React.Node): any {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
function renderWithStrictMode(element: React.Node): ReactTestRendererType {
|
|
183
|
-
const WorkAroundBugWithStrictModeInTestRenderer = prps
|
|
183
|
+
const WorkAroundBugWithStrictModeInTestRenderer = (prps: {
|
|
184
|
+
children: React.Node,
|
|
185
|
+
}) => prps.children;
|
|
184
186
|
const StrictMode = (React: $FlowFixMe).StrictMode;
|
|
185
187
|
return ReactTestRenderer.create(
|
|
186
188
|
<WorkAroundBugWithStrictModeInTestRenderer>
|
|
@@ -8,14 +8,23 @@
|
|
|
8
8
|
* @flow
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
let dispatchCommand;
|
|
12
|
+
if (global.RN$Bridgeless) {
|
|
13
|
+
// Note: this function has the same implementation in the legacy and new renderer.
|
|
14
|
+
// However, evaluating the old renderer comes with some side effects.
|
|
15
|
+
dispatchCommand =
|
|
16
|
+
require('../../Libraries/Renderer/shims/ReactFabric').dispatchCommand;
|
|
17
|
+
} else {
|
|
18
|
+
dispatchCommand =
|
|
19
|
+
require('../../Libraries/Renderer/shims/ReactNative').dispatchCommand;
|
|
20
|
+
}
|
|
12
21
|
|
|
13
22
|
type Options<T = string> = $ReadOnly<{|
|
|
14
23
|
supportedCommands: $ReadOnlyArray<T>,
|
|
15
24
|
|}>;
|
|
16
25
|
|
|
17
26
|
function codegenNativeCommands<T: interface {}>(options: Options<$Keys<T>>): T {
|
|
18
|
-
const commandObj = {};
|
|
27
|
+
const commandObj: {[$Keys<T>]: (...$ReadOnlyArray<mixed>) => void} = {};
|
|
19
28
|
|
|
20
29
|
options.supportedCommands.forEach(command => {
|
|
21
30
|
commandObj[command] = (ref, ...args) => {
|
|
@@ -70,6 +70,8 @@ function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<mixed>>(
|
|
|
70
70
|
return object;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
|
74
|
+
* LTI update could not be added via codemod */
|
|
73
75
|
function throwOnImmutableMutation(key: empty, value) {
|
|
74
76
|
throw Error(
|
|
75
77
|
'You attempted to set the key `' +
|
|
@@ -27,6 +27,8 @@ export function createStringifySafeWithLimits(limits: {|
|
|
|
27
27
|
maxObjectKeysLimit = Number.POSITIVE_INFINITY,
|
|
28
28
|
} = limits;
|
|
29
29
|
const stack = [];
|
|
30
|
+
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
|
31
|
+
* Flow's LTI update could not be added via codemod */
|
|
30
32
|
function replacer(key: string, value: mixed): mixed {
|
|
31
33
|
while (stack.length && this !== stack[0]) {
|
|
32
34
|
stack.shift();
|
|
@@ -65,7 +67,7 @@ export function createStringifySafeWithLimits(limits: {|
|
|
|
65
67
|
retval = `{ ... object with ${keys.length} keys ... }`;
|
|
66
68
|
} else if (keys.length > maxObjectKeysLimit) {
|
|
67
69
|
// Return a sample of the keys.
|
|
68
|
-
retval = {};
|
|
70
|
+
retval = ({}: {[string]: mixed});
|
|
69
71
|
for (let k of keys.slice(0, maxObjectKeysLimit)) {
|
|
70
72
|
retval[k] = value[k];
|
|
71
73
|
}
|
|
@@ -63,7 +63,7 @@ export default function verifyComponentAttributeEquivalence(
|
|
|
63
63
|
// Return the different key-value pairs of the right object, by iterating through the keys in the left object
|
|
64
64
|
// Note it won't return a difference where a key is missing in the left but exists the right.
|
|
65
65
|
function lefthandObjectDiff(leftObj: Object, rightObj: Object): Object {
|
|
66
|
-
const differentKeys = {};
|
|
66
|
+
const differentKeys: {[string]: any | {...}} = {};
|
|
67
67
|
|
|
68
68
|
function compare(leftItem: any, rightItem: any, key: string) {
|
|
69
69
|
if (typeof leftItem !== typeof rightItem && leftItem != null) {
|
|
@@ -110,7 +110,7 @@ export function getConfigWithoutViewProps(
|
|
|
110
110
|
|
|
111
111
|
return Object.keys(viewConfig[propName])
|
|
112
112
|
.filter(prop => !PlatformBaseViewConfig[propName][prop])
|
|
113
|
-
.reduce((obj, prop) => {
|
|
113
|
+
.reduce<{[string]: any}>((obj, prop) => {
|
|
114
114
|
obj[prop] = viewConfig[propName][prop];
|
|
115
115
|
return obj;
|
|
116
116
|
}, {});
|