@office-iss/react-native-win32 0.76.2 → 0.77.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/.eslintignore +1 -1
- package/.flowconfig +5 -1
- package/CHANGELOG.json +179 -53
- package/CHANGELOG.md +82 -28
- package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +1 -0
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +13 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +2 -2
- package/Libraries/Animated/NativeAnimatedAllowlist.js +20 -9
- package/Libraries/Animated/animations/Animation.js +60 -25
- package/Libraries/Animated/animations/DecayAnimation.js +26 -38
- package/Libraries/Animated/animations/SpringAnimation.js +33 -39
- package/Libraries/Animated/animations/TimingAnimation.js +34 -42
- package/Libraries/Animated/components/AnimatedFlatList.js +1 -1
- package/Libraries/Animated/components/AnimatedSectionList.js +3 -1
- package/Libraries/Animated/createAnimatedComponent.js +60 -33
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +1 -1
- package/Libraries/Animated/nodes/AnimatedNode.js +39 -45
- package/Libraries/Animated/nodes/AnimatedObject.js +13 -3
- package/Libraries/Animated/nodes/AnimatedProps.js +104 -46
- package/Libraries/Animated/nodes/AnimatedStyle.js +116 -39
- package/Libraries/Animated/nodes/AnimatedTransform.js +56 -23
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -3
- package/Libraries/Animated/useAnimatedProps.js +41 -35
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +77 -5
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +82 -5
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +4 -4
- package/Libraries/Components/Button.js +9 -4
- package/Libraries/Components/Button.win32.js +12 -4
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -0
- package/Libraries/Components/Pressable/Pressable.js +4 -4
- package/Libraries/Components/Pressable/Pressable.win32.js +4 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +13 -7
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +3 -2
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +4 -4
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +4 -4
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +0 -1
- package/Libraries/Components/ScrollView/ScrollView.js +49 -88
- package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
- package/Libraries/Components/ScrollView/ScrollViewContext.js +2 -0
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +0 -2
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +8 -9
- package/Libraries/Components/Switch/Switch.js +8 -6
- package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +4 -4
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +6 -4
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +27 -4
- package/Libraries/Components/TextInput/TextInput.flow.js +36 -19
- package/Libraries/Components/TextInput/TextInput.js +37 -13
- package/Libraries/Components/TextInput/TextInput.win32.js +40 -15
- package/Libraries/Components/TextInput/TextInputState.js +11 -13
- package/Libraries/Components/TextInput/TextInputState.win32.js +13 -16
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +3 -0
- package/Libraries/Components/Touchable/BoundingDimensions.js +11 -3
- package/Libraries/Components/Touchable/Position.js +7 -2
- package/Libraries/Components/Touchable/Touchable.js +4 -0
- package/Libraries/Components/Touchable/Touchable.win32.js +4 -0
- package/Libraries/Components/Touchable/TouchableBounce.js +6 -2
- package/Libraries/Components/Touchable/TouchableHighlight.js +5 -5
- package/Libraries/Components/Touchable/TouchableOpacity.js +6 -5
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -1
- package/Libraries/Components/View/View.js +4 -4
- package/Libraries/Components/View/View.win32.js +4 -4
- package/Libraries/Components/View/ViewNativeComponent.js +6 -98
- package/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
- package/Libraries/Components/View/ViewPropTypes.js +0 -3
- package/Libraries/Components/View/ViewPropTypes.win32.js +0 -3
- package/Libraries/Components/View/ViewWin32.js +1 -0
- package/Libraries/Core/ExceptionsManager.js +50 -29
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -1
- package/Libraries/Core/setUpBatchedBridge.js +1 -10
- package/Libraries/Core/setUpDeveloperTools.js +1 -5
- package/Libraries/Core/setUpErrorHandling.js +20 -18
- package/Libraries/Core/setUpReactDevTools.js +107 -8
- package/Libraries/Core/setUpSegmentFetcher.js +1 -0
- package/Libraries/Core/setUpTimers.js +21 -18
- package/Libraries/Debugging/DebuggingOverlay.js +4 -5
- package/Libraries/Image/AssetSourceResolver.js +12 -1
- package/Libraries/Image/Image.android.js +1 -5
- package/Libraries/Image/Image.d.ts +20 -29
- package/Libraries/Image/Image.ios.js +0 -2
- package/Libraries/Image/Image.win32.js +0 -2
- package/Libraries/Image/ImageBackground.js +2 -5
- package/Libraries/Image/ImageProps.js +7 -6
- package/Libraries/Image/ImageResizeMode.d.ts +8 -1
- package/Libraries/Image/ImageResizeMode.js +4 -1
- package/Libraries/Image/ImageSource.d.ts +0 -2
- package/Libraries/Image/ImageSource.js +0 -2
- package/Libraries/Image/ImageTypes.flow.js +11 -9
- package/Libraries/Image/ImageUtils.js +6 -3
- package/Libraries/Image/ImageViewNativeComponent.js +5 -3
- package/Libraries/Inspector/Inspector.js +1 -0
- package/Libraries/Inspector/Inspector.win32.js +2 -1
- package/Libraries/Inspector/NetworkOverlay.js +4 -0
- package/Libraries/Inspector/ReactDevToolsOverlay.js +8 -14
- package/Libraries/Inspector/getInspectorDataForViewAtPoint.js +3 -5
- package/Libraries/Interaction/InteractionManager.js +6 -1
- package/Libraries/Interaction/InteractionManagerStub.js +176 -0
- package/Libraries/Interaction/TouchHistoryMath.js +22 -19
- package/Libraries/JSInspector/NetworkAgent.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +1 -2
- package/Libraries/Lists/FlatList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +7 -7
- package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +2 -2
- package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +3 -3
- package/Libraries/LogBox/LogBox.js +18 -5
- package/Libraries/LogBox/LogBoxInspectorContainer.js +1 -1
- package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
- package/Libraries/LogBox/UI/AnsiHighlight.js +26 -17
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -1
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +6 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +1 -1
- package/Libraries/LogBox/UI/LogBoxMessage.js +2 -2
- package/Libraries/Modal/Modal.d.ts +12 -0
- package/Libraries/Modal/Modal.js +31 -4
- package/Libraries/NativeComponent/BaseViewConfig.android.js +72 -1
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -1
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +3 -11
- package/Libraries/NativeComponent/NativeComponentRegistry.js +3 -3
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -1
- package/Libraries/Network/FormData.js +11 -3
- package/Libraries/Network/XHRInterceptor.js +63 -14
- package/Libraries/Network/XMLHttpRequest.js +26 -1
- package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +49 -2
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -4
- package/Libraries/Pressability/HoverState.js +2 -0
- package/Libraries/Pressability/HoverState.win32.js +2 -0
- package/Libraries/Pressability/Pressability.js +2 -3
- package/Libraries/Pressability/Pressability.win32.js +2 -3
- package/Libraries/Pressability/usePressability.js +4 -1
- package/Libraries/ReactNative/AppContainer.js +1 -1
- package/Libraries/ReactNative/AppRegistry.js +1 -11
- package/Libraries/ReactNative/DisplayMode.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -3
- package/Libraries/ReactNative/RendererImplementation.js +18 -17
- package/Libraries/ReactNative/getCachedComponentWithDebugName.js +1 -3
- package/Libraries/ReactNative/renderApplication.js +9 -8
- package/Libraries/ReactNative/requireNativeComponent.js +5 -2
- package/Libraries/Renderer/shims/ReactFabric.js +3 -3
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
- package/Libraries/Renderer/shims/ReactNative.js +3 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +22 -35
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +5 -6
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/StyleSheet/StyleSheet.js +7 -1
- package/Libraries/StyleSheet/StyleSheet.win32.js +7 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +13 -2
- package/Libraries/StyleSheet/StyleSheetTypes.js +24 -6
- package/Libraries/StyleSheet/processBackgroundImage.js +87 -110
- package/Libraries/StyleSheet/processTransform.js +3 -34
- package/Libraries/Text/Text.js +248 -249
- package/Libraries/Text/Text.win32.js +282 -295
- package/Libraries/Text/TextNativeComponent.js +0 -1
- package/Libraries/TurboModule/TurboModuleRegistry.js +5 -5
- package/Libraries/Types/CoreEventTypes.d.ts +3 -10
- package/Libraries/Types/CoreEventTypes.js +4 -6
- package/Libraries/Types/CoreEventTypes.win32.js +4 -6
- package/Libraries/Utilities/Appearance.js +3 -1
- package/Libraries/Utilities/BackHandler.android.js +6 -18
- package/Libraries/Utilities/BackHandler.d.ts +0 -4
- package/Libraries/Utilities/BackHandler.ios.js +0 -7
- package/Libraries/Utilities/BackHandler.win32.js +6 -18
- package/Libraries/Utilities/FocusManager.win32.js +1 -1
- package/Libraries/Utilities/HMRClient.js +3 -4
- package/Libraries/Utilities/Platform.flow.js +2 -2
- package/Libraries/Utilities/Platform.flow.win32.js +3 -2
- package/Libraries/Utilities/__mocks__/BackHandler.js +3 -8
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/Utilities/useMergeRefs.js +26 -7
- package/Libraries/WebSocket/WebSocketEvent.js +4 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +31 -13
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +6 -5
- package/Libraries/promiseRejectionTrackingOptions.js +1 -1
- package/index.js +10 -3
- package/index.win32.js +10 -3
- package/jest/setup.js +36 -1
- package/overrides.json +37 -37
- package/package.json +20 -20
- package/src/private/animated/NativeAnimatedHelper.js +18 -16
- package/src/private/animated/NativeAnimatedHelper.win32.js +18 -15
- package/src/private/animated/useAnimatedPropsMemo.js +356 -0
- package/src/private/components/HScrollViewNativeComponents.js +1 -27
- package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +11 -8
- package/src/private/components/VScrollViewNativeComponents.js +2 -25
- package/src/private/debugging/ReactDevToolsSettingsManager.android.js +20 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.ios.js +30 -0
- package/src/private/debugging/ReactDevToolsSettingsManager.win32.js +20 -0
- package/src/private/{fusebox → debugging}/setUpFuseboxReactDevToolsDispatcher.js +6 -0
- package/src/private/devmenu/DevMenu.d.ts +20 -0
- package/src/private/devmenu/DevMenu.js +31 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +95 -86
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +8 -2
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -19
- package/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js +34 -0
- package/src/private/setup/setUpDOM.js +14 -6
- package/src/private/setup/setUpMutationObserver.js +5 -0
- package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -0
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
- package/src/private/specs/modules/NativeAccessibilityInfo.js +9 -0
- package/src/private/specs/modules/NativeAccessibilityInfoWin32.js +9 -0
- package/src/private/specs/modules/NativeAccessibilityManager.js +4 -0
- package/src/private/specs/modules/NativeActionSheetManager.js +2 -0
- package/src/private/specs/modules/NativeAppearance.js +4 -10
- package/src/private/specs/modules/NativeExceptionsManager.js +0 -12
- package/src/private/specs/modules/{NativeDevToolsSettingsManager.js → NativeReactDevToolsSettingsManager.js} +3 -5
- package/src/private/webapis/dom/geometry/DOMRect.js +2 -2
- package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +2 -2
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -3
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +102 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +26 -0
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +9 -0
- package/src/private/webapis/performance/EventTiming.js +13 -8
- package/src/private/webapis/performance/Performance.js +66 -73
- package/src/private/webapis/performance/PerformanceEntry.js +2 -5
- package/src/private/webapis/performance/PerformanceObserver.js +65 -164
- package/src/private/webapis/performance/RawPerformanceEntry.js +1 -1
- package/src/private/webapis/performance/UserTiming.js +11 -7
- package/src/private/webapis/performance/Utilities.js +18 -0
- package/src/private/webapis/performance/specs/NativePerformance.js +71 -2
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +267 -0
- package/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
- package/types/index.d.ts +1 -1
- package/types/public/ReactNativeTypes.d.ts +4 -8
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +0 -35
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +0 -20
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +0 -49
- package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +0 -35
- package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +0 -13
- package/Libraries/ReactNative/ReactFabricInternals.js +0 -17
- package/src/private/components/useSyncOnScroll.js +0 -48
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +0 -61
- package/src/private/webapis/performance/specs/__mocks__/NativePerformance.js +0 -67
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceObserver.js +0 -127
- package/types/experimental.d.ts +0 -59
- /package/src/private/{fusebox → debugging}/FuseboxSessionObserver.js +0 -0
|
@@ -16,9 +16,6 @@ const NativeModules = require('../BatchedBridge/NativeModules');
|
|
|
16
16
|
|
|
17
17
|
const turboModuleProxy = global.__turboModuleProxy;
|
|
18
18
|
|
|
19
|
-
const useLegacyNativeModuleInterop =
|
|
20
|
-
global.RN$Bridgeless !== true || global.RN$TurboInterop === true;
|
|
21
|
-
|
|
22
19
|
function requireModule<T: TurboModule>(name: string): ?T {
|
|
23
20
|
if (turboModuleProxy != null) {
|
|
24
21
|
const module: ?T = turboModuleProxy(name);
|
|
@@ -27,8 +24,11 @@ function requireModule<T: TurboModule>(name: string): ?T {
|
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
if (
|
|
31
|
-
|
|
27
|
+
if (
|
|
28
|
+
global.RN$Bridgeless !== true ||
|
|
29
|
+
global.RN$TurboInterop === true ||
|
|
30
|
+
global.RN$UnifiedNativeModuleProxy === true
|
|
31
|
+
) {
|
|
32
32
|
const legacyModule: ?T = NativeModules[name];
|
|
33
33
|
if (legacyModule != null) {
|
|
34
34
|
return legacyModule;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type * as React from 'react';
|
|
11
|
-
import {
|
|
11
|
+
import {HostInstance} from '../../types/public/ReactNativeTypes';
|
|
12
12
|
|
|
13
13
|
export interface LayoutRectangle {
|
|
14
14
|
x: number;
|
|
@@ -41,11 +41,7 @@ export interface TextLayoutEventData extends TargetedEvent {
|
|
|
41
41
|
|
|
42
42
|
// Similar to React.SyntheticEvent except for nativeEvent
|
|
43
43
|
export interface NativeSyntheticEvent<T>
|
|
44
|
-
extends React.BaseSyntheticEvent<
|
|
45
|
-
T,
|
|
46
|
-
React.ElementRef<HostComponent<unknown>>,
|
|
47
|
-
React.ElementRef<HostComponent<unknown>>
|
|
48
|
-
> {}
|
|
44
|
+
extends React.BaseSyntheticEvent<T, HostInstance, HostInstance> {}
|
|
49
45
|
|
|
50
46
|
export interface NativeTouchEvent {
|
|
51
47
|
/**
|
|
@@ -173,10 +169,7 @@ export interface NativeMouseEvent extends NativeUIEvent {
|
|
|
173
169
|
/**
|
|
174
170
|
* The secondary target for the event, if there is one.
|
|
175
171
|
*/
|
|
176
|
-
readonly relatedTarget:
|
|
177
|
-
| null
|
|
178
|
-
| number
|
|
179
|
-
| React.ElementRef<HostComponent<unknown>>;
|
|
172
|
+
readonly relatedTarget: null | number | HostInstance;
|
|
180
173
|
// offset is proposed: https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
|
|
181
174
|
/**
|
|
182
175
|
* The X coordinate of the mouse pointer between that event and the padding edge of the target node
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
12
|
-
|
|
13
|
-
import * as React from 'react';
|
|
11
|
+
import type {HostInstance} from '../Renderer/shims/ReactNativeTypes';
|
|
14
12
|
|
|
15
13
|
export type SyntheticEvent<+T> = $ReadOnly<{|
|
|
16
14
|
bubbles: ?boolean,
|
|
17
15
|
cancelable: ?boolean,
|
|
18
|
-
currentTarget: number |
|
|
16
|
+
currentTarget: number | HostInstance,
|
|
19
17
|
defaultPrevented: ?boolean,
|
|
20
18
|
dispatchConfig: $ReadOnly<{|
|
|
21
19
|
registrationName: string,
|
|
@@ -28,7 +26,7 @@ export type SyntheticEvent<+T> = $ReadOnly<{|
|
|
|
28
26
|
isTrusted: ?boolean,
|
|
29
27
|
nativeEvent: T,
|
|
30
28
|
persist: () => void,
|
|
31
|
-
target: ?number |
|
|
29
|
+
target: ?number | HostInstance,
|
|
32
30
|
timeStamp: number,
|
|
33
31
|
type: ?string,
|
|
34
32
|
|}>;
|
|
@@ -157,7 +155,7 @@ export interface NativeMouseEvent extends NativeUIEvent {
|
|
|
157
155
|
/**
|
|
158
156
|
* The secondary target for the event, if there is one.
|
|
159
157
|
*/
|
|
160
|
-
+relatedTarget: null | number |
|
|
158
|
+
+relatedTarget: null | number | HostInstance;
|
|
161
159
|
// offset is proposed: https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
|
|
162
160
|
/**
|
|
163
161
|
* The X coordinate of the mouse pointer between that event and the padding edge of the target node
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
12
|
-
|
|
13
|
-
import * as React from 'react';
|
|
11
|
+
import type {HostInstance} from '../Renderer/shims/ReactNativeTypes';
|
|
14
12
|
|
|
15
13
|
export type SyntheticEvent<+T> = $ReadOnly<{|
|
|
16
14
|
bubbles: ?boolean,
|
|
17
15
|
cancelable: ?boolean,
|
|
18
|
-
currentTarget: number |
|
|
16
|
+
currentTarget: number | HostInstance,
|
|
19
17
|
defaultPrevented: ?boolean,
|
|
20
18
|
dispatchConfig: $ReadOnly<{|
|
|
21
19
|
registrationName: string,
|
|
@@ -28,7 +26,7 @@ export type SyntheticEvent<+T> = $ReadOnly<{|
|
|
|
28
26
|
isTrusted: ?boolean,
|
|
29
27
|
nativeEvent: T,
|
|
30
28
|
persist: () => void,
|
|
31
|
-
target: ?number |
|
|
29
|
+
target: ?number | HostInstance,
|
|
32
30
|
timeStamp: number,
|
|
33
31
|
type: ?string,
|
|
34
32
|
|}>;
|
|
@@ -157,7 +155,7 @@ export interface NativeMouseEvent extends NativeUIEvent {
|
|
|
157
155
|
/**
|
|
158
156
|
* The secondary target for the event, if there is one.
|
|
159
157
|
*/
|
|
160
|
-
+relatedTarget: null | number |
|
|
158
|
+
+relatedTarget: null | number | HostInstance;
|
|
161
159
|
// offset is proposed: https://drafts.csswg.org/cssom-view/#extensions-to-the-mouseevent-interface
|
|
162
160
|
/**
|
|
163
161
|
* The X coordinate of the mouse pointer between that event and the padding edge of the target node
|
|
@@ -105,7 +105,9 @@ export function setColorScheme(colorScheme: ?ColorSchemeName): void {
|
|
|
105
105
|
const {NativeAppearance} = state;
|
|
106
106
|
if (NativeAppearance != null) {
|
|
107
107
|
NativeAppearance.setColorScheme(colorScheme ?? 'unspecified');
|
|
108
|
-
state.appearance = {
|
|
108
|
+
state.appearance = {
|
|
109
|
+
colorScheme: toColorScheme(NativeAppearance.getColorScheme()),
|
|
110
|
+
};
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
|
|
@@ -59,10 +59,6 @@ type TBackHandler = {|
|
|
|
59
59
|
eventName: BackPressEventName,
|
|
60
60
|
handler: () => ?boolean,
|
|
61
61
|
) => {remove: () => void, ...},
|
|
62
|
-
+removeEventListener: (
|
|
63
|
-
eventName: BackPressEventName,
|
|
64
|
-
handler: () => ?boolean,
|
|
65
|
-
) => void,
|
|
66
62
|
|};
|
|
67
63
|
const BackHandler: TBackHandler = {
|
|
68
64
|
exitApp: function (): void {
|
|
@@ -86,22 +82,14 @@ const BackHandler: TBackHandler = {
|
|
|
86
82
|
_backPressSubscriptions.push(handler);
|
|
87
83
|
}
|
|
88
84
|
return {
|
|
89
|
-
remove: (): void =>
|
|
85
|
+
remove: (): void => {
|
|
86
|
+
const index = _backPressSubscriptions.indexOf(handler);
|
|
87
|
+
if (index !== -1) {
|
|
88
|
+
_backPressSubscriptions.splice(index, 1);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
90
91
|
};
|
|
91
92
|
},
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Removes the event handler.
|
|
95
|
-
*/
|
|
96
|
-
removeEventListener: function (
|
|
97
|
-
eventName: BackPressEventName,
|
|
98
|
-
handler: () => ?boolean,
|
|
99
|
-
): void {
|
|
100
|
-
const index = _backPressSubscriptions.indexOf(handler);
|
|
101
|
-
if (index !== -1) {
|
|
102
|
-
_backPressSubscriptions.splice(index, 1);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
93
|
};
|
|
106
94
|
|
|
107
95
|
module.exports = BackHandler;
|
|
@@ -28,10 +28,6 @@ export interface BackHandlerStatic {
|
|
|
28
28
|
eventName: BackPressEventName,
|
|
29
29
|
handler: () => boolean | null | undefined,
|
|
30
30
|
): NativeEventSubscription;
|
|
31
|
-
removeEventListener(
|
|
32
|
-
eventName: BackPressEventName,
|
|
33
|
-
handler: () => boolean | null | undefined,
|
|
34
|
-
): void;
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
export const BackHandler: BackHandlerStatic;
|
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
module.exports = require('../Components/UnimplementedViews/UnimplementedView');
|
|
14
|
-
|
|
15
13
|
type BackPressEventName = 'backPress' | 'hardwareBackPress';
|
|
16
14
|
|
|
17
15
|
function emptyFunction(): void {}
|
|
@@ -22,10 +20,6 @@ type TBackHandler = {|
|
|
|
22
20
|
eventName: BackPressEventName,
|
|
23
21
|
handler: () => ?boolean,
|
|
24
22
|
) => {remove: () => void, ...},
|
|
25
|
-
+removeEventListener: (
|
|
26
|
-
eventName: BackPressEventName,
|
|
27
|
-
handler: () => ?boolean,
|
|
28
|
-
) => void,
|
|
29
23
|
|};
|
|
30
24
|
|
|
31
25
|
let BackHandler: TBackHandler = {
|
|
@@ -35,7 +29,6 @@ let BackHandler: TBackHandler = {
|
|
|
35
29
|
remove: emptyFunction,
|
|
36
30
|
};
|
|
37
31
|
},
|
|
38
|
-
removeEventListener(_eventName: BackPressEventName, _handler: Function) {},
|
|
39
32
|
};
|
|
40
33
|
|
|
41
34
|
module.exports = BackHandler;
|
|
@@ -59,10 +59,6 @@ type TBackHandler = {|
|
|
|
59
59
|
eventName: BackPressEventName,
|
|
60
60
|
handler: () => ?boolean,
|
|
61
61
|
) => {remove: () => void, ...},
|
|
62
|
-
+removeEventListener: (
|
|
63
|
-
eventName: BackPressEventName,
|
|
64
|
-
handler: () => ?boolean,
|
|
65
|
-
) => void,
|
|
66
62
|
|};
|
|
67
63
|
const BackHandler: TBackHandler = {
|
|
68
64
|
exitApp: function (): void {
|
|
@@ -86,22 +82,14 @@ const BackHandler: TBackHandler = {
|
|
|
86
82
|
_backPressSubscriptions.push(handler);
|
|
87
83
|
}
|
|
88
84
|
return {
|
|
89
|
-
remove: (): void =>
|
|
85
|
+
remove: (): void => {
|
|
86
|
+
const index = _backPressSubscriptions.indexOf(handler);
|
|
87
|
+
if (index !== -1) {
|
|
88
|
+
_backPressSubscriptions.splice(index, 1);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
90
91
|
};
|
|
91
92
|
},
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Removes the event handler.
|
|
95
|
-
*/
|
|
96
|
-
removeEventListener: function (
|
|
97
|
-
eventName: BackPressEventName,
|
|
98
|
-
handler: () => ?boolean,
|
|
99
|
-
): void {
|
|
100
|
-
const index = _backPressSubscriptions.indexOf(handler);
|
|
101
|
-
if (index !== -1) {
|
|
102
|
-
_backPressSubscriptions.splice(index, 1);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
93
|
};
|
|
106
94
|
|
|
107
95
|
module.exports = BackHandler;
|
|
@@ -18,7 +18,7 @@ class FocusManager {
|
|
|
18
18
|
// This function takes in a ref to a React Component and a bool value. If setWindowFocus = true, call aggressive focus.
|
|
19
19
|
// Else, call polite focus
|
|
20
20
|
|
|
21
|
-
static focus(ref: React.
|
|
21
|
+
static focus(ref: React.RefObject<any>, setWindowFocus: boolean) {
|
|
22
22
|
if (ref) {
|
|
23
23
|
if (setWindowFocus) {
|
|
24
24
|
UIManager.dispatchViewManagerCommand(
|
|
@@ -154,10 +154,9 @@ const HMRClient: HMRClientNativeInterface = {
|
|
|
154
154
|
data: [
|
|
155
155
|
'\n' +
|
|
156
156
|
'\u001B[7m' +
|
|
157
|
-
' \u001B[1m💡 JavaScript logs
|
|
158
|
-
'
|
|
159
|
-
'
|
|
160
|
-
'open (requires Google Chrome or Microsoft Edge).' +
|
|
157
|
+
' \u001B[1m💡 JavaScript logs have moved!\u001B[22m They can now be ' +
|
|
158
|
+
'viewed in React Native DevTools. Tip: Type \u001B[1mj\u001B[22m in ' +
|
|
159
|
+
'the terminal to open (requires Google Chrome or Microsoft Edge).' +
|
|
161
160
|
'\u001B[27m' +
|
|
162
161
|
'\n',
|
|
163
162
|
],
|
|
@@ -18,7 +18,7 @@ export type PlatformSelectSpec<T> = {
|
|
|
18
18
|
|
|
19
19
|
type IOSPlatform = {
|
|
20
20
|
__constants: null,
|
|
21
|
-
OS:
|
|
21
|
+
OS: 'ios',
|
|
22
22
|
// $FlowFixMe[unsafe-getters-setters]
|
|
23
23
|
get Version(): string,
|
|
24
24
|
// $FlowFixMe[unsafe-getters-setters]
|
|
@@ -54,7 +54,7 @@ type IOSPlatform = {
|
|
|
54
54
|
|
|
55
55
|
type AndroidPlatform = {
|
|
56
56
|
__constants: null,
|
|
57
|
-
OS:
|
|
57
|
+
OS: 'android',
|
|
58
58
|
// $FlowFixMe[unsafe-getters-setters]
|
|
59
59
|
get Version(): number,
|
|
60
60
|
// $FlowFixMe[unsafe-getters-setters]
|
|
@@ -19,7 +19,7 @@ export type PlatformSelectSpec<T> = {
|
|
|
19
19
|
|
|
20
20
|
type IOSPlatform = {
|
|
21
21
|
__constants: null,
|
|
22
|
-
OS:
|
|
22
|
+
OS: 'ios',
|
|
23
23
|
// $FlowFixMe[unsafe-getters-setters]
|
|
24
24
|
get Version(): number,
|
|
25
25
|
// $FlowFixMe[unsafe-getters-setters]
|
|
@@ -55,7 +55,7 @@ type IOSPlatform = {
|
|
|
55
55
|
|
|
56
56
|
type AndroidPlatform = {
|
|
57
57
|
__constants: null,
|
|
58
|
-
OS:
|
|
58
|
+
OS: 'android',
|
|
59
59
|
// $FlowFixMe[unsafe-getters-setters]
|
|
60
60
|
get Version(): number,
|
|
61
61
|
// $FlowFixMe[unsafe-getters-setters]
|
|
@@ -91,6 +91,7 @@ type AndroidPlatform = {
|
|
|
91
91
|
|
|
92
92
|
type Win32Platform = {
|
|
93
93
|
__constants: null,
|
|
94
|
+
// $FlowFixMe[cannot-resolve-name]
|
|
94
95
|
OS: $TEMPORARY$string<'win32'>,
|
|
95
96
|
// $FlowFixMe[unsafe-getters-setters]
|
|
96
97
|
get Version(): number,
|
|
@@ -20,17 +20,12 @@ const BackHandler = {
|
|
|
20
20
|
): {remove: () => void} {
|
|
21
21
|
_backPressSubscriptions.add(handler);
|
|
22
22
|
return {
|
|
23
|
-
remove: () =>
|
|
23
|
+
remove: () => {
|
|
24
|
+
_backPressSubscriptions.delete(handler);
|
|
25
|
+
},
|
|
24
26
|
};
|
|
25
27
|
},
|
|
26
28
|
|
|
27
|
-
removeEventListener: function (
|
|
28
|
-
eventName: BackPressEventName,
|
|
29
|
-
handler: () => ?boolean,
|
|
30
|
-
): void {
|
|
31
|
-
_backPressSubscriptions.delete(handler);
|
|
32
|
-
},
|
|
33
|
-
|
|
34
29
|
mockPressBack: function () {
|
|
35
30
|
let invokeDefault = true;
|
|
36
31
|
const subscriptions = [..._backPressSubscriptions].reverse();
|
|
@@ -31,7 +31,7 @@ export type NativeComponentType<T> = HostComponent<T>;
|
|
|
31
31
|
// `requireNativeComponent` is not available in Bridgeless mode.
|
|
32
32
|
// e.g. This function runs at runtime if `codegenNativeComponent` was not called
|
|
33
33
|
// from a file suffixed with NativeComponent.js.
|
|
34
|
-
function codegenNativeComponent<Props>(
|
|
34
|
+
function codegenNativeComponent<Props: {...}>(
|
|
35
35
|
componentName: string,
|
|
36
36
|
options?: Options,
|
|
37
37
|
): NativeComponentType<Props> {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import useRefEffect from './useRefEffect';
|
|
11
12
|
import * as React from 'react';
|
|
12
13
|
import {useCallback} from 'react';
|
|
13
14
|
|
|
@@ -22,19 +23,37 @@ import {useCallback} from 'react';
|
|
|
22
23
|
*/
|
|
23
24
|
export default function useMergeRefs<Instance>(
|
|
24
25
|
...refs: $ReadOnlyArray<?React.RefSetter<Instance>>
|
|
25
|
-
):
|
|
26
|
-
|
|
27
|
-
(current: Instance
|
|
28
|
-
|
|
29
|
-
if (ref
|
|
26
|
+
): React.RefSetter<Instance> {
|
|
27
|
+
const refEffect = useCallback(
|
|
28
|
+
(current: Instance) => {
|
|
29
|
+
const cleanups: $ReadOnlyArray<void | (() => void)> = refs.map(ref => {
|
|
30
|
+
if (ref == null) {
|
|
31
|
+
return undefined;
|
|
32
|
+
} else {
|
|
30
33
|
if (typeof ref === 'function') {
|
|
31
|
-
ref
|
|
34
|
+
// $FlowIssue[incompatible-type] - Flow does not understand ref cleanup.
|
|
35
|
+
const cleanup: void | (() => void) = ref(current);
|
|
36
|
+
return typeof cleanup === 'function'
|
|
37
|
+
? cleanup
|
|
38
|
+
: () => {
|
|
39
|
+
ref(null);
|
|
40
|
+
};
|
|
32
41
|
} else {
|
|
33
42
|
ref.current = current;
|
|
43
|
+
return () => {
|
|
44
|
+
ref.current = null;
|
|
45
|
+
};
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
|
-
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return () => {
|
|
51
|
+
for (const cleanup of cleanups) {
|
|
52
|
+
cleanup?.();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
37
55
|
},
|
|
38
56
|
[...refs], // eslint-disable-line react-hooks/exhaustive-deps
|
|
39
57
|
);
|
|
58
|
+
return useRefEffect(refEffect);
|
|
40
59
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @format
|
|
8
|
+
* @flow strict-local
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
'use strict';
|
|
@@ -18,7 +19,9 @@
|
|
|
18
19
|
* In case of "message", the `data` property contains the incoming data.
|
|
19
20
|
*/
|
|
20
21
|
class WebSocketEvent {
|
|
21
|
-
|
|
22
|
+
type: string;
|
|
23
|
+
|
|
24
|
+
constructor(type: string, eventInitDict: $FlowFixMe) {
|
|
22
25
|
this.type = type.toString();
|
|
23
26
|
Object.assign(this, eventInitDict);
|
|
24
27
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @format
|
|
8
|
+
* @flow strict-local
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
|
|
@@ -40,53 +41,53 @@ const WebSocketInterceptor = {
|
|
|
40
41
|
/**
|
|
41
42
|
* Invoked when RCTWebSocketModule.close(...) is called.
|
|
42
43
|
*/
|
|
43
|
-
setCloseCallback(callback) {
|
|
44
|
+
setCloseCallback(callback: $FlowFixMe) {
|
|
44
45
|
closeCallback = callback;
|
|
45
46
|
},
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* Invoked when RCTWebSocketModule.send(...) or sendBinary(...) is called.
|
|
49
50
|
*/
|
|
50
|
-
setSendCallback(callback) {
|
|
51
|
+
setSendCallback(callback: $FlowFixMe) {
|
|
51
52
|
sendCallback = callback;
|
|
52
53
|
},
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* Invoked when RCTWebSocketModule.connect(...) is called.
|
|
56
57
|
*/
|
|
57
|
-
setConnectCallback(callback) {
|
|
58
|
+
setConnectCallback(callback: $FlowFixMe) {
|
|
58
59
|
connectCallback = callback;
|
|
59
60
|
},
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
63
|
* Invoked when event "websocketOpen" happens.
|
|
63
64
|
*/
|
|
64
|
-
setOnOpenCallback(callback) {
|
|
65
|
+
setOnOpenCallback(callback: $FlowFixMe) {
|
|
65
66
|
onOpenCallback = callback;
|
|
66
67
|
},
|
|
67
68
|
|
|
68
69
|
/**
|
|
69
70
|
* Invoked when event "websocketMessage" happens.
|
|
70
71
|
*/
|
|
71
|
-
setOnMessageCallback(callback) {
|
|
72
|
+
setOnMessageCallback(callback: $FlowFixMe) {
|
|
72
73
|
onMessageCallback = callback;
|
|
73
74
|
},
|
|
74
75
|
|
|
75
76
|
/**
|
|
76
77
|
* Invoked when event "websocketFailed" happens.
|
|
77
78
|
*/
|
|
78
|
-
setOnErrorCallback(callback) {
|
|
79
|
+
setOnErrorCallback(callback: $FlowFixMe) {
|
|
79
80
|
onErrorCallback = callback;
|
|
80
81
|
},
|
|
81
82
|
|
|
82
83
|
/**
|
|
83
84
|
* Invoked when event "websocketClosed" happens.
|
|
84
85
|
*/
|
|
85
|
-
setOnCloseCallback(callback) {
|
|
86
|
+
setOnCloseCallback(callback: $FlowFixMe) {
|
|
86
87
|
onCloseCallback = callback;
|
|
87
88
|
},
|
|
88
89
|
|
|
89
|
-
isInterceptorEnabled() {
|
|
90
|
+
isInterceptorEnabled(): boolean {
|
|
90
91
|
return isInterceptorEnabled;
|
|
91
92
|
},
|
|
92
93
|
|
|
@@ -100,6 +101,7 @@ const WebSocketInterceptor = {
|
|
|
100
101
|
*/
|
|
101
102
|
_registerEvents() {
|
|
102
103
|
subscriptions = [
|
|
104
|
+
// $FlowFixMe[incompatible-type]
|
|
103
105
|
eventEmitter.addListener('websocketMessage', ev => {
|
|
104
106
|
if (onMessageCallback) {
|
|
105
107
|
onMessageCallback(
|
|
@@ -110,16 +112,19 @@ const WebSocketInterceptor = {
|
|
|
110
112
|
);
|
|
111
113
|
}
|
|
112
114
|
}),
|
|
115
|
+
// $FlowFixMe[incompatible-type]
|
|
113
116
|
eventEmitter.addListener('websocketOpen', ev => {
|
|
114
117
|
if (onOpenCallback) {
|
|
115
118
|
onOpenCallback(ev.id);
|
|
116
119
|
}
|
|
117
120
|
}),
|
|
121
|
+
// $FlowFixMe[incompatible-type]
|
|
118
122
|
eventEmitter.addListener('websocketClosed', ev => {
|
|
119
123
|
if (onCloseCallback) {
|
|
120
124
|
onCloseCallback(ev.id, {code: ev.code, reason: ev.reason});
|
|
121
125
|
}
|
|
122
126
|
}),
|
|
127
|
+
// $FlowFixMe[incompatible-type]
|
|
123
128
|
eventEmitter.addListener('websocketFailed', ev => {
|
|
124
129
|
if (onErrorCallback) {
|
|
125
130
|
onErrorCallback(ev.id, {message: ev.message});
|
|
@@ -132,6 +137,7 @@ const WebSocketInterceptor = {
|
|
|
132
137
|
if (isInterceptorEnabled) {
|
|
133
138
|
return;
|
|
134
139
|
}
|
|
140
|
+
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
135
141
|
eventEmitter = new NativeEventEmitter(
|
|
136
142
|
// T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior
|
|
137
143
|
// If you want to use the native module on other platforms, please remove this condition and test its behavior
|
|
@@ -142,11 +148,13 @@ const WebSocketInterceptor = {
|
|
|
142
148
|
// Override `connect` method for all RCTWebSocketModule requests
|
|
143
149
|
// to intercept the request url, protocols, options and socketId,
|
|
144
150
|
// then pass them through the `connectCallback`.
|
|
151
|
+
// $FlowFixMe[cannot-write]
|
|
152
|
+
// $FlowFixMe[missing-this-annot]
|
|
145
153
|
NativeWebSocketModule.connect = function (
|
|
146
|
-
url,
|
|
147
|
-
protocols,
|
|
148
|
-
options,
|
|
149
|
-
socketId,
|
|
154
|
+
url: string,
|
|
155
|
+
protocols: Array<string> | null,
|
|
156
|
+
options: $FlowFixMe,
|
|
157
|
+
socketId: number,
|
|
150
158
|
) {
|
|
151
159
|
if (connectCallback) {
|
|
152
160
|
connectCallback(url, protocols, options, socketId);
|
|
@@ -156,6 +164,8 @@ const WebSocketInterceptor = {
|
|
|
156
164
|
|
|
157
165
|
// Override `send` method for all RCTWebSocketModule requests to intercept
|
|
158
166
|
// the data sent, then pass them through the `sendCallback`.
|
|
167
|
+
// $FlowFixMe[cannot-write]
|
|
168
|
+
// $FlowFixMe[missing-this-annot]
|
|
159
169
|
NativeWebSocketModule.send = function (data, socketId) {
|
|
160
170
|
if (sendCallback) {
|
|
161
171
|
sendCallback(data, socketId);
|
|
@@ -165,6 +175,8 @@ const WebSocketInterceptor = {
|
|
|
165
175
|
|
|
166
176
|
// Override `sendBinary` method for all RCTWebSocketModule requests to
|
|
167
177
|
// intercept the data sent, then pass them through the `sendCallback`.
|
|
178
|
+
// $FlowFixMe[cannot-write]
|
|
179
|
+
// $FlowFixMe[missing-this-annot]
|
|
168
180
|
NativeWebSocketModule.sendBinary = function (data, socketId) {
|
|
169
181
|
if (sendCallback) {
|
|
170
182
|
sendCallback(WebSocketInterceptor._arrayBufferToString(data), socketId);
|
|
@@ -174,6 +186,8 @@ const WebSocketInterceptor = {
|
|
|
174
186
|
|
|
175
187
|
// Override `close` method for all RCTWebSocketModule requests to intercept
|
|
176
188
|
// the close information, then pass them through the `closeCallback`.
|
|
189
|
+
// $FlowFixMe[cannot-write]
|
|
190
|
+
// $FlowFixMe[missing-this-annot]
|
|
177
191
|
NativeWebSocketModule.close = function () {
|
|
178
192
|
if (closeCallback) {
|
|
179
193
|
if (arguments.length === 3) {
|
|
@@ -188,7 +202,7 @@ const WebSocketInterceptor = {
|
|
|
188
202
|
isInterceptorEnabled = true;
|
|
189
203
|
},
|
|
190
204
|
|
|
191
|
-
_arrayBufferToString(data) {
|
|
205
|
+
_arrayBufferToString(data: string): ArrayBuffer | string {
|
|
192
206
|
const value = base64.toByteArray(data).buffer;
|
|
193
207
|
if (value === undefined || value === null) {
|
|
194
208
|
return '(no value)';
|
|
@@ -209,9 +223,13 @@ const WebSocketInterceptor = {
|
|
|
209
223
|
return;
|
|
210
224
|
}
|
|
211
225
|
isInterceptorEnabled = false;
|
|
226
|
+
// $FlowFixMe[cannot-write]
|
|
212
227
|
NativeWebSocketModule.send = originalRCTWebSocketSend;
|
|
228
|
+
// $FlowFixMe[cannot-write]
|
|
213
229
|
NativeWebSocketModule.sendBinary = originalRCTWebSocketSendBinary;
|
|
230
|
+
// $FlowFixMe[cannot-write]
|
|
214
231
|
NativeWebSocketModule.close = originalRCTWebSocketClose;
|
|
232
|
+
// $FlowFixMe[cannot-write]
|
|
215
233
|
NativeWebSocketModule.connect = originalRCTWebSocketConnect;
|
|
216
234
|
|
|
217
235
|
connectCallback = null;
|
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
HostComponent,
|
|
13
|
+
HostInstance,
|
|
14
|
+
} from '../Renderer/shims/ReactNativeTypes';
|
|
12
15
|
|
|
13
16
|
import * as React from 'react';
|
|
14
17
|
|
|
15
|
-
function takesHostComponentInstance(
|
|
16
|
-
instance: React.ElementRef<HostComponent<mixed>> | null,
|
|
17
|
-
): void {}
|
|
18
|
+
function takesHostComponentInstance(instance: HostInstance | null): void {}
|
|
18
19
|
|
|
19
|
-
const MyHostComponent = (('Host': any): HostComponent<
|
|
20
|
+
const MyHostComponent = (('Host': any): HostComponent<{...}>);
|
|
20
21
|
|
|
21
22
|
<MyHostComponent
|
|
22
23
|
ref={hostComponentRef => {
|
|
@@ -36,7 +36,7 @@ let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
|
|
|
36
36
|
}
|
|
37
37
|
// It could although this object is not a standard error, it still has stack information to unwind
|
|
38
38
|
// $FlowFixMe ignore types just check if stack is there
|
|
39
|
-
if (rejection
|
|
39
|
+
if (rejection?.stack && typeof rejection.stack === 'string') {
|
|
40
40
|
stack = rejection.stack;
|
|
41
41
|
}
|
|
42
42
|
}
|