@office-iss/react-native-win32 0.0.0-canary.285 → 0.0.0-canary.286
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 +1 -1
- package/CHANGELOG.json +16 -1
- package/CHANGELOG.md +16 -8
- package/IntegrationTests/LayoutEventsTest.js +16 -11
- package/Libraries/Alert/Alert.js +51 -5
- package/Libraries/Alert/Alert.win32.js +50 -5
- package/Libraries/Animated/animations/Animation.js +1 -4
- package/Libraries/Animated/nodes/AnimatedObject.js +1 -0
- package/Libraries/AppState/AppState.js +24 -7
- package/Libraries/BatchedBridge/MessageQueue.js +3 -2
- package/Libraries/BatchedBridge/NativeModules.js +2 -1
- package/Libraries/Blob/Blob.js +1 -1
- package/Libraries/Blob/FileReader_old.js +9 -9
- package/Libraries/Blob/URL.js +1 -1
- package/Libraries/Blob/URLSearchParams.js +9 -9
- package/Libraries/Components/Button.js +3 -3
- package/Libraries/Components/Button.win32.js +3 -6
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +1 -1
- package/Libraries/Components/Pressable/Pressable.js +9 -9
- package/Libraries/Components/Pressable/Pressable.win32.js +9 -9
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +7 -7
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +7 -1
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.js +74 -59
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +5 -5
- package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +5 -2
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +3 -3
- package/Libraries/Components/Switch/Switch.js +2 -2
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +3 -1
- package/Libraries/Components/TextInput/TextInput.flow.js +15 -13
- package/Libraries/Components/TextInput/TextInput.js +16 -14
- package/Libraries/Components/TextInput/TextInput.win32.js +16 -14
- package/Libraries/Components/TextInput/TextInputState.js +1 -1
- package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
- package/Libraries/Components/Touchable/Touchable.js +16 -16
- package/Libraries/Components/Touchable/Touchable.win32.js +16 -16
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +7 -7
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +16 -2
- package/Libraries/Components/View/ViewAccessibility.js +243 -3
- package/Libraries/Components/View/ViewAccessibility.win32.js +243 -3
- package/Libraries/Components/View/ViewPropTypes.d.ts +14 -14
- package/Libraries/Components/View/ViewPropTypes.js +35 -226
- package/Libraries/Components/View/ViewPropTypes.win32.js +37 -229
- package/Libraries/Core/Devtools/symbolicateStackTrace.js +1 -1
- package/Libraries/Core/InitializeCore.js +2 -1
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/Timers/JSTimers.js +6 -4
- package/Libraries/Core/setUpBatchedBridge.js +9 -5
- package/Libraries/Core/setUpDeveloperTools.js +3 -29
- package/Libraries/Core/setUpReactDevTools.js +1 -1
- package/Libraries/Core/setUpReactRefresh.js +1 -1
- package/Libraries/Core/setUpXHR.js +5 -2
- package/Libraries/EventEmitter/NativeEventEmitter.js +8 -2
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +5 -4
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +3 -2
- package/Libraries/Events/CustomEvent.js +1 -1
- package/Libraries/Events/EventPolyfill.js +2 -2
- package/Libraries/Image/AssetSourceResolver.js +1 -1
- package/Libraries/Image/ImageProps.js +8 -5
- package/Libraries/Image/ImageViewNativeComponent.js +1 -1
- package/Libraries/Image/resolveAssetSource.win32.js +1 -1
- package/Libraries/Interaction/InteractionManager.js +1 -1
- package/Libraries/Interaction/InteractionManagerStub.js +9 -1
- package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -1
- package/Libraries/Interaction/PanResponder.js +32 -29
- package/Libraries/Interaction/TaskQueue.js +1 -1
- package/Libraries/LayoutAnimation/LayoutAnimation.js +18 -4
- package/Libraries/Lists/FillRateHelper.js +3 -3
- package/Libraries/Lists/FlatList.js +13 -13
- package/Libraries/Lists/SectionList.js +3 -1
- package/Libraries/Lists/SectionListModern.js +3 -1
- package/Libraries/Lists/ViewabilityHelper.js +3 -2
- package/Libraries/Lists/VirtualizeUtils.js +3 -3
- package/Libraries/Lists/VirtualizedList.js +5 -5
- package/Libraries/Lists/VirtualizedListContext.js +4 -2
- package/Libraries/Lists/VirtualizedSectionList.js +4 -2
- package/Libraries/LogBox/LogBox.js +9 -1
- package/Libraries/LogBox/UI/AnsiHighlight.js +7 -3
- package/Libraries/LogBox/UI/LogBoxButton.js +4 -2
- package/Libraries/LogBox/UI/LogBoxInspector.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +11 -3
- package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +2 -0
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +8 -2
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -2
- package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +2 -0
- package/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +4 -2
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +3 -1
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +3 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +2 -2
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +5 -3
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.win32.js +5 -3
- package/Libraries/LogBox/UI/LogBoxNotification.js +6 -2
- package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +3 -1
- package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +2 -0
- package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +4 -1
- package/Libraries/Modal/Modal.js +74 -81
- package/Libraries/NativeComponent/BaseViewConfig.android.js +16 -6
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +19 -9
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +19 -9
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +5 -1
- package/Libraries/Network/FormData.js +1 -1
- package/Libraries/Network/XMLHttpRequest.js +5 -6
- package/Libraries/Network/XMLHttpRequest_new.js +3 -2
- package/Libraries/Network/XMLHttpRequest_old.js +3 -2
- package/Libraries/Network/convertRequestBody.js +4 -3
- package/Libraries/Network/fetch.js +4 -3
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +63 -61
- package/Libraries/Pressability/Pressability.js +23 -23
- package/Libraries/Pressability/Pressability.win32.js +23 -23
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +119 -16
- package/Libraries/ReactNative/AppContainer-dev.js +2 -1
- package/Libraries/ReactNative/AppRegistry.js +3 -3
- package/Libraries/ReactNative/PaperUIManager.js +3 -2
- package/Libraries/ReactNative/PaperUIManager.win32.js +3 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +2 -1
- package/Libraries/ReactNative/RootTag.js +1 -1
- package/Libraries/ReactNative/getNativeComponentAttributes.js +4 -4
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +6 -4
- package/Libraries/Renderer/shims/ReactNativeTypes.js +4 -5
- package/Libraries/Settings/Settings.js +2 -2
- package/Libraries/Settings/Settings.win32.js +2 -2
- package/Libraries/Share/Share.js +10 -3
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +2 -2
- package/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +1 -1
- package/Libraries/StyleSheet/flattenStyle.js +1 -1
- package/Libraries/StyleSheet/normalizeColor.js +1 -1
- package/Libraries/StyleSheet/processAspectRatio.js +1 -1
- package/Libraries/StyleSheet/processColor.js +2 -2
- package/Libraries/StyleSheet/processFilter.js +4 -0
- package/Libraries/StyleSheet/processFontVariant.js +1 -1
- package/Libraries/StyleSheet/processTransform.js +1 -1
- package/Libraries/StyleSheet/setNormalizedColorAlpha.js +1 -1
- package/Libraries/Text/Text.js +15 -15
- package/Libraries/Text/Text.win32.js +15 -15
- package/Libraries/Text/TextAncestor.js +1 -1
- package/Libraries/Text/TextNativeComponent.js +2 -2
- package/Libraries/Text/TextNativeComponent.win32.js +2 -2
- package/Libraries/Text/TextProps.js +11 -11
- package/Libraries/Text/TextProps.win32.js +11 -11
- package/Libraries/Types/CodegenTypes.js +3 -3
- package/Libraries/Types/CoreEventTypes.js +103 -72
- package/Libraries/Types/CoreEventTypes.win32.js +115 -79
- package/Libraries/UTFSequence.js +2 -1
- package/Libraries/Utilities/BackHandler.android.js +1 -1
- package/Libraries/Utilities/BackHandler.ios.js +5 -5
- package/Libraries/Utilities/BackHandler.win32.js +1 -1
- package/Libraries/Utilities/DevLoadingView.js +1 -1
- package/Libraries/Utilities/DevSettings.js +1 -1
- package/Libraries/Utilities/DeviceInfo.js +1 -1
- package/Libraries/Utilities/DeviceInfo.win32.js +1 -1
- package/Libraries/Utilities/FeatureDetection.js +2 -4
- package/Libraries/Utilities/FocusManager.win32.js +3 -3
- package/Libraries/Utilities/GlobalPerformanceLogger.js +1 -1
- package/Libraries/Utilities/HMRClient.js +5 -33
- package/Libraries/Utilities/HMRClientProdShim.js +1 -2
- package/Libraries/Utilities/Platform.android.js +2 -2
- package/Libraries/Utilities/Platform.ios.js +2 -2
- package/Libraries/Utilities/Platform.win32.js +2 -2
- package/Libraries/Utilities/{Platform.flow.win32.js → PlatformTypes.js} +1 -0
- package/Libraries/Utilities/PolyfillFunctions.js +3 -5
- package/Libraries/Utilities/RCTLog.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/Utilities/SceneTracker.js +1 -1
- package/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +2 -2
- package/Libraries/Utilities/binaryToBase64.js +1 -1
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +1 -1
- package/Libraries/Utilities/defineLazyObjectProperty.js +1 -1
- package/Libraries/Utilities/differ/deepDiffer.js +3 -3
- package/Libraries/Utilities/differ/insetsDiffer.js +3 -3
- package/Libraries/Utilities/differ/matricesDiffer.js +3 -6
- package/Libraries/Utilities/differ/pointsDiffer.js +3 -3
- package/Libraries/Utilities/differ/sizesDiffer.js +3 -3
- package/Libraries/Utilities/dismissKeyboard.js +1 -1
- package/Libraries/Utilities/infoLog.js +1 -1
- package/Libraries/Utilities/logError.js +1 -1
- package/Libraries/Utilities/mapWithSeparator.js +1 -1
- package/Libraries/Utilities/warnOnce.js +1 -1
- package/Libraries/Vibration/Vibration.js +3 -3
- package/Libraries/vendor/emitter/EventEmitter.js +21 -9
- package/index.js +113 -199
- package/index.win32.js +21 -13
- package/jest/setup.js +9 -2
- package/overrides.json +35 -34
- package/package.json +15 -15
- package/src/private/devmenu/DevMenu.js +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +22 -23
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +4 -7
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -4
- package/src/private/inspector/BoxInspector.js +1 -1
- package/src/private/inspector/ElementBox.js +3 -2
- package/src/private/inspector/ElementProperties.js +5 -3
- package/src/private/inspector/Inspector.js +2 -2
- package/src/private/inspector/InspectorOverlay.js +4 -4
- package/src/private/inspector/InspectorPanel.js +1 -1
- package/src/private/inspector/NetworkOverlay.js +4 -4
- package/src/private/inspector/PerformanceOverlay.js +3 -2
- package/src/private/inspector/ReactDevToolsOverlay.js +3 -3
- package/src/private/inspector/StyleInspector.js +1 -1
- package/src/private/inspector/XHRInterceptor.js +5 -2
- package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -1
- package/src/private/specs_DEPRECATED/modules/NativeExceptionsManager.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativePermissionsAndroid.js +5 -4
- package/src/private/specs_DEPRECATED/modules/NativeUIManager.js +92 -19
- package/src/private/webapis/dom/events/CustomEvent.js +5 -7
- package/src/private/webapis/dom/events/Event.js +5 -5
- package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -0
- package/src/private/webapis/html/events/MessageEvent.js +12 -19
- package/src/private/webapis/websockets/events/CloseEvent.js +9 -11
- package/src/private/webapis/xhr/events/ProgressEvent.js +9 -11
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +14 -14
- package/Libraries/Alert/Alert.flow.js +0 -62
- package/Libraries/Alert/RCTAlertManager.flow.js +0 -20
- package/Libraries/Utilities/Platform.flow.js +0 -91
- package/flow/react.js +0 -15
|
@@ -15,25 +15,21 @@ import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
|
|
|
15
15
|
import type {
|
|
16
16
|
BlurEvent,
|
|
17
17
|
FocusEvent,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
LayoutChangeEvent,
|
|
19
|
+
LayoutRectangle,
|
|
20
20
|
MouseEvent,
|
|
21
21
|
PointerEvent,
|
|
22
|
-
|
|
22
|
+
GestureResponderEvent,
|
|
23
23
|
KeyEvent, // [Windows]
|
|
24
24
|
} from '../../Types/CoreEventTypes';
|
|
25
25
|
import type {
|
|
26
26
|
AccessibilityActionEvent,
|
|
27
|
-
|
|
28
|
-
AccessibilityRole,
|
|
29
|
-
AccessibilityState,
|
|
30
|
-
AccessibilityValue,
|
|
31
|
-
Role,
|
|
27
|
+
AccessibilityProps,
|
|
32
28
|
} from './ViewAccessibility';
|
|
33
29
|
import type {Node} from 'react';
|
|
34
30
|
|
|
35
|
-
export type ViewLayout =
|
|
36
|
-
export type ViewLayoutEvent =
|
|
31
|
+
export type ViewLayout = LayoutRectangle;
|
|
32
|
+
export type ViewLayoutEvent = LayoutChangeEvent;
|
|
37
33
|
|
|
38
34
|
type DirectEventProps = $ReadOnly<{
|
|
39
35
|
/**
|
|
@@ -62,7 +58,7 @@ type DirectEventProps = $ReadOnly<{
|
|
|
62
58
|
*
|
|
63
59
|
* See https://reactnative.dev/docs/view#onlayout
|
|
64
60
|
*/
|
|
65
|
-
onLayout?: ?(event:
|
|
61
|
+
onLayout?: ?(event: LayoutChangeEvent) => mixed,
|
|
66
62
|
|
|
67
63
|
/**
|
|
68
64
|
* When `accessible` is `true`, the system will invoke this function when the
|
|
@@ -120,14 +116,14 @@ type FocusEventProps = $ReadOnly<{
|
|
|
120
116
|
}>;
|
|
121
117
|
|
|
122
118
|
type TouchEventProps = $ReadOnly<{
|
|
123
|
-
onTouchCancel?: ?(e:
|
|
124
|
-
onTouchCancelCapture?: ?(e:
|
|
125
|
-
onTouchEnd?: ?(e:
|
|
126
|
-
onTouchEndCapture?: ?(e:
|
|
127
|
-
onTouchMove?: ?(e:
|
|
128
|
-
onTouchMoveCapture?: ?(e:
|
|
129
|
-
onTouchStart?: ?(e:
|
|
130
|
-
onTouchStartCapture?: ?(e:
|
|
119
|
+
onTouchCancel?: ?(e: GestureResponderEvent) => void,
|
|
120
|
+
onTouchCancelCapture?: ?(e: GestureResponderEvent) => void,
|
|
121
|
+
onTouchEnd?: ?(e: GestureResponderEvent) => void,
|
|
122
|
+
onTouchEndCapture?: ?(e: GestureResponderEvent) => void,
|
|
123
|
+
onTouchMove?: ?(e: GestureResponderEvent) => void,
|
|
124
|
+
onTouchMoveCapture?: ?(e: GestureResponderEvent) => void,
|
|
125
|
+
onTouchStart?: ?(e: GestureResponderEvent) => void,
|
|
126
|
+
onTouchStartCapture?: ?(e: GestureResponderEvent) => void,
|
|
131
127
|
}>;
|
|
132
128
|
|
|
133
129
|
/**
|
|
@@ -135,7 +131,7 @@ type TouchEventProps = $ReadOnly<{
|
|
|
135
131
|
* `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`,
|
|
136
132
|
* `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion.
|
|
137
133
|
*/
|
|
138
|
-
type
|
|
134
|
+
export type GestureResponderHandlers = $ReadOnly<{
|
|
139
135
|
/**
|
|
140
136
|
* Does this view want to "claim" touch responsiveness? This is called for
|
|
141
137
|
* every touch move on the `View` when it is not the responder.
|
|
@@ -145,7 +141,7 @@ type GestureResponderEventProps = $ReadOnly<{
|
|
|
145
141
|
*
|
|
146
142
|
* See https://reactnative.dev/docs/view#onmoveshouldsetresponder
|
|
147
143
|
*/
|
|
148
|
-
onMoveShouldSetResponder?: ?(e:
|
|
144
|
+
onMoveShouldSetResponder?: ?(e: GestureResponderEvent) => boolean,
|
|
149
145
|
|
|
150
146
|
/**
|
|
151
147
|
* If a parent `View` wants to prevent a child `View` from becoming responder
|
|
@@ -156,7 +152,7 @@ type GestureResponderEventProps = $ReadOnly<{
|
|
|
156
152
|
*
|
|
157
153
|
* See https://reactnative.dev/docs/view#onMoveShouldsetrespondercapture
|
|
158
154
|
*/
|
|
159
|
-
onMoveShouldSetResponderCapture?: ?(e:
|
|
155
|
+
onMoveShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean,
|
|
160
156
|
|
|
161
157
|
/**
|
|
162
158
|
* The View is now responding for touch events. This is the time to highlight
|
|
@@ -170,7 +166,7 @@ type GestureResponderEventProps = $ReadOnly<{
|
|
|
170
166
|
*
|
|
171
167
|
* See https://reactnative.dev/docs/view#onrespondergrant
|
|
172
168
|
*/
|
|
173
|
-
onResponderGrant?: ?(e:
|
|
169
|
+
onResponderGrant?: ?(e: GestureResponderEvent) => void | boolean,
|
|
174
170
|
|
|
175
171
|
/**
|
|
176
172
|
* The user is moving their finger.
|
|
@@ -180,7 +176,7 @@ type GestureResponderEventProps = $ReadOnly<{
|
|
|
180
176
|
*
|
|
181
177
|
* See https://reactnative.dev/docs/view#onrespondermove
|
|
182
178
|
*/
|
|
183
|
-
onResponderMove?: ?(e:
|
|
179
|
+
onResponderMove?: ?(e: GestureResponderEvent) => void,
|
|
184
180
|
|
|
185
181
|
/**
|
|
186
182
|
* Another responder is already active and will not release it to that `View`
|
|
@@ -191,7 +187,7 @@ type GestureResponderEventProps = $ReadOnly<{
|
|
|
191
187
|
*
|
|
192
188
|
* See https://reactnative.dev/docs/view#onresponderreject
|
|
193
189
|
*/
|
|
194
|
-
onResponderReject?: ?(e:
|
|
190
|
+
onResponderReject?: ?(e: GestureResponderEvent) => void,
|
|
195
191
|
|
|
196
192
|
/**
|
|
197
193
|
* Fired at the end of the touch.
|
|
@@ -201,10 +197,10 @@ type GestureResponderEventProps = $ReadOnly<{
|
|
|
201
197
|
*
|
|
202
198
|
* See https://reactnative.dev/docs/view#onresponderrelease
|
|
203
199
|
*/
|
|
204
|
-
onResponderRelease?: ?(e:
|
|
200
|
+
onResponderRelease?: ?(e: GestureResponderEvent) => void,
|
|
205
201
|
|
|
206
|
-
onResponderStart?: ?(e:
|
|
207
|
-
onResponderEnd?: ?(e:
|
|
202
|
+
onResponderStart?: ?(e: GestureResponderEvent) => void,
|
|
203
|
+
onResponderEnd?: ?(e: GestureResponderEvent) => void,
|
|
208
204
|
|
|
209
205
|
/**
|
|
210
206
|
* The responder has been taken from the `View`. Might be taken by other
|
|
@@ -217,7 +213,7 @@ type GestureResponderEventProps = $ReadOnly<{
|
|
|
217
213
|
*
|
|
218
214
|
* See https://reactnative.dev/docs/view#onresponderterminate
|
|
219
215
|
*/
|
|
220
|
-
onResponderTerminate?: ?(e:
|
|
216
|
+
onResponderTerminate?: ?(e: GestureResponderEvent) => void,
|
|
221
217
|
|
|
222
218
|
/**
|
|
223
219
|
* Some other `View` wants to become responder and is asking this `View` to
|
|
@@ -228,7 +224,7 @@ type GestureResponderEventProps = $ReadOnly<{
|
|
|
228
224
|
*
|
|
229
225
|
* See https://reactnative.dev/docs/view#onresponderterminationrequest
|
|
230
226
|
*/
|
|
231
|
-
onResponderTerminationRequest?: ?(e:
|
|
227
|
+
onResponderTerminationRequest?: ?(e: GestureResponderEvent) => boolean,
|
|
232
228
|
|
|
233
229
|
/**
|
|
234
230
|
* Does this view want to become responder on the start of a touch?
|
|
@@ -238,7 +234,7 @@ type GestureResponderEventProps = $ReadOnly<{
|
|
|
238
234
|
*
|
|
239
235
|
* See https://reactnative.dev/docs/view#onstartshouldsetresponder
|
|
240
236
|
*/
|
|
241
|
-
onStartShouldSetResponder?: ?(e:
|
|
237
|
+
onStartShouldSetResponder?: ?(e: GestureResponderEvent) => boolean,
|
|
242
238
|
|
|
243
239
|
/**
|
|
244
240
|
* If a parent `View` wants to prevent a child `View` from becoming responder
|
|
@@ -249,7 +245,7 @@ type GestureResponderEventProps = $ReadOnly<{
|
|
|
249
245
|
*
|
|
250
246
|
* See https://reactnative.dev/docs/view#onstartshouldsetrespondercapture
|
|
251
247
|
*/
|
|
252
|
-
onStartShouldSetResponderCapture?: ?(e:
|
|
248
|
+
onStartShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean,
|
|
253
249
|
}>;
|
|
254
250
|
|
|
255
251
|
type AndroidDrawableThemeAttr = $ReadOnly<{
|
|
@@ -266,43 +262,7 @@ type AndroidDrawableRipple = $ReadOnly<{
|
|
|
266
262
|
|
|
267
263
|
type AndroidDrawable = AndroidDrawableThemeAttr | AndroidDrawableRipple;
|
|
268
264
|
|
|
269
|
-
type
|
|
270
|
-
/**
|
|
271
|
-
* Identifies the element that labels the element it is applied to. When the assistive technology focuses on the component with this props,
|
|
272
|
-
* the text is read aloud. The value should should match the nativeID of the related element.
|
|
273
|
-
*
|
|
274
|
-
* @platform android
|
|
275
|
-
*/
|
|
276
|
-
accessibilityLabelledBy?: ?string | ?Array<string>,
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Identifies the element that labels the element it is applied to. When the assistive technology focuses on the component with this props,
|
|
280
|
-
* the text is read aloud. The value should should match the nativeID of the related element.
|
|
281
|
-
*
|
|
282
|
-
* @platform android
|
|
283
|
-
*/
|
|
284
|
-
'aria-labelledby'?: ?string,
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Indicates to accessibility services whether the user should be notified
|
|
288
|
-
* when this view changes. Works for Android API >= 19 only.
|
|
289
|
-
*
|
|
290
|
-
* @platform android
|
|
291
|
-
*
|
|
292
|
-
* See https://reactnative.dev/docs/view#accessibilityliveregion
|
|
293
|
-
*/
|
|
294
|
-
accessibilityLiveRegion?: ?('none' | 'polite' | 'assertive'),
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Indicates to accessibility services whether the user should be notified
|
|
298
|
-
* when this view changes. Works for Android API >= 19 only.
|
|
299
|
-
*
|
|
300
|
-
* @platform android
|
|
301
|
-
*
|
|
302
|
-
* See https://reactnative.dev/docs/view#accessibilityliveregion
|
|
303
|
-
*/
|
|
304
|
-
'aria-live'?: ?('polite' | 'assertive' | 'off'),
|
|
305
|
-
|
|
265
|
+
export type ViewPropsAndroid = $ReadOnly<{
|
|
306
266
|
nativeBackgroundAndroid?: ?AndroidDrawable,
|
|
307
267
|
nativeForegroundAndroid?: ?AndroidDrawable,
|
|
308
268
|
|
|
@@ -316,17 +276,6 @@ type AndroidViewProps = $ReadOnly<{
|
|
|
316
276
|
*/
|
|
317
277
|
renderToHardwareTextureAndroid?: ?boolean,
|
|
318
278
|
|
|
319
|
-
/**
|
|
320
|
-
* Controls how view is important for accessibility which is if it
|
|
321
|
-
* fires accessibility events and if it is reported to accessibility services
|
|
322
|
-
* that query the screen. Works for Android only.
|
|
323
|
-
*
|
|
324
|
-
* @platform android
|
|
325
|
-
*
|
|
326
|
-
* See https://reactnative.dev/docs/view#importantforaccessibility
|
|
327
|
-
*/
|
|
328
|
-
importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
|
|
329
|
-
|
|
330
279
|
/**
|
|
331
280
|
* Whether to force the Android TV focus engine to move focus to this view.
|
|
332
281
|
*
|
|
@@ -394,70 +343,10 @@ type AndroidViewProps = $ReadOnly<{
|
|
|
394
343
|
*
|
|
395
344
|
* @platform android
|
|
396
345
|
*/
|
|
397
|
-
onClick?: ?(event:
|
|
346
|
+
onClick?: ?(event: GestureResponderEvent) => mixed,
|
|
398
347
|
}>;
|
|
399
348
|
|
|
400
|
-
type
|
|
401
|
-
/**
|
|
402
|
-
* Prevents view from being inverted if set to true and color inversion is turned on.
|
|
403
|
-
*
|
|
404
|
-
* @platform ios
|
|
405
|
-
*/
|
|
406
|
-
accessibilityIgnoresInvertColors?: ?boolean,
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* A value indicating whether VoiceOver should ignore the elements
|
|
410
|
-
* within views that are siblings of the receiver.
|
|
411
|
-
* Default is `false`.
|
|
412
|
-
*
|
|
413
|
-
* @platform ios
|
|
414
|
-
*
|
|
415
|
-
* See https://reactnative.dev/docs/view#accessibilityviewismodal
|
|
416
|
-
*/
|
|
417
|
-
accessibilityViewIsModal?: ?boolean,
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* @platform ios
|
|
421
|
-
*
|
|
422
|
-
* See https://reactnative.dev/docs/view#accessibilityshowslargecontentviewer
|
|
423
|
-
*/
|
|
424
|
-
accessibilityShowsLargeContentViewer?: ?boolean,
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* @platform ios
|
|
428
|
-
*
|
|
429
|
-
* See https://reactnative.dev/docs/view#accessibilitylargecontenttitle
|
|
430
|
-
*/
|
|
431
|
-
accessibilityLargeContentTitle?: ?string,
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* The aria-modal attribute indicates content contained within a modal with aria-modal="true"
|
|
435
|
-
* should be accessible to the user.
|
|
436
|
-
* Default is `false`.
|
|
437
|
-
*
|
|
438
|
-
* @platform ios
|
|
439
|
-
*/
|
|
440
|
-
'aria-modal'?: ?boolean,
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* A value indicating whether the accessibility elements contained within
|
|
444
|
-
* this accessibility element are hidden.
|
|
445
|
-
*
|
|
446
|
-
* @platform ios
|
|
447
|
-
*
|
|
448
|
-
* See https://reactnative.dev/docs/view#accessibilityElementsHidden
|
|
449
|
-
*/
|
|
450
|
-
accessibilityElementsHidden?: ?boolean,
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Indicates to the accessibility services that the UI component is in
|
|
454
|
-
* a specific language. The provided string should be formatted following
|
|
455
|
-
* the BCP 47 specification (https://www.rfc-editor.org/info/bcp47).
|
|
456
|
-
*
|
|
457
|
-
* @platform ios
|
|
458
|
-
*/
|
|
459
|
-
accessibilityLanguage?: ?Stringish,
|
|
460
|
-
|
|
349
|
+
export type ViewPropsIOS = $ReadOnly<{
|
|
461
350
|
/**
|
|
462
351
|
* Whether this `View` should be rendered as a bitmap before compositing.
|
|
463
352
|
*
|
|
@@ -479,7 +368,7 @@ export type HandledKeyboardEvent = $ReadOnly<{|
|
|
|
479
368
|
handledEventPhase?: number,
|
|
480
369
|
|}>;
|
|
481
370
|
|
|
482
|
-
type
|
|
371
|
+
type ViewPropsWindows = $ReadOnly<{|
|
|
483
372
|
/**
|
|
484
373
|
* Key up event
|
|
485
374
|
*
|
|
@@ -529,99 +418,18 @@ type WindowsViewProps = $ReadOnly<{|
|
|
|
529
418
|
|
|
530
419
|
export type ViewProps = $ReadOnly<{
|
|
531
420
|
...DirectEventProps,
|
|
532
|
-
...
|
|
421
|
+
...GestureResponderHandlers,
|
|
533
422
|
...MouseEventProps,
|
|
534
423
|
...PointerEventProps,
|
|
535
424
|
...FocusEventProps,
|
|
536
425
|
...TouchEventProps,
|
|
537
|
-
...
|
|
538
|
-
...
|
|
539
|
-
...
|
|
540
|
-
|
|
426
|
+
...ViewPropsAndroid,
|
|
427
|
+
...ViewPropsIOS,
|
|
428
|
+
...AccessibilityProps,
|
|
429
|
+
...ViewPropsWindows, // [Windows]
|
|
541
430
|
children?: Node,
|
|
542
431
|
style?: ?ViewStyleProp,
|
|
543
432
|
|
|
544
|
-
/**
|
|
545
|
-
* When `true`, indicates that the view is an accessibility element.
|
|
546
|
-
* By default, all the touchable elements are accessible.
|
|
547
|
-
*
|
|
548
|
-
* See https://reactnative.dev/docs/view#accessible
|
|
549
|
-
*/
|
|
550
|
-
accessible?: ?boolean,
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* Overrides the text that's read by the screen reader when the user interacts
|
|
554
|
-
* with the element. By default, the label is constructed by traversing all
|
|
555
|
-
* the children and accumulating all the `Text` nodes separated by space.
|
|
556
|
-
*
|
|
557
|
-
* See https://reactnative.dev/docs/view#accessibilitylabel
|
|
558
|
-
*/
|
|
559
|
-
accessibilityLabel?: ?Stringish,
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* An accessibility hint helps users understand what will happen when they perform
|
|
563
|
-
* an action on the accessibility element when that result is not obvious from the
|
|
564
|
-
* accessibility label.
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
* See https://reactnative.dev/docs/view#accessibilityHint
|
|
568
|
-
*/
|
|
569
|
-
accessibilityHint?: ?Stringish,
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* Alias for accessibilityLabel https://reactnative.dev/docs/view#accessibilitylabel
|
|
573
|
-
* https://github.com/facebook/react-native/issues/34424
|
|
574
|
-
*/
|
|
575
|
-
'aria-label'?: ?Stringish,
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* Indicates to accessibility services to treat UI component like a specific role.
|
|
579
|
-
*/
|
|
580
|
-
accessibilityRole?: ?AccessibilityRole,
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Alias for accessibilityRole
|
|
584
|
-
*/
|
|
585
|
-
role?: ?Role,
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Indicates to accessibility services that UI Component is in a specific State.
|
|
589
|
-
*/
|
|
590
|
-
accessibilityState?: ?AccessibilityState,
|
|
591
|
-
accessibilityValue?: ?AccessibilityValue,
|
|
592
|
-
|
|
593
|
-
/**
|
|
594
|
-
* alias for accessibilityState
|
|
595
|
-
* It represents textual description of a component's value, or for range-based components, such as sliders and progress bars.
|
|
596
|
-
*/
|
|
597
|
-
'aria-valuemax'?: ?AccessibilityValue['max'],
|
|
598
|
-
'aria-valuemin'?: ?AccessibilityValue['min'],
|
|
599
|
-
'aria-valuenow'?: ?AccessibilityValue['now'],
|
|
600
|
-
'aria-valuetext'?: ?AccessibilityValue['text'],
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* Provides an array of custom actions available for accessibility.
|
|
604
|
-
*
|
|
605
|
-
*/
|
|
606
|
-
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
* alias for accessibilityState
|
|
610
|
-
*
|
|
611
|
-
* see https://reactnative.dev/docs/accessibility#accessibilitystate
|
|
612
|
-
*/
|
|
613
|
-
'aria-busy'?: ?boolean,
|
|
614
|
-
'aria-checked'?: ?boolean | 'mixed',
|
|
615
|
-
'aria-disabled'?: ?boolean,
|
|
616
|
-
'aria-expanded'?: ?boolean,
|
|
617
|
-
'aria-selected'?: ?boolean,
|
|
618
|
-
/** A value indicating whether the accessibility elements contained within
|
|
619
|
-
* this accessibility element are hidden.
|
|
620
|
-
*
|
|
621
|
-
* See https://reactnative.dev/docs/view#aria-hidden
|
|
622
|
-
*/
|
|
623
|
-
'aria-hidden'?: ?boolean,
|
|
624
|
-
|
|
625
433
|
/**
|
|
626
434
|
* Views that are only used to layout their children or otherwise don't draw
|
|
627
435
|
* anything may be automatically removed from the native hierarchy as an
|
|
@@ -39,7 +39,7 @@ export default async function symbolicateStackTrace(
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Lazy-load `fetch` until the first symbolication call to avoid circular requires.
|
|
42
|
-
const fetch = global.fetch ?? require('../../Network/fetch');
|
|
42
|
+
const fetch = global.fetch ?? require('../../Network/fetch').fetch;
|
|
43
43
|
const response = await fetch(devServer.url + 'symbolicate', {
|
|
44
44
|
method: 'POST',
|
|
45
45
|
headers: {
|
|
@@ -51,7 +51,8 @@ if (__DEV__) {
|
|
|
51
51
|
|
|
52
52
|
require('../ReactNative/AppRegistry');
|
|
53
53
|
|
|
54
|
-
const GlobalPerformanceLogger =
|
|
54
|
+
const GlobalPerformanceLogger =
|
|
55
|
+
require('../Utilities/GlobalPerformanceLogger').default;
|
|
55
56
|
// We could just call GlobalPerformanceLogger.markPoint at the top of the file,
|
|
56
57
|
// but then we'd be excluding the time it took to require the logger.
|
|
57
58
|
// Instead, we just use Date.now and backdate the timestamp.
|
|
@@ -36,6 +36,7 @@ const IDLE_CALLBACK_FRAME_DEADLINE = 1;
|
|
|
36
36
|
const callbacks: Array<?Function> = [];
|
|
37
37
|
const types: Array<?JSTimerType> = [];
|
|
38
38
|
const timerIDs: Array<?number> = [];
|
|
39
|
+
const freeIdxs: Array<number> = [];
|
|
39
40
|
let reactNativeMicrotasks: Array<number> = [];
|
|
40
41
|
let requestIdleCallbacks: Array<number> = [];
|
|
41
42
|
const requestIdleCallbackTimeouts: {[number]: number, ...} = {};
|
|
@@ -47,11 +48,11 @@ let hasEmittedTimeDriftWarning = false;
|
|
|
47
48
|
|
|
48
49
|
// Returns a free index if one is available, and the next consecutive index otherwise.
|
|
49
50
|
function _getFreeIndex(): number {
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
|
|
51
|
+
const freeIdx = freeIdxs.pop();
|
|
52
|
+
if (freeIdx === undefined) {
|
|
53
|
+
return timerIDs.length;
|
|
53
54
|
}
|
|
54
|
-
return
|
|
55
|
+
return freeIdx;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
function _allocateCallback(func: Function, type: JSTimerType): number {
|
|
@@ -171,6 +172,7 @@ function _clearIndex(i: number) {
|
|
|
171
172
|
timerIDs[i] = null;
|
|
172
173
|
callbacks[i] = null;
|
|
173
174
|
types[i] = null;
|
|
175
|
+
freeIdxs.push(i);
|
|
174
176
|
}
|
|
175
177
|
|
|
176
178
|
function _freeCallback(timerID: number) {
|
|
@@ -16,7 +16,7 @@ registerModule('Systrace', () => require('../Performance/Systrace'));
|
|
|
16
16
|
if (!(global.RN$Bridgeless === true)) {
|
|
17
17
|
registerModule('JSTimers', () => require('./Timers/JSTimers').default);
|
|
18
18
|
}
|
|
19
|
-
registerModule('RCTLog', () => require('../Utilities/RCTLog'));
|
|
19
|
+
registerModule('RCTLog', () => require('../Utilities/RCTLog').default);
|
|
20
20
|
registerModule(
|
|
21
21
|
'RCTDeviceEventEmitter',
|
|
22
22
|
() => require('../EventEmitter/RCTDeviceEventEmitter').default,
|
|
@@ -25,12 +25,16 @@ registerModule(
|
|
|
25
25
|
'RCTNativeAppEventEmitter',
|
|
26
26
|
() => require('../EventEmitter/RCTNativeAppEventEmitter').default,
|
|
27
27
|
);
|
|
28
|
-
registerModule(
|
|
29
|
-
|
|
28
|
+
registerModule(
|
|
29
|
+
'GlobalPerformanceLogger',
|
|
30
|
+
() => require('../Utilities/GlobalPerformanceLogger').default,
|
|
30
31
|
);
|
|
31
32
|
|
|
32
33
|
if (__DEV__) {
|
|
33
|
-
registerModule('HMRClient', () => require('../Utilities/HMRClient'));
|
|
34
|
+
registerModule('HMRClient', () => require('../Utilities/HMRClient').default);
|
|
34
35
|
} else {
|
|
35
|
-
registerModule(
|
|
36
|
+
registerModule(
|
|
37
|
+
'HMRClient',
|
|
38
|
+
() => require('../Utilities/HMRClientProdShim').default,
|
|
39
|
+
);
|
|
36
40
|
}
|
|
@@ -17,28 +17,11 @@ declare var console: {[string]: $FlowFixMe};
|
|
|
17
17
|
* You can use this module directly, or just require InitializeCore.
|
|
18
18
|
*/
|
|
19
19
|
if (__DEV__) {
|
|
20
|
-
// Note we can't check if console is "native" because it would appear "native" in JSC and Hermes.
|
|
21
|
-
// We also can't check any properties that don't exist in the Chrome worker environment.
|
|
22
|
-
// So we check a navigator property that's set to a particular value ("Netscape") in all real browsers.
|
|
23
|
-
const isLikelyARealBrowser =
|
|
24
|
-
global.navigator != null &&
|
|
25
|
-
/* _
|
|
26
|
-
* | |
|
|
27
|
-
* _ __ ___| |_ ___ ___ __ _ _ __ ___
|
|
28
|
-
* | '_ \ / _ \ __/ __|/ __/ _` | '_ \ / _ \
|
|
29
|
-
* | | | | __/ |_\__ \ (_| (_| | |_) | __/
|
|
30
|
-
* |_| |_|\___|\__|___/\___\__,_| .__/ \___|
|
|
31
|
-
* | |
|
|
32
|
-
* |_|
|
|
33
|
-
*/
|
|
34
|
-
global.navigator.appName === 'Netscape'; // Any real browser
|
|
35
|
-
|
|
36
20
|
if (!Platform.isTesting) {
|
|
37
|
-
const HMRClient = require('../Utilities/HMRClient');
|
|
21
|
+
const HMRClient = require('../Utilities/HMRClient').default;
|
|
38
22
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} else if (console._isPolyfilled) {
|
|
23
|
+
// TODO(T214991636): Remove legacy Metro log forwarding
|
|
24
|
+
if (console._isPolyfilled) {
|
|
42
25
|
// We assume full control over the console and send JavaScript logs to Metro.
|
|
43
26
|
[
|
|
44
27
|
'trace',
|
|
@@ -57,15 +40,6 @@ if (__DEV__) {
|
|
|
57
40
|
originalFunction.apply(console, args);
|
|
58
41
|
};
|
|
59
42
|
});
|
|
60
|
-
} else {
|
|
61
|
-
// We assume the environment has a real rich console (like Chrome), and don't hijack it to log to Metro.
|
|
62
|
-
// It's likely the developer is using rich console to debug anyway, and hijacking it would
|
|
63
|
-
// lose the filenames in console.log calls: https://github.com/facebook/react-native/issues/26788.
|
|
64
|
-
HMRClient.log('log', [
|
|
65
|
-
`JavaScript logs will appear in your ${
|
|
66
|
-
isLikelyARealBrowser ? 'browser' : 'environment'
|
|
67
|
-
} console`,
|
|
68
|
-
]);
|
|
69
43
|
}
|
|
70
44
|
}
|
|
71
45
|
|
|
@@ -72,7 +72,7 @@ if (__DEV__) {
|
|
|
72
72
|
|
|
73
73
|
const ReactNativeStyleAttributes =
|
|
74
74
|
require('../Components/View/ReactNativeStyleAttributes').default;
|
|
75
|
-
const resolveRNStyle = require('../StyleSheet/flattenStyle');
|
|
75
|
+
const resolveRNStyle = require('../StyleSheet/flattenStyle').default;
|
|
76
76
|
|
|
77
77
|
function handleReactDevToolsSettingsUpdate(settings: Object) {
|
|
78
78
|
reactDevToolsSettingsManager.setGlobalHookSettings(
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
if (__DEV__) {
|
|
14
|
-
const DevSettings = require('../Utilities/DevSettings');
|
|
14
|
+
const DevSettings = require('../Utilities/DevSettings').default;
|
|
15
15
|
|
|
16
16
|
if (typeof DevSettings.reload !== 'function') {
|
|
17
17
|
throw new Error('Could not find the reload() implementation.');
|
|
@@ -18,8 +18,11 @@ const {polyfillGlobal} = require('../Utilities/PolyfillFunctions');
|
|
|
18
18
|
*
|
|
19
19
|
* You can use this module directly, or just require InitializeCore.
|
|
20
20
|
*/
|
|
21
|
-
polyfillGlobal(
|
|
22
|
-
|
|
21
|
+
polyfillGlobal(
|
|
22
|
+
'XMLHttpRequest',
|
|
23
|
+
() => require('../Network/XMLHttpRequest').default,
|
|
24
|
+
);
|
|
25
|
+
polyfillGlobal('FormData', () => require('../Network/FormData').default);
|
|
23
26
|
|
|
24
27
|
polyfillGlobal('fetch', () => require('../Network/fetch').fetch);
|
|
25
28
|
polyfillGlobal('Headers', () => require('../Network/fetch').Headers);
|
|
@@ -26,6 +26,9 @@ interface NativeModule {
|
|
|
26
26
|
|
|
27
27
|
export type {EventSubscription};
|
|
28
28
|
|
|
29
|
+
// $FlowFixMe[unclear-type] unclear type of events
|
|
30
|
+
type UnsafeObject = Object;
|
|
31
|
+
|
|
29
32
|
/**
|
|
30
33
|
* `NativeEventEmitter` is intended for use by Native Modules to emit events to
|
|
31
34
|
* JavaScript listeners. If a `NativeModule` is supplied to the constructor, it
|
|
@@ -36,8 +39,11 @@ export type {EventSubscription};
|
|
|
36
39
|
* This means event names must be globally unique, and it means that call sites
|
|
37
40
|
* can theoretically listen to `RCTDeviceEventEmitter` (although discouraged).
|
|
38
41
|
*/
|
|
39
|
-
export default class NativeEventEmitter<
|
|
40
|
-
|
|
42
|
+
export default class NativeEventEmitter<
|
|
43
|
+
TEventToArgsMap: $ReadOnly<
|
|
44
|
+
Record<string, $ReadOnlyArray<UnsafeObject>>,
|
|
45
|
+
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
|
|
46
|
+
> implements IEventEmitter<TEventToArgsMap>
|
|
41
47
|
{
|
|
42
48
|
_nativeModule: ?NativeModule;
|
|
43
49
|
|
|
@@ -23,7 +23,7 @@ type RCTDeviceEventDefinitions = {[name: string]: Array<any>};
|
|
|
23
23
|
*
|
|
24
24
|
* NativeModules that emit events should instead subclass `NativeEventEmitter`.
|
|
25
25
|
*/
|
|
26
|
-
class
|
|
26
|
+
class RCTDeviceEventEmitterImpl extends EventEmitter<RCTDeviceEventDefinitions> {
|
|
27
27
|
// Add systrace to RCTDeviceEventEmitter.emit method for debugging
|
|
28
28
|
emit<TEvent: $Keys<RCTDeviceEventDefinitions>>(
|
|
29
29
|
eventType: TEvent,
|
|
@@ -34,11 +34,12 @@ class RCTDeviceEventEmitter extends EventEmitter<RCTDeviceEventDefinitions> {
|
|
|
34
34
|
endEvent();
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const RCTDeviceEventEmitter: IEventEmitter<RCTDeviceEventDefinitions> =
|
|
38
|
+
new RCTDeviceEventEmitterImpl();
|
|
38
39
|
|
|
39
40
|
Object.defineProperty(global, '__rctDeviceEventEmitter', {
|
|
40
41
|
configurable: true,
|
|
41
|
-
value:
|
|
42
|
+
value: RCTDeviceEventEmitter,
|
|
42
43
|
});
|
|
43
44
|
|
|
44
|
-
export default (
|
|
45
|
+
export default (RCTDeviceEventEmitter: IEventEmitter<RCTDeviceEventDefinitions>);
|
|
@@ -18,8 +18,9 @@ import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter';
|
|
|
18
18
|
/**
|
|
19
19
|
* Mock `NativeEventEmitter` to ignore Native Modules.
|
|
20
20
|
*/
|
|
21
|
-
export default class NativeEventEmitter<
|
|
22
|
-
|
|
21
|
+
export default class NativeEventEmitter<
|
|
22
|
+
TEventToArgsMap: $ReadOnly<Record<string, $ReadOnlyArray<mixed>>>,
|
|
23
|
+
> implements IEventEmitter<TEventToArgsMap>
|
|
23
24
|
{
|
|
24
25
|
addListener<TEvent: $Keys<TEventToArgsMap>>(
|
|
25
26
|
eventType: TEvent,
|
|
@@ -25,7 +25,7 @@ class CustomEvent extends EventPolyfill {
|
|
|
25
25
|
const {bubbles, cancelable, composed} = options;
|
|
26
26
|
super(typeArg, {bubbles, cancelable, composed});
|
|
27
27
|
|
|
28
|
-
this.detail = options.detail; // this would correspond to `NativeEvent` in
|
|
28
|
+
this.detail = options.detail; // this would correspond to `NativeEvent` in NativeSyntheticEvent
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -152,9 +152,9 @@ class EventPolyfill implements IEvent {
|
|
|
152
152
|
/** @deprecated */
|
|
153
153
|
srcElement: Element; // TODO: nullable
|
|
154
154
|
|
|
155
|
-
// React Native-specific: proxy data to a
|
|
155
|
+
// React Native-specific: proxy data to a NativeSyntheticEvent when
|
|
156
156
|
// certain methods are called.
|
|
157
|
-
//
|
|
157
|
+
// NativeSyntheticEvent will also have a reference to this instance -
|
|
158
158
|
// it is circular - and both classes use this reference to keep
|
|
159
159
|
// data with the other in sync.
|
|
160
160
|
_syntheticEvent: mixed;
|