@office-iss/react-native-win32 0.0.0-canary.266 → 0.0.0-canary.268
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 +55 -1
- package/CHANGELOG.md +24 -4
- package/Libraries/Animated/animations/Animation.js +4 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +15 -15
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +17 -0
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +1 -0
- package/Libraries/Components/TextInput/TextInput.win32.js +17 -12
- 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 +6 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -1
- package/Libraries/Components/View/ViewWin32.js +3 -3
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpReactDevTools.js +33 -7
- package/Libraries/Inspector/NetworkOverlay.js +4 -0
- package/Libraries/Inspector/ReactDevToolsOverlay.js +8 -13
- package/Libraries/Interaction/TouchHistoryMath.js +22 -19
- package/Libraries/LogBox/Data/LogBoxData.js +2 -2
- package/Libraries/NativeComponent/BaseViewConfig.android.js +1 -1
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +1 -1
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +1 -1
- package/Libraries/Network/XHRInterceptor.js +63 -14
- package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +1 -1
- package/Libraries/Text/Text.win32.js +11 -7
- package/Libraries/Utilities/Platform.win32.js +4 -4
- package/Libraries/WebSocket/WebSocketEvent.js +4 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +31 -13
- package/index.js +4 -0
- package/index.win32.js +4 -0
- package/just-task.js +1 -1
- package/overrides.json +12 -12
- package/package.json +16 -16
- package/src/private/devmenu/DevMenu.d.ts +20 -0
- package/src/private/devmenu/DevMenu.js +31 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +22 -11
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -3
- package/src/private/reactdevtools/ReactDevToolsSettingsManager.android.js +20 -0
- package/src/private/reactdevtools/ReactDevToolsSettingsManager.ios.js +30 -0
- package/src/private/reactdevtools/ReactDevToolsSettingsManager.win32.js +20 -0
- package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -0
- package/src/private/specs/modules/{NativeDevToolsSettingsManager.js → NativeReactDevToolsSettingsManager.js} +3 -5
- package/src/private/webapis/performance/EventTiming.js +1 -1
- package/src/private/webapis/performance/Performance.js +3 -21
- package/src/private/webapis/performance/PerformanceObserver.js +68 -155
- package/src/private/webapis/performance/Utilities.js +25 -0
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +24 -16
- package/src/private/webapis/performance/specs/__mocks__/NativePerformance.js +11 -9
- package/src/private/webapis/performance/specs/__mocks__/NativePerformanceObserver.js +85 -58
- package/types/experimental.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/types/public/ReactNativeTypes.d.ts +0 -4
- 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
|
@@ -5,8 +5,11 @@
|
|
|
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
|
|
|
11
|
+
// $FlowFixMe[definition-cycle]
|
|
12
|
+
// $FlowFixMe[recursive-definition]
|
|
10
13
|
const TouchHistoryMath = {
|
|
11
14
|
/**
|
|
12
15
|
* This code is optimized and not intended to look beautiful. This allows
|
|
@@ -25,11 +28,11 @@ const TouchHistoryMath = {
|
|
|
25
28
|
* @return {number} value of centroid in specified dimension.
|
|
26
29
|
*/
|
|
27
30
|
centroidDimension: function (
|
|
28
|
-
touchHistory,
|
|
29
|
-
touchesChangedAfter,
|
|
30
|
-
isXAxis,
|
|
31
|
-
ofCurrent,
|
|
32
|
-
) {
|
|
31
|
+
touchHistory: TouchHistoryMath,
|
|
32
|
+
touchesChangedAfter: number,
|
|
33
|
+
isXAxis: boolean,
|
|
34
|
+
ofCurrent: boolean,
|
|
35
|
+
): number {
|
|
33
36
|
const touchBank = touchHistory.touchBank;
|
|
34
37
|
let total = 0;
|
|
35
38
|
let count = 0;
|
|
@@ -82,9 +85,9 @@ const TouchHistoryMath = {
|
|
|
82
85
|
},
|
|
83
86
|
|
|
84
87
|
currentCentroidXOfTouchesChangedAfter: function (
|
|
85
|
-
touchHistory,
|
|
86
|
-
touchesChangedAfter,
|
|
87
|
-
) {
|
|
88
|
+
touchHistory: TouchHistoryMath,
|
|
89
|
+
touchesChangedAfter: number,
|
|
90
|
+
): number {
|
|
88
91
|
return TouchHistoryMath.centroidDimension(
|
|
89
92
|
touchHistory,
|
|
90
93
|
touchesChangedAfter,
|
|
@@ -94,9 +97,9 @@ const TouchHistoryMath = {
|
|
|
94
97
|
},
|
|
95
98
|
|
|
96
99
|
currentCentroidYOfTouchesChangedAfter: function (
|
|
97
|
-
touchHistory,
|
|
98
|
-
touchesChangedAfter,
|
|
99
|
-
) {
|
|
100
|
+
touchHistory: TouchHistoryMath,
|
|
101
|
+
touchesChangedAfter: number,
|
|
102
|
+
): number {
|
|
100
103
|
return TouchHistoryMath.centroidDimension(
|
|
101
104
|
touchHistory,
|
|
102
105
|
touchesChangedAfter,
|
|
@@ -106,9 +109,9 @@ const TouchHistoryMath = {
|
|
|
106
109
|
},
|
|
107
110
|
|
|
108
111
|
previousCentroidXOfTouchesChangedAfter: function (
|
|
109
|
-
touchHistory,
|
|
110
|
-
touchesChangedAfter,
|
|
111
|
-
) {
|
|
112
|
+
touchHistory: TouchHistoryMath,
|
|
113
|
+
touchesChangedAfter: number,
|
|
114
|
+
): number {
|
|
112
115
|
return TouchHistoryMath.centroidDimension(
|
|
113
116
|
touchHistory,
|
|
114
117
|
touchesChangedAfter,
|
|
@@ -118,9 +121,9 @@ const TouchHistoryMath = {
|
|
|
118
121
|
},
|
|
119
122
|
|
|
120
123
|
previousCentroidYOfTouchesChangedAfter: function (
|
|
121
|
-
touchHistory,
|
|
122
|
-
touchesChangedAfter,
|
|
123
|
-
) {
|
|
124
|
+
touchHistory: TouchHistoryMath,
|
|
125
|
+
touchesChangedAfter: number,
|
|
126
|
+
): number {
|
|
124
127
|
return TouchHistoryMath.centroidDimension(
|
|
125
128
|
touchHistory,
|
|
126
129
|
touchesChangedAfter,
|
|
@@ -129,7 +132,7 @@ const TouchHistoryMath = {
|
|
|
129
132
|
);
|
|
130
133
|
},
|
|
131
134
|
|
|
132
|
-
currentCentroidX: function (touchHistory) {
|
|
135
|
+
currentCentroidX: function (touchHistory: TouchHistoryMath): number {
|
|
133
136
|
return TouchHistoryMath.centroidDimension(
|
|
134
137
|
touchHistory,
|
|
135
138
|
0, // touchesChangedAfter
|
|
@@ -138,7 +141,7 @@ const TouchHistoryMath = {
|
|
|
138
141
|
);
|
|
139
142
|
},
|
|
140
143
|
|
|
141
|
-
currentCentroidY: function (touchHistory) {
|
|
144
|
+
currentCentroidY: function (touchHistory: TouchHistoryMath): number {
|
|
142
145
|
return TouchHistoryMath.centroidDimension(
|
|
143
146
|
touchHistory,
|
|
144
147
|
0, // touchesChangedAfter
|
|
@@ -82,9 +82,9 @@ let warningFilter: WarningFilter = function (format) {
|
|
|
82
82
|
return {
|
|
83
83
|
finalFormat: format,
|
|
84
84
|
forceDialogImmediately: false,
|
|
85
|
-
suppressDialog_LEGACY:
|
|
85
|
+
suppressDialog_LEGACY: false,
|
|
86
86
|
suppressCompletely: false,
|
|
87
|
-
monitorEvent: '
|
|
87
|
+
monitorEvent: 'warning_unhandled',
|
|
88
88
|
monitorListVersion: 0,
|
|
89
89
|
monitorSampleRate: 1,
|
|
90
90
|
};
|
|
@@ -5,20 +5,57 @@
|
|
|
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';
|
|
11
12
|
|
|
12
13
|
const XMLHttpRequest = require('./XMLHttpRequest');
|
|
14
|
+
// $FlowFixMe[method-unbinding]
|
|
13
15
|
const originalXHROpen = XMLHttpRequest.prototype.open;
|
|
16
|
+
// $FlowFixMe[method-unbinding]
|
|
14
17
|
const originalXHRSend = XMLHttpRequest.prototype.send;
|
|
18
|
+
// $FlowFixMe[method-unbinding]
|
|
15
19
|
const originalXHRSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader;
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
type XHRInterceptorOpenCallback = (
|
|
22
|
+
method: string,
|
|
23
|
+
url: string,
|
|
24
|
+
request: XMLHttpRequest,
|
|
25
|
+
) => void;
|
|
26
|
+
|
|
27
|
+
type XHRInterceptorSendCallback = (
|
|
28
|
+
data: string,
|
|
29
|
+
request: XMLHttpRequest,
|
|
30
|
+
) => void;
|
|
31
|
+
|
|
32
|
+
type XHRInterceptorRequestHeaderCallback = (
|
|
33
|
+
header: string,
|
|
34
|
+
value: string,
|
|
35
|
+
request: XMLHttpRequest,
|
|
36
|
+
) => void;
|
|
37
|
+
|
|
38
|
+
type XHRInterceptorHeaderReceivedCallback = (
|
|
39
|
+
responseContentType: string | void,
|
|
40
|
+
responseSize: number | void,
|
|
41
|
+
allHeaders: string,
|
|
42
|
+
request: XMLHttpRequest,
|
|
43
|
+
) => void;
|
|
44
|
+
|
|
45
|
+
type XHRInterceptorResponseCallback = (
|
|
46
|
+
status: number,
|
|
47
|
+
timeout: number,
|
|
48
|
+
response: string,
|
|
49
|
+
responseURL: string,
|
|
50
|
+
responseType: string,
|
|
51
|
+
request: XMLHttpRequest,
|
|
52
|
+
) => void;
|
|
53
|
+
|
|
54
|
+
let openCallback: XHRInterceptorOpenCallback | null;
|
|
55
|
+
let sendCallback: XHRInterceptorSendCallback | null;
|
|
56
|
+
let requestHeaderCallback: XHRInterceptorRequestHeaderCallback | null;
|
|
57
|
+
let headerReceivedCallback: XHRInterceptorHeaderReceivedCallback | null;
|
|
58
|
+
let responseCallback: XHRInterceptorResponseCallback | null;
|
|
22
59
|
|
|
23
60
|
let isInterceptorEnabled = false;
|
|
24
61
|
|
|
@@ -33,39 +70,39 @@ const XHRInterceptor = {
|
|
|
33
70
|
/**
|
|
34
71
|
* Invoked before XMLHttpRequest.open(...) is called.
|
|
35
72
|
*/
|
|
36
|
-
setOpenCallback(callback) {
|
|
73
|
+
setOpenCallback(callback: XHRInterceptorOpenCallback) {
|
|
37
74
|
openCallback = callback;
|
|
38
75
|
},
|
|
39
76
|
|
|
40
77
|
/**
|
|
41
78
|
* Invoked before XMLHttpRequest.send(...) is called.
|
|
42
79
|
*/
|
|
43
|
-
setSendCallback(callback) {
|
|
80
|
+
setSendCallback(callback: XHRInterceptorSendCallback) {
|
|
44
81
|
sendCallback = callback;
|
|
45
82
|
},
|
|
46
83
|
|
|
47
84
|
/**
|
|
48
85
|
* Invoked after xhr's readyState becomes xhr.HEADERS_RECEIVED.
|
|
49
86
|
*/
|
|
50
|
-
setHeaderReceivedCallback(callback) {
|
|
87
|
+
setHeaderReceivedCallback(callback: XHRInterceptorHeaderReceivedCallback) {
|
|
51
88
|
headerReceivedCallback = callback;
|
|
52
89
|
},
|
|
53
90
|
|
|
54
91
|
/**
|
|
55
92
|
* Invoked after xhr's readyState becomes xhr.DONE.
|
|
56
93
|
*/
|
|
57
|
-
setResponseCallback(callback) {
|
|
94
|
+
setResponseCallback(callback: XHRInterceptorResponseCallback) {
|
|
58
95
|
responseCallback = callback;
|
|
59
96
|
},
|
|
60
97
|
|
|
61
98
|
/**
|
|
62
99
|
* Invoked before XMLHttpRequest.setRequestHeader(...) is called.
|
|
63
100
|
*/
|
|
64
|
-
setRequestHeaderCallback(callback) {
|
|
101
|
+
setRequestHeaderCallback(callback: XHRInterceptorRequestHeaderCallback) {
|
|
65
102
|
requestHeaderCallback = callback;
|
|
66
103
|
},
|
|
67
104
|
|
|
68
|
-
isInterceptorEnabled() {
|
|
105
|
+
isInterceptorEnabled(): boolean {
|
|
69
106
|
return isInterceptorEnabled;
|
|
70
107
|
},
|
|
71
108
|
|
|
@@ -75,7 +112,9 @@ const XHRInterceptor = {
|
|
|
75
112
|
}
|
|
76
113
|
// Override `open` method for all XHR requests to intercept the request
|
|
77
114
|
// method and url, then pass them through the `openCallback`.
|
|
78
|
-
|
|
115
|
+
// $FlowFixMe[cannot-write]
|
|
116
|
+
// $FlowFixMe[missing-this-annot]
|
|
117
|
+
XMLHttpRequest.prototype.open = function (method: string, url: string) {
|
|
79
118
|
if (openCallback) {
|
|
80
119
|
openCallback(method, url, this);
|
|
81
120
|
}
|
|
@@ -84,7 +123,12 @@ const XHRInterceptor = {
|
|
|
84
123
|
|
|
85
124
|
// Override `setRequestHeader` method for all XHR requests to intercept
|
|
86
125
|
// the request headers, then pass them through the `requestHeaderCallback`.
|
|
87
|
-
|
|
126
|
+
// $FlowFixMe[cannot-write]
|
|
127
|
+
// $FlowFixMe[missing-this-annot]
|
|
128
|
+
XMLHttpRequest.prototype.setRequestHeader = function (
|
|
129
|
+
header: string,
|
|
130
|
+
value: string,
|
|
131
|
+
) {
|
|
88
132
|
if (requestHeaderCallback) {
|
|
89
133
|
requestHeaderCallback(header, value, this);
|
|
90
134
|
}
|
|
@@ -93,7 +137,9 @@ const XHRInterceptor = {
|
|
|
93
137
|
|
|
94
138
|
// Override `send` method of all XHR requests to intercept the data sent,
|
|
95
139
|
// register listeners to intercept the response, and invoke the callbacks.
|
|
96
|
-
|
|
140
|
+
// $FlowFixMe[cannot-write]
|
|
141
|
+
// $FlowFixMe[missing-this-annot]
|
|
142
|
+
XMLHttpRequest.prototype.send = function (data: string) {
|
|
97
143
|
if (sendCallback) {
|
|
98
144
|
sendCallback(data, this);
|
|
99
145
|
}
|
|
@@ -151,8 +197,11 @@ const XHRInterceptor = {
|
|
|
151
197
|
return;
|
|
152
198
|
}
|
|
153
199
|
isInterceptorEnabled = false;
|
|
200
|
+
// $FlowFixMe[cannot-write]
|
|
154
201
|
XMLHttpRequest.prototype.send = originalXHRSend;
|
|
202
|
+
// $FlowFixMe[cannot-write]
|
|
155
203
|
XMLHttpRequest.prototype.open = originalXHROpen;
|
|
204
|
+
// $FlowFixMe[cannot-write]
|
|
156
205
|
XMLHttpRequest.prototype.setRequestHeader = originalXHRSetRequestHeader;
|
|
157
206
|
responseCallback = null;
|
|
158
207
|
openCallback = null;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @noformat
|
|
8
8
|
* @nolint
|
|
9
9
|
* @flow strict
|
|
10
|
-
* @generated SignedSource<<
|
|
10
|
+
* @generated SignedSource<<b803401b6dd721b9caffdac1f8b6fd1c>>
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import type {
|
|
@@ -180,6 +180,7 @@ export type TouchedViewDataAtPoint = $ReadOnly<{
|
|
|
180
180
|
width: number,
|
|
181
181
|
height: number,
|
|
182
182
|
}>,
|
|
183
|
+
closestPublicInstance?: PublicInstance,
|
|
183
184
|
...InspectorData,
|
|
184
185
|
}>;
|
|
185
186
|
|
|
@@ -794,7 +794,7 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
|
|
|
794
794
|
cursor?: CursorValue,
|
|
795
795
|
boxShadow?: $ReadOnlyArray<BoxShadowValue> | string,
|
|
796
796
|
filter?: $ReadOnlyArray<FilterFunction> | string,
|
|
797
|
-
|
|
797
|
+
mixBlendMode?: ____BlendMode_Internal,
|
|
798
798
|
experimental_backgroundImage?: $ReadOnlyArray<GradientValue> | string,
|
|
799
799
|
isolation?: 'auto' | 'isolate',
|
|
800
800
|
}>;
|
|
@@ -88,10 +88,13 @@ const Text: React.AbstractComponent<TextProps, TextForwardRef> =
|
|
|
88
88
|
) => {
|
|
89
89
|
const _accessibilityLabel = ariaLabel ?? accessibilityLabel;
|
|
90
90
|
const _accessibilityControls = ariaControls ?? accessibilityControls; // Win32
|
|
91
|
-
const _accessibilityDescribedBy =
|
|
92
|
-
|
|
91
|
+
const _accessibilityDescribedBy =
|
|
92
|
+
ariaDescribedBy ?? accessibilityDescribedBy; // Win32
|
|
93
|
+
const _accessibilityDescription =
|
|
94
|
+
ariaDescription ?? accessibilityDescription; // Win32
|
|
93
95
|
const _accessibilityLevel = ariaLevel ?? accessibilityLevel; // Win32
|
|
94
|
-
const _accessibilityPositionInSet =
|
|
96
|
+
const _accessibilityPositionInSet =
|
|
97
|
+
ariaPosinset ?? accessibilityPositionInSet; // Win32
|
|
95
98
|
const _accessibilitySetSize = ariaSetsize ?? accessibilitySetSize; // Win32
|
|
96
99
|
|
|
97
100
|
let _accessibilityState: ?TextProps['accessibilityState'] =
|
|
@@ -109,7 +112,8 @@ const Text: React.AbstractComponent<TextProps, TextForwardRef> =
|
|
|
109
112
|
checked: ariaChecked ?? _accessibilityState.checked,
|
|
110
113
|
disabled: ariaDisabled ?? _accessibilityState.disabled,
|
|
111
114
|
expanded: ariaExpanded ?? _accessibilityState.expanded,
|
|
112
|
-
multiselectable:
|
|
115
|
+
multiselectable:
|
|
116
|
+
ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
|
|
113
117
|
required: ariaRequired ?? accessibilityState?.required, // Win32
|
|
114
118
|
selected: ariaSelected ?? _accessibilityState.selected,
|
|
115
119
|
};
|
|
@@ -119,8 +123,8 @@ const Text: React.AbstractComponent<TextProps, TextForwardRef> =
|
|
|
119
123
|
checked: ariaChecked,
|
|
120
124
|
disabled: ariaDisabled,
|
|
121
125
|
expanded: ariaExpanded,
|
|
122
|
-
multiselectable: ariaMultiselectable,
|
|
123
|
-
required: ariaRequired,
|
|
126
|
+
multiselectable: ariaMultiselectable, // Win32,
|
|
127
|
+
required: ariaRequired, // Win32
|
|
124
128
|
selected: ariaSelected,
|
|
125
129
|
};
|
|
126
130
|
}
|
|
@@ -374,7 +378,7 @@ const Text: React.AbstractComponent<TextProps, TextForwardRef> =
|
|
|
374
378
|
return (
|
|
375
379
|
<TextAncestor.Provider value={true}>{nativeText}</TextAncestor.Provider>
|
|
376
380
|
);
|
|
377
|
-
}
|
|
381
|
+
},
|
|
378
382
|
);
|
|
379
383
|
|
|
380
384
|
Text.displayName = 'Text';
|
|
@@ -72,10 +72,10 @@ const Platform: PlatformType = {
|
|
|
72
72
|
? // $FlowFixMe[incompatible-return]
|
|
73
73
|
spec.win32
|
|
74
74
|
: 'native' in spec
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
? // $FlowFixMe[incompatible-return]
|
|
76
|
+
spec.native
|
|
77
|
+
: // $FlowFixMe[incompatible-return]
|
|
78
|
+
spec.default,
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
module.exports = Platform;
|
|
@@ -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;
|
package/index.js
CHANGED
|
@@ -85,6 +85,7 @@ import typeof UTFSequence from './Libraries/UTFSequence';
|
|
|
85
85
|
import typeof * as Appearance from './Libraries/Utilities/Appearance';
|
|
86
86
|
import typeof BackHandler from './Libraries/Utilities/BackHandler';
|
|
87
87
|
import typeof DeviceInfo from './Libraries/Utilities/DeviceInfo';
|
|
88
|
+
import typeof DevMenu from './src/private/devmenu/DevMenu';
|
|
88
89
|
import typeof DevSettings from './Libraries/Utilities/DevSettings';
|
|
89
90
|
import typeof Dimensions from './Libraries/Utilities/Dimensions';
|
|
90
91
|
import typeof PixelRatio from './Libraries/Utilities/PixelRatio';
|
|
@@ -238,6 +239,9 @@ module.exports = {
|
|
|
238
239
|
get DeviceInfo(): DeviceInfo {
|
|
239
240
|
return require('./Libraries/Utilities/DeviceInfo');
|
|
240
241
|
},
|
|
242
|
+
get DevMenu(): DevMenu {
|
|
243
|
+
return require('./src/private/devmenu/DevMenu');
|
|
244
|
+
},
|
|
241
245
|
get DevSettings(): DevSettings {
|
|
242
246
|
return require('./Libraries/Utilities/DevSettings');
|
|
243
247
|
},
|
package/index.win32.js
CHANGED
|
@@ -85,6 +85,7 @@ import typeof UTFSequence from './Libraries/UTFSequence';
|
|
|
85
85
|
import typeof * as Appearance from './Libraries/Utilities/Appearance';
|
|
86
86
|
import typeof BackHandler from './Libraries/Utilities/BackHandler';
|
|
87
87
|
import typeof DeviceInfo from './Libraries/Utilities/DeviceInfo';
|
|
88
|
+
import typeof DevMenu from './src/private/devmenu/DevMenu';
|
|
88
89
|
import typeof DevSettings from './Libraries/Utilities/DevSettings';
|
|
89
90
|
import typeof Dimensions from './Libraries/Utilities/Dimensions';
|
|
90
91
|
import typeof PixelRatio from './Libraries/Utilities/PixelRatio';
|
|
@@ -240,6 +241,9 @@ module.exports = {
|
|
|
240
241
|
get DeviceInfo(): DeviceInfo {
|
|
241
242
|
return require('./Libraries/Utilities/DeviceInfo');
|
|
242
243
|
},
|
|
244
|
+
get DevMenu(): DevMenu {
|
|
245
|
+
return require('./src/private/devmenu/DevMenu');
|
|
246
|
+
},
|
|
243
247
|
get DevSettings(): DevSettings {
|
|
244
248
|
return require('./Libraries/Utilities/DevSettings');
|
|
245
249
|
},
|
package/just-task.js
CHANGED