@office-iss/react-native-win32 0.0.0-canary.255 → 0.0.0-canary.257
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 +79 -1
- package/CHANGELOG.md +28 -4
- package/Libraries/Components/TextInput/InputAccessoryView.js +10 -1
- package/Libraries/Components/View/ViewAccessibility.js +4 -4
- package/Libraries/Components/View/ViewAccessibility.win32.js +6 -6
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpTimers.js +19 -0
- package/Libraries/Image/ImageProps.js +16 -5
- package/Libraries/Image/ImageViewNativeComponent.js +2 -1
- package/Libraries/LogBox/Data/LogBoxData.js +39 -4
- package/Libraries/LogBox/Data/LogBoxLog.js +5 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +23 -2
- package/Libraries/LogBox/LogBox.js +29 -12
- package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
- package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
- package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
- package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +5 -66
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +7 -72
- package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
- package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
- package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
- package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
- package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +15690 -26405
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +2675 -1630
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +2945 -1682
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16141 -27018
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +2723 -1666
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +2984 -1737
- package/Libraries/Renderer/shims/ReactFabric.js +2 -2
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
- package/Libraries/Renderer/shims/ReactNative.js +2 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -2
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -2
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/Share/Share.d.ts +16 -10
- package/Libraries/Share/Share.js +14 -15
- package/Libraries/Text/Text.js +142 -121
- package/Libraries/Text/Text.win32.js +153 -130
- package/Libraries/Text/TextNativeComponent.js +6 -5
- package/Libraries/Text/TextNativeComponent.win32.js +6 -5
- package/Libraries/Text/TextOptimized.js +538 -0
- package/Libraries/Text/TextProps.js +6 -6
- package/Libraries/Text/TextProps.win32.js +6 -6
- package/Libraries/Types/CodegenTypes.js +3 -0
- package/Libraries/Utilities/ReactNativeTestTools.js +7 -24
- package/Libraries/__tests__/ButtonWin32-test.js +7 -6
- package/Libraries/promiseRejectionTrackingOptions.js +1 -0
- package/jest/renderer.js +25 -14
- package/jest/setup.js +5 -0
- package/overrides.json +7 -7
- package/package.json +19 -19
- package/src/private/specs/modules/NativeDevSettings.js +1 -0
- package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
package/.flowconfig
CHANGED
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,85 @@
|
|
|
2
2
|
"name": "@office-iss/react-native-win32",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 24 Jul 2024 05:20:13 GMT",
|
|
6
|
+
"version": "0.0.0-canary.257",
|
|
7
|
+
"tag": "@office-iss/react-native-win32_v0.0.0-canary.257",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "yajurgrover24@gmail.com",
|
|
12
|
+
"package": "@office-iss/react-native-win32",
|
|
13
|
+
"commit": "7b187af8b17b433ac02a8aff0051684924da4217",
|
|
14
|
+
"comment": "integrate 6/14"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@office-iss/react-native-win32",
|
|
19
|
+
"comment": "Bump @rnw-scripts/eslint-config to v1.2.25",
|
|
20
|
+
"commit": "not available"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@office-iss/react-native-win32",
|
|
25
|
+
"comment": "Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.29",
|
|
26
|
+
"commit": "not available"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@office-iss/react-native-win32",
|
|
31
|
+
"comment": "Bump @rnw-scripts/just-task to v2.3.42",
|
|
32
|
+
"commit": "not available"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@office-iss/react-native-win32",
|
|
37
|
+
"comment": "Bump react-native-platform-override to v1.9.44",
|
|
38
|
+
"commit": "not available"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"date": "Wed, 10 Jul 2024 05:15:28 GMT",
|
|
45
|
+
"version": "0.0.0-canary.256",
|
|
46
|
+
"tag": "@office-iss/react-native-win32_v0.0.0-canary.256",
|
|
47
|
+
"comments": {
|
|
48
|
+
"prerelease": [
|
|
49
|
+
{
|
|
50
|
+
"author": "yajurgrover24@gmail.com",
|
|
51
|
+
"package": "@office-iss/react-native-win32",
|
|
52
|
+
"commit": "8a91af57691e38ed9ee537ec5a7aaa74f8bae1eb",
|
|
53
|
+
"comment": "Integrate 6/13"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@office-iss/react-native-win32",
|
|
58
|
+
"comment": "Bump @rnw-scripts/eslint-config to v1.2.24",
|
|
59
|
+
"commit": "not available"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"author": "beachball",
|
|
63
|
+
"package": "@office-iss/react-native-win32",
|
|
64
|
+
"comment": "Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.28",
|
|
65
|
+
"commit": "not available"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"author": "beachball",
|
|
69
|
+
"package": "@office-iss/react-native-win32",
|
|
70
|
+
"comment": "Bump @rnw-scripts/just-task to v2.3.41",
|
|
71
|
+
"commit": "not available"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"author": "beachball",
|
|
75
|
+
"package": "@office-iss/react-native-win32",
|
|
76
|
+
"comment": "Bump react-native-platform-override to v1.9.43",
|
|
77
|
+
"commit": "not available"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"date": "Fri, 21 Jun 2024 05:17:50 GMT",
|
|
6
84
|
"version": "0.0.0-canary.255",
|
|
7
85
|
"tag": "@office-iss/react-native-win32_v0.0.0-canary.255",
|
|
8
86
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
# Change Log - @office-iss/react-native-win32
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 24 Jul 2024 05:20:13 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.0.0-canary.
|
|
7
|
+
## 0.0.0-canary.257
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Wed, 24 Jul 2024 05:20:13 GMT
|
|
10
10
|
|
|
11
11
|
### Changes
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- integrate 6/14 (yajurgrover24@gmail.com)
|
|
14
|
+
- Bump @rnw-scripts/eslint-config to v1.2.25
|
|
15
|
+
- Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.29
|
|
16
|
+
- Bump @rnw-scripts/just-task to v2.3.42
|
|
17
|
+
- Bump react-native-platform-override to v1.9.44
|
|
14
18
|
|
|
19
|
+
## 0.0.0-canary.256
|
|
20
|
+
|
|
21
|
+
Wed, 10 Jul 2024 05:15:28 GMT
|
|
22
|
+
|
|
23
|
+
### Changes
|
|
24
|
+
|
|
25
|
+
- Integrate 6/13 (yajurgrover24@gmail.com)
|
|
26
|
+
- Bump @rnw-scripts/eslint-config to v1.2.24
|
|
27
|
+
- Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.28
|
|
28
|
+
- Bump @rnw-scripts/just-task to v2.3.41
|
|
29
|
+
- Bump react-native-platform-override to v1.9.43
|
|
30
|
+
|
|
31
|
+
## 0.0.0-canary.255
|
|
32
|
+
|
|
33
|
+
Fri, 21 Jun 2024 05:17:50 GMT
|
|
34
|
+
|
|
35
|
+
### Changes
|
|
36
|
+
|
|
37
|
+
- Bump react-native-platform-override to v1.9.42
|
|
38
|
+
|
|
15
39
|
## 0.0.0-canary.254
|
|
16
40
|
|
|
17
41
|
Wed, 12 Jun 2024 05:16:24 GMT
|
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
|
|
11
12
|
import StyleSheet, {
|
|
12
13
|
type ColorValue,
|
|
13
14
|
type ViewStyleProp,
|
|
14
15
|
} from '../../StyleSheet/StyleSheet';
|
|
15
16
|
import Platform from '../../Utilities/Platform';
|
|
17
|
+
import useWindowDimensions from '../../Utilities/useWindowDimensions';
|
|
16
18
|
import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent';
|
|
17
19
|
import * as React from 'react';
|
|
18
20
|
|
|
@@ -86,6 +88,8 @@ type Props = $ReadOnly<{|
|
|
|
86
88
|
|}>;
|
|
87
89
|
|
|
88
90
|
const InputAccessoryView: React.AbstractComponent<Props> = (props: Props) => {
|
|
91
|
+
const {width} = useWindowDimensions();
|
|
92
|
+
|
|
89
93
|
if (Platform.OS === 'ios') {
|
|
90
94
|
if (React.Children.count(props.children) === 0) {
|
|
91
95
|
return null;
|
|
@@ -96,7 +100,9 @@ const InputAccessoryView: React.AbstractComponent<Props> = (props: Props) => {
|
|
|
96
100
|
style={[props.style, styles.container]}
|
|
97
101
|
nativeID={props.nativeID}
|
|
98
102
|
backgroundColor={props.backgroundColor}>
|
|
99
|
-
{
|
|
103
|
+
<SafeAreaView style={[styles.safeAreaView, {width}]}>
|
|
104
|
+
{props.children}
|
|
105
|
+
</SafeAreaView>
|
|
100
106
|
</RCTInputAccessoryViewNativeComponent>
|
|
101
107
|
);
|
|
102
108
|
} else {
|
|
@@ -109,6 +115,9 @@ const styles = StyleSheet.create({
|
|
|
109
115
|
container: {
|
|
110
116
|
position: 'absolute',
|
|
111
117
|
},
|
|
118
|
+
safeAreaView: {
|
|
119
|
+
flex: 1,
|
|
120
|
+
},
|
|
112
121
|
});
|
|
113
122
|
|
|
114
123
|
export default InputAccessoryView;
|
|
@@ -136,11 +136,11 @@ export type AccessibilityActionEvent = SyntheticEvent<
|
|
|
136
136
|
>;
|
|
137
137
|
|
|
138
138
|
export type AccessibilityState = {
|
|
139
|
-
disabled?: boolean,
|
|
140
|
-
selected?: boolean,
|
|
139
|
+
disabled?: ?boolean,
|
|
140
|
+
selected?: ?boolean,
|
|
141
141
|
checked?: ?boolean | 'mixed',
|
|
142
|
-
busy?: boolean,
|
|
143
|
-
expanded?: boolean,
|
|
142
|
+
busy?: ?boolean,
|
|
143
|
+
expanded?: ?boolean,
|
|
144
144
|
...
|
|
145
145
|
};
|
|
146
146
|
|
|
@@ -147,13 +147,13 @@ export type AccessibilityActionEvent = SyntheticEvent<
|
|
|
147
147
|
>;
|
|
148
148
|
|
|
149
149
|
export type AccessibilityState = {
|
|
150
|
-
disabled?: boolean,
|
|
151
|
-
selected?: boolean,
|
|
150
|
+
disabled?: ?boolean,
|
|
151
|
+
selected?: ?boolean,
|
|
152
152
|
checked?: ?boolean | 'mixed',
|
|
153
|
-
busy?: boolean,
|
|
154
|
-
expanded?: boolean,
|
|
155
|
-
multiselectable?: boolean, // Win32
|
|
156
|
-
required?: boolean, // Win32
|
|
153
|
+
busy?: ?boolean,
|
|
154
|
+
expanded?: ?boolean,
|
|
155
|
+
multiselectable?: ?boolean, // Win32
|
|
156
|
+
required?: ?boolean, // Win32
|
|
157
157
|
...
|
|
158
158
|
};
|
|
159
159
|
|
|
@@ -48,6 +48,25 @@ if (global.RN$Bridgeless !== true) {
|
|
|
48
48
|
defineLazyTimer('cancelAnimationFrame');
|
|
49
49
|
defineLazyTimer('requestIdleCallback');
|
|
50
50
|
defineLazyTimer('cancelIdleCallback');
|
|
51
|
+
} else if (
|
|
52
|
+
// TODO remove this condition when bridgeless == modern scheduler everywhere.
|
|
53
|
+
NativeReactNativeFeatureFlags != null &&
|
|
54
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- false positive due to `use` prefix
|
|
55
|
+
ReactNativeFeatureFlags.useModernRuntimeScheduler()
|
|
56
|
+
) {
|
|
57
|
+
polyfillGlobal(
|
|
58
|
+
'requestIdleCallback',
|
|
59
|
+
() =>
|
|
60
|
+
require('../../src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks')
|
|
61
|
+
.default.requestIdleCallback,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
polyfillGlobal(
|
|
65
|
+
'cancelIdleCallback',
|
|
66
|
+
() =>
|
|
67
|
+
require('../../src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks')
|
|
68
|
+
.default.cancelIdleCallback,
|
|
69
|
+
);
|
|
51
70
|
}
|
|
52
71
|
|
|
53
72
|
// We need to check if the native module is available before accessing the
|
|
@@ -59,6 +59,22 @@ type AndroidImageProps = $ReadOnly<{|
|
|
|
59
59
|
loadingIndicatorSource?: ?(number | $ReadOnly<{|uri: string|}>),
|
|
60
60
|
progressiveRenderingEnabled?: ?boolean,
|
|
61
61
|
fadeDuration?: ?number,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The mechanism that should be used to resize the image when the image's
|
|
65
|
+
* dimensions differ from the image view's dimensions. Defaults to `'auto'`.
|
|
66
|
+
* See https://reactnative.dev/docs/image#resizemethod-android
|
|
67
|
+
*/
|
|
68
|
+
resizeMethod?: ?('auto' | 'resize' | 'scale'),
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* When the `resizeMethod` is set to `resize`, the destination dimensions are
|
|
72
|
+
* multiplied by this value. The `scale` method is used to perform the
|
|
73
|
+
* remainder of the resize.
|
|
74
|
+
* This is used to produce higher quality images when resizing to small dimensions.
|
|
75
|
+
* Defaults to 1.0.
|
|
76
|
+
*/
|
|
77
|
+
resizeMultiplier?: ?number,
|
|
62
78
|
|}>;
|
|
63
79
|
|
|
64
80
|
export type ImageProps = {|
|
|
@@ -183,11 +199,6 @@ export type ImageProps = {|
|
|
|
183
199
|
*/
|
|
184
200
|
onLoadStart?: ?() => void,
|
|
185
201
|
|
|
186
|
-
/**
|
|
187
|
-
* See https://reactnative.dev/docs/image#resizemethod
|
|
188
|
-
*/
|
|
189
|
-
resizeMethod?: ?('auto' | 'resize' | 'scale'),
|
|
190
|
-
|
|
191
202
|
/**
|
|
192
203
|
* The image source (either a remote URL or a local file resource).
|
|
193
204
|
*
|
|
@@ -82,13 +82,14 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
|
|
|
82
82
|
validAttributes: {
|
|
83
83
|
blurRadius: true,
|
|
84
84
|
internal_analyticTag: true,
|
|
85
|
+
resizeMethod: true,
|
|
85
86
|
resizeMode: true,
|
|
87
|
+
resizeMultiplier: true,
|
|
86
88
|
tintColor: {
|
|
87
89
|
process: require('../StyleSheet/processColor').default,
|
|
88
90
|
},
|
|
89
91
|
borderBottomLeftRadius: true,
|
|
90
92
|
borderTopLeftRadius: true,
|
|
91
|
-
resizeMethod: true,
|
|
92
93
|
src: true,
|
|
93
94
|
// NOTE: New Architecture expects this to be called `source`,
|
|
94
95
|
// regardless of the platform, therefore propagate it as well.
|
|
@@ -8,30 +8,32 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
('use strict');
|
|
12
|
-
|
|
13
11
|
import type {ExtendedError} from '../../Core/ExtendedError';
|
|
14
12
|
import type {LogLevel} from './LogBoxLog';
|
|
15
13
|
import type {
|
|
16
14
|
Category,
|
|
17
15
|
ComponentStack,
|
|
16
|
+
ComponentStackType,
|
|
18
17
|
ExtendedExceptionData,
|
|
19
18
|
Message,
|
|
20
19
|
} from './parseLogBoxLog';
|
|
21
20
|
|
|
22
21
|
import parseErrorStack from '../../Core/Devtools/parseErrorStack';
|
|
22
|
+
import NativeDevSettings from '../../NativeModules/specs/NativeDevSettings';
|
|
23
23
|
import NativeLogBox from '../../NativeModules/specs/NativeLogBox';
|
|
24
24
|
import LogBoxLog from './LogBoxLog';
|
|
25
25
|
import {parseLogBoxException} from './parseLogBoxLog';
|
|
26
26
|
import * as React from 'react';
|
|
27
|
+
|
|
27
28
|
export type LogBoxLogs = Set<LogBoxLog>;
|
|
28
|
-
export type LogData = $ReadOnly<{
|
|
29
|
+
export type LogData = $ReadOnly<{
|
|
29
30
|
level: LogLevel,
|
|
30
31
|
message: Message,
|
|
31
32
|
category: Category,
|
|
32
33
|
componentStack: ComponentStack,
|
|
34
|
+
componentStackType: ComponentStackType | null,
|
|
33
35
|
stack?: string,
|
|
34
|
-
|
|
36
|
+
}>;
|
|
35
37
|
|
|
36
38
|
export type Observer = (
|
|
37
39
|
$ReadOnly<{|
|
|
@@ -72,6 +74,7 @@ let logs: LogBoxLogs = new Set();
|
|
|
72
74
|
let updateTimeout: $FlowFixMe | null = null;
|
|
73
75
|
let _isDisabled = false;
|
|
74
76
|
let _selectedIndex = -1;
|
|
77
|
+
let hasShownFuseboxWarningsMigrationMessage = false;
|
|
75
78
|
|
|
76
79
|
let warningFilter: WarningFilter = function (format) {
|
|
77
80
|
return {
|
|
@@ -193,6 +196,11 @@ function appendNewLog(newLog: LogBoxLog) {
|
|
|
193
196
|
}
|
|
194
197
|
|
|
195
198
|
export function addLog(log: LogData): void {
|
|
199
|
+
if (log.level === 'warn' && global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) {
|
|
200
|
+
// Under Fusebox, don't report warnings to LogBox.
|
|
201
|
+
showFuseboxWarningsMigrationMessageOnce();
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
196
204
|
const errorForStackTrace = new Error();
|
|
197
205
|
|
|
198
206
|
// Parsing logs are expensive so we schedule this
|
|
@@ -209,6 +217,7 @@ export function addLog(log: LogData): void {
|
|
|
209
217
|
stack,
|
|
210
218
|
category: log.category,
|
|
211
219
|
componentStack: log.componentStack,
|
|
220
|
+
componentStackType: log.componentStackType || 'legacy',
|
|
212
221
|
}),
|
|
213
222
|
);
|
|
214
223
|
} catch (error) {
|
|
@@ -453,3 +462,29 @@ export function withSubscription(
|
|
|
453
462
|
|
|
454
463
|
return LogBoxStateSubscription;
|
|
455
464
|
}
|
|
465
|
+
|
|
466
|
+
function showFuseboxWarningsMigrationMessageOnce() {
|
|
467
|
+
if (hasShownFuseboxWarningsMigrationMessage) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
hasShownFuseboxWarningsMigrationMessage = true;
|
|
471
|
+
appendNewLog(
|
|
472
|
+
new LogBoxLog({
|
|
473
|
+
level: 'warn',
|
|
474
|
+
message: {
|
|
475
|
+
content: 'Open debugger to view warnings.',
|
|
476
|
+
substitutions: [],
|
|
477
|
+
},
|
|
478
|
+
isComponentError: false,
|
|
479
|
+
stack: [],
|
|
480
|
+
category: 'fusebox-warnings-migration',
|
|
481
|
+
componentStack: [],
|
|
482
|
+
onNotificationPress: () => {
|
|
483
|
+
if (NativeDevSettings.openDebugger) {
|
|
484
|
+
NativeDevSettings.openDebugger();
|
|
485
|
+
}
|
|
486
|
+
clearWarnings();
|
|
487
|
+
},
|
|
488
|
+
}),
|
|
489
|
+
);
|
|
490
|
+
}
|
|
@@ -55,7 +55,7 @@ function convertStackToComponentStack(stack: Stack): ComponentStack {
|
|
|
55
55
|
return componentStack;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export type LogBoxLogData = $ReadOnly<{
|
|
58
|
+
export type LogBoxLogData = $ReadOnly<{
|
|
59
59
|
level: LogLevel,
|
|
60
60
|
type?: ?string,
|
|
61
61
|
message: Message,
|
|
@@ -66,7 +66,8 @@ export type LogBoxLogData = $ReadOnly<{|
|
|
|
66
66
|
codeFrame?: ?CodeFrame,
|
|
67
67
|
isComponentError: boolean,
|
|
68
68
|
extraData?: mixed,
|
|
69
|
-
|
|
69
|
+
onNotificationPress?: ?() => void,
|
|
70
|
+
}>;
|
|
70
71
|
|
|
71
72
|
class LogBoxLog {
|
|
72
73
|
message: Message;
|
|
@@ -102,6 +103,7 @@ class LogBoxLog {
|
|
|
102
103
|
componentStack: null,
|
|
103
104
|
status: 'NONE',
|
|
104
105
|
};
|
|
106
|
+
onNotificationPress: ?() => void;
|
|
105
107
|
|
|
106
108
|
constructor(data: LogBoxLogData) {
|
|
107
109
|
this.level = data.level;
|
|
@@ -115,6 +117,7 @@ class LogBoxLog {
|
|
|
115
117
|
this.isComponentError = data.isComponentError;
|
|
116
118
|
this.extraData = data.extraData;
|
|
117
119
|
this.count = 1;
|
|
120
|
+
this.onNotificationPress = data.onNotificationPress;
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
incrementCount(): void {
|
|
@@ -93,6 +93,15 @@ const RE_BABEL_CODE_FRAME_MARKER_PATTERN = new RegExp(
|
|
|
93
93
|
'm',
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
+
export function hasComponentStack(args: $ReadOnlyArray<mixed>): boolean {
|
|
97
|
+
for (const arg of args) {
|
|
98
|
+
if (typeof arg === 'string' && isComponentStack(arg)) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
|
|
96
105
|
export type ExtendedExceptionData = ExceptionData & {
|
|
97
106
|
isComponentError: boolean,
|
|
98
107
|
...
|
|
@@ -435,13 +444,25 @@ export function parseLogBoxException(
|
|
|
435
444
|
};
|
|
436
445
|
}
|
|
437
446
|
|
|
447
|
+
export function withoutANSIColorStyles(message: mixed): mixed {
|
|
448
|
+
if (typeof message !== 'string') {
|
|
449
|
+
return message;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return message.replace(
|
|
453
|
+
// eslint-disable-next-line no-control-regex
|
|
454
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
|
|
455
|
+
'',
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
|
|
438
459
|
export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {|
|
|
439
460
|
componentStack: ComponentStack,
|
|
440
461
|
componentStackType: ComponentStackType,
|
|
441
462
|
category: Category,
|
|
442
463
|
message: Message,
|
|
443
464
|
|} {
|
|
444
|
-
const message = args[0];
|
|
465
|
+
const message = withoutANSIColorStyles(args[0]);
|
|
445
466
|
let argsWithoutComponentStack: Array<mixed> = [];
|
|
446
467
|
let componentStack: ComponentStack = [];
|
|
447
468
|
let componentStackType = 'legacy';
|
|
@@ -462,7 +483,7 @@ export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {|
|
|
|
462
483
|
}
|
|
463
484
|
}
|
|
464
485
|
|
|
465
|
-
if (componentStack.length === 0) {
|
|
486
|
+
if (componentStack.length === 0 && argsWithoutComponentStack.length === 0) {
|
|
466
487
|
// Try finding the component stack elsewhere.
|
|
467
488
|
for (const arg of args) {
|
|
468
489
|
if (typeof arg === 'string' && isComponentStack(arg)) {
|
|
@@ -13,6 +13,7 @@ import type {ExtendedExceptionData} from './Data/parseLogBoxLog';
|
|
|
13
13
|
|
|
14
14
|
import Platform from '../Utilities/Platform';
|
|
15
15
|
import RCTLog from '../Utilities/RCTLog';
|
|
16
|
+
import {hasComponentStack} from './Data/parseLogBoxLog';
|
|
16
17
|
|
|
17
18
|
export type {LogData, ExtendedExceptionData, IgnorePattern};
|
|
18
19
|
|
|
@@ -150,7 +151,8 @@ if (__DEV__) {
|
|
|
150
151
|
|
|
151
152
|
try {
|
|
152
153
|
if (!isRCTLogAdviceWarning(...args)) {
|
|
153
|
-
const {category, message, componentStack} =
|
|
154
|
+
const {category, message, componentStack, componentStackType} =
|
|
155
|
+
parseLogBoxLog(args);
|
|
154
156
|
|
|
155
157
|
if (!LogBoxData.isMessageIgnored(message.content)) {
|
|
156
158
|
LogBoxData.addLog({
|
|
@@ -158,6 +160,7 @@ if (__DEV__) {
|
|
|
158
160
|
category,
|
|
159
161
|
message,
|
|
160
162
|
componentStack,
|
|
163
|
+
componentStackType,
|
|
161
164
|
});
|
|
162
165
|
}
|
|
163
166
|
}
|
|
@@ -176,12 +179,20 @@ if (__DEV__) {
|
|
|
176
179
|
}
|
|
177
180
|
|
|
178
181
|
try {
|
|
179
|
-
if (!isWarningModuleWarning(...args)) {
|
|
180
|
-
// Only show LogBox for the 'warning' module,
|
|
182
|
+
if (!isWarningModuleWarning(...args) && !hasComponentStack(args)) {
|
|
183
|
+
// Only show LogBox for the 'warning' module, or React errors with
|
|
184
|
+
// component stacks, otherwise pass the error through.u
|
|
185
|
+
//
|
|
181
186
|
// By passing through, this will get picked up by the React console override,
|
|
182
187
|
// potentially adding the component stack. React then passes it back to the
|
|
183
188
|
// React Native ExceptionsManager, which reports it to LogBox as an error.
|
|
184
189
|
//
|
|
190
|
+
// Ideally, we refactor all RN error handling so that LogBox patching
|
|
191
|
+
// errors is not necessary, and they are reported the same as a framework.
|
|
192
|
+
// The blocker to this is that the ExceptionManager console.error override
|
|
193
|
+
// strigifys all of the args before passing it through to LogBox, which
|
|
194
|
+
// would lose all of the interpolation information.
|
|
195
|
+
//
|
|
185
196
|
// The 'warning' module needs to be handled here because React internally calls
|
|
186
197
|
// `console.error('Warning: ')` with the component stack already included.
|
|
187
198
|
originalConsoleError(...args);
|
|
@@ -190,20 +201,25 @@ if (__DEV__) {
|
|
|
190
201
|
|
|
191
202
|
const format = args[0].replace('Warning: ', '');
|
|
192
203
|
const filterResult = LogBoxData.checkWarningFilter(format);
|
|
193
|
-
if (filterResult.suppressCompletely) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
204
|
let level = 'error';
|
|
198
|
-
if (filterResult.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
205
|
+
if (filterResult.monitorEvent !== 'warning_unhandled') {
|
|
206
|
+
if (filterResult.suppressCompletely) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (filterResult.suppressDialog_LEGACY === true) {
|
|
211
|
+
level = 'warn';
|
|
212
|
+
} else if (filterResult.forceDialogImmediately === true) {
|
|
213
|
+
level = 'fatal'; // Do not downgrade. These are real bugs with same severity as throws.
|
|
214
|
+
}
|
|
202
215
|
}
|
|
203
216
|
|
|
204
217
|
// Unfortunately, we need to add the Warning: prefix back for downstream dependencies.
|
|
218
|
+
// Downstream, we check for this prefix to know that LogBox already handled it, so
|
|
219
|
+
// it doesn't get reported back to LogBox. It's an absolute mess.
|
|
205
220
|
args[0] = `Warning: ${filterResult.finalFormat}`;
|
|
206
|
-
const {category, message, componentStack} =
|
|
221
|
+
const {category, message, componentStack, componentStackType} =
|
|
222
|
+
parseLogBoxLog(args);
|
|
207
223
|
|
|
208
224
|
// Interpolate the message so they are formatted for adb and other CLIs.
|
|
209
225
|
// This is different than the message.content above because it includes component stacks.
|
|
@@ -216,6 +232,7 @@ if (__DEV__) {
|
|
|
216
232
|
category,
|
|
217
233
|
message,
|
|
218
234
|
componentStack,
|
|
235
|
+
componentStackType,
|
|
219
236
|
});
|
|
220
237
|
}
|
|
221
238
|
} catch (err) {
|
|
@@ -36,6 +36,10 @@ export function _LogBoxNotificationContainer(props: Props): React.Node {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
function openLog(log: LogBoxLog) {
|
|
39
|
+
if (log.onNotificationPress) {
|
|
40
|
+
log.onNotificationPress();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
39
43
|
let index = logs.length - 1;
|
|
40
44
|
|
|
41
45
|
// Stop at zero because if we don't find any log, we'll open the first log.
|