@office-iss/react-native-win32 0.0.0-canary.256 → 0.0.0-canary.258

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.
Files changed (64) hide show
  1. package/.flowconfig +4 -2
  2. package/CHANGELOG.json +79 -1
  3. package/CHANGELOG.md +32 -8
  4. package/Libraries/Components/ScrollView/ScrollView.js +124 -165
  5. package/Libraries/Core/InitializeCore.js +2 -0
  6. package/Libraries/Core/ReactNativeVersion.js +3 -3
  7. package/Libraries/Core/ReactNativeVersionCheck.win32.js +1 -1
  8. package/Libraries/Core/setUpGlobals.js +1 -0
  9. package/Libraries/Core/setUpTimers.js +19 -0
  10. package/Libraries/LogBox/Data/LogBoxData.js +39 -4
  11. package/Libraries/LogBox/Data/LogBoxLog.js +5 -2
  12. package/Libraries/LogBox/Data/parseLogBoxLog.js +22 -1
  13. package/Libraries/LogBox/LogBox.js +29 -12
  14. package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
  15. package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
  16. package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
  17. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
  18. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
  19. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +25 -74
  20. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +27 -80
  21. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
  22. package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
  23. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
  24. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
  25. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
  26. package/Libraries/ReactNative/AppContainer-dev.js +1 -5
  27. package/Libraries/ReactNative/AppContainer-prod.js +1 -5
  28. package/Libraries/ReactNative/AppContainer.js +0 -1
  29. package/Libraries/ReactNative/AppRegistry.js +0 -6
  30. package/Libraries/ReactNative/renderApplication.js +0 -2
  31. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15690 -26405
  32. package/Libraries/Renderer/implementations/ReactFabric-prod.js +2675 -1630
  33. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +2945 -1682
  34. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16141 -27018
  35. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +2723 -1666
  36. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +2984 -1737
  37. package/Libraries/Share/Share.d.ts +16 -10
  38. package/Libraries/Share/Share.js +14 -15
  39. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +19 -0
  40. package/Libraries/StyleSheet/StyleSheetTypes.js +19 -1
  41. package/Libraries/StyleSheet/processFilter.js +214 -39
  42. package/Libraries/Text/Text.js +42 -22
  43. package/Libraries/Text/Text.win32.js +42 -22
  44. package/Libraries/Text/TextNativeComponent.js +1 -1
  45. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  46. package/Libraries/Text/TextOptimized.js +538 -0
  47. package/Libraries/Utilities/ReactNativeTestTools.js +7 -24
  48. package/Libraries/__tests__/ButtonWin32-test.js +7 -6
  49. package/Libraries/promiseRejectionTrackingOptions.js +1 -0
  50. package/index.js +1 -0
  51. package/index.win32.js +1 -0
  52. package/jest/mockComponent.js +4 -1
  53. package/jest/renderer.js +25 -14
  54. package/jest/setup.js +5 -0
  55. package/overrides.json +6 -6
  56. package/package.json +26 -26
  57. package/src/private/core/components/HScrollViewNativeComponents.js +55 -0
  58. package/src/private/core/components/VScrollViewNativeComponents.js +47 -0
  59. package/src/private/core/components/useSyncOnScroll.js +48 -0
  60. package/src/private/featureflags/ReactNativeFeatureFlags.js +12 -1
  61. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
  62. package/src/private/specs/modules/NativeDevSettings.js +1 -0
  63. package/src/private/specs/modules/NativeSampleTurboModule.js +14 -1
  64. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
@@ -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';
@@ -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} = parseLogBoxLog(args);
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, otherwise pass through.
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.suppressDialog_LEGACY === true) {
199
- level = 'warn';
200
- } else if (filterResult.forceDialogImmediately === true) {
201
- level = 'fatal'; // Do not downgrade. These are real bugs with same severity as throws.
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} = parseLogBoxLog(args);
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.
@@ -9,40 +9,37 @@
9
9
  */
10
10
 
11
11
  import Keyboard from '../../Components/Keyboard/Keyboard';
12
- import ScrollView from '../../Components/ScrollView/ScrollView';
13
12
  import View from '../../Components/View/View';
14
13
  import StyleSheet from '../../StyleSheet/StyleSheet';
15
14
  import * as LogBoxData from '../Data/LogBoxData';
16
15
  import LogBoxLog, {type LogLevel} from '../Data/LogBoxLog';
17
- import LogBoxInspectorCodeFrame from './LogBoxInspectorCodeFrame';
16
+ import LogBoxInspectorBody from './LogBoxInspectorBody';
18
17
  import LogBoxInspectorFooter from './LogBoxInspectorFooter';
19
18
  import LogBoxInspectorHeader from './LogBoxInspectorHeader';
20
- import LogBoxInspectorMessageHeader from './LogBoxInspectorMessageHeader';
21
- import LogBoxInspectorReactFrames from './LogBoxInspectorReactFrames';
22
- import LogBoxInspectorStackFrames from './LogBoxInspectorStackFrames';
23
19
  import * as LogBoxStyle from './LogBoxStyle';
24
20
  import * as React from 'react';
21
+ import {useEffect} from 'react';
25
22
 
26
- type Props = $ReadOnly<{|
23
+ type Props = $ReadOnly<{
27
24
  onDismiss: () => void,
28
25
  onChangeSelectedIndex: (index: number) => void,
29
26
  onMinimize: () => void,
30
27
  logs: $ReadOnlyArray<LogBoxLog>,
31
28
  selectedIndex: number,
32
29
  fatalType?: ?LogLevel,
33
- |}>;
30
+ }>;
34
31
 
35
- function LogBoxInspector(props: Props): React.Node {
32
+ export default function LogBoxInspector(props: Props): React.Node {
36
33
  const {logs, selectedIndex} = props;
37
34
  let log = logs[selectedIndex];
38
35
 
39
- React.useEffect(() => {
36
+ useEffect(() => {
40
37
  if (log) {
41
38
  LogBoxData.symbolicateLogNow(log);
42
39
  }
43
40
  }, [log]);
44
41
 
45
- React.useEffect(() => {
42
+ useEffect(() => {
46
43
  // Optimistically symbolicate the last and next logs.
47
44
  if (logs.length > 1) {
48
45
  const selected = selectedIndex;
@@ -54,7 +51,7 @@ function LogBoxInspector(props: Props): React.Node {
54
51
  }
55
52
  }, [logs, selectedIndex]);
56
53
 
57
- React.useEffect(() => {
54
+ useEffect(() => {
58
55
  Keyboard.dismiss();
59
56
  }, []);
60
57
 
@@ -84,68 +81,9 @@ function LogBoxInspector(props: Props): React.Node {
84
81
  );
85
82
  }
86
83
 
87
- const headerTitleMap = {
88
- warn: 'Console Warning',
89
- error: 'Console Error',
90
- fatal: 'Uncaught Error',
91
- syntax: 'Syntax Error',
92
- component: 'Render Error',
93
- };
94
-
95
- function LogBoxInspectorBody(props: {log: LogBoxLog, onRetry: () => void}) {
96
- const [collapsed, setCollapsed] = React.useState(true);
97
-
98
- React.useEffect(() => {
99
- setCollapsed(true);
100
- }, [props.log]);
101
-
102
- const headerTitle =
103
- props.log.type ??
104
- headerTitleMap[props.log.isComponentError ? 'component' : props.log.level];
105
-
106
- if (collapsed) {
107
- return (
108
- <>
109
- <LogBoxInspectorMessageHeader
110
- collapsed={collapsed}
111
- onPress={() => setCollapsed(!collapsed)}
112
- message={props.log.message}
113
- level={props.log.level}
114
- title={headerTitle}
115
- />
116
- <ScrollView style={styles.scrollBody}>
117
- <LogBoxInspectorCodeFrame codeFrame={props.log.codeFrame} />
118
- <LogBoxInspectorReactFrames log={props.log} />
119
- <LogBoxInspectorStackFrames log={props.log} onRetry={props.onRetry} />
120
- </ScrollView>
121
- </>
122
- );
123
- }
124
- return (
125
- <ScrollView style={styles.scrollBody}>
126
- <LogBoxInspectorMessageHeader
127
- collapsed={collapsed}
128
- onPress={() => setCollapsed(!collapsed)}
129
- message={props.log.message}
130
- level={props.log.level}
131
- title={headerTitle}
132
- />
133
- <LogBoxInspectorCodeFrame codeFrame={props.log.codeFrame} />
134
- <LogBoxInspectorReactFrames log={props.log} />
135
- <LogBoxInspectorStackFrames log={props.log} onRetry={props.onRetry} />
136
- </ScrollView>
137
- );
138
- }
139
-
140
84
  const styles = StyleSheet.create({
141
85
  root: {
142
86
  flex: 1,
143
87
  backgroundColor: LogBoxStyle.getTextColor(),
144
88
  },
145
- scrollBody: {
146
- backgroundColor: LogBoxStyle.getBackgroundColor(0.9),
147
- flex: 1,
148
- },
149
89
  });
150
-
151
- export default LogBoxInspector;
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ import ScrollView from '../../Components/ScrollView/ScrollView';
12
+ import StyleSheet from '../../StyleSheet/StyleSheet';
13
+ import LogBoxLog from '../Data/LogBoxLog';
14
+ import LogBoxInspectorCodeFrame from './LogBoxInspectorCodeFrame';
15
+ import LogBoxInspectorMessageHeader from './LogBoxInspectorMessageHeader';
16
+ import LogBoxInspectorReactFrames from './LogBoxInspectorReactFrames';
17
+ import LogBoxInspectorStackFrames from './LogBoxInspectorStackFrames';
18
+ import * as LogBoxStyle from './LogBoxStyle';
19
+ import * as React from 'react';
20
+ import {useEffect, useState} from 'react';
21
+
22
+ const headerTitleMap = {
23
+ warn: 'Console Warning',
24
+ error: 'Console Error',
25
+ fatal: 'Uncaught Error',
26
+ syntax: 'Syntax Error',
27
+ component: 'Render Error',
28
+ };
29
+
30
+ export default function LogBoxInspectorBody(props: {
31
+ log: LogBoxLog,
32
+ onRetry: () => void,
33
+ }): React.Node {
34
+ const [collapsed, setCollapsed] = useState(true);
35
+
36
+ useEffect(() => {
37
+ setCollapsed(true);
38
+ }, [props.log]);
39
+
40
+ const headerTitle =
41
+ props.log.type ??
42
+ headerTitleMap[props.log.isComponentError ? 'component' : props.log.level];
43
+
44
+ if (collapsed) {
45
+ return (
46
+ <>
47
+ <LogBoxInspectorMessageHeader
48
+ collapsed={collapsed}
49
+ onPress={() => setCollapsed(!collapsed)}
50
+ message={props.log.message}
51
+ level={props.log.level}
52
+ title={headerTitle}
53
+ />
54
+ <ScrollView style={styles.scrollBody}>
55
+ <LogBoxInspectorCodeFrame codeFrame={props.log.codeFrame} />
56
+ <LogBoxInspectorReactFrames log={props.log} />
57
+ <LogBoxInspectorStackFrames log={props.log} onRetry={props.onRetry} />
58
+ </ScrollView>
59
+ </>
60
+ );
61
+ }
62
+ return (
63
+ <ScrollView style={styles.scrollBody}>
64
+ <LogBoxInspectorMessageHeader
65
+ collapsed={collapsed}
66
+ onPress={() => setCollapsed(!collapsed)}
67
+ message={props.log.message}
68
+ level={props.log.level}
69
+ title={headerTitle}
70
+ />
71
+ <LogBoxInspectorCodeFrame codeFrame={props.log.codeFrame} />
72
+ <LogBoxInspectorReactFrames log={props.log} />
73
+ <LogBoxInspectorStackFrames log={props.log} onRetry={props.onRetry} />
74
+ </ScrollView>
75
+ );
76
+ }
77
+
78
+ const styles = StyleSheet.create({
79
+ root: {
80
+ flex: 1,
81
+ backgroundColor: LogBoxStyle.getTextColor(),
82
+ },
83
+ scrollBody: {
84
+ backgroundColor: LogBoxStyle.getBackgroundColor(0.9),
85
+ flex: 1,
86
+ },
87
+ });
@@ -10,21 +10,20 @@
10
10
 
11
11
  import type {LogLevel} from '../Data/LogBoxLog';
12
12
 
13
- import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
14
13
  import View from '../../Components/View/View';
15
14
  import StyleSheet from '../../StyleSheet/StyleSheet';
16
15
  import Text from '../../Text/Text';
17
- import LogBoxButton from './LogBoxButton';
16
+ import LogBoxInspectorFooterButton from './LogBoxInspectorFooterButton';
18
17
  import * as LogBoxStyle from './LogBoxStyle';
19
18
  import * as React from 'react';
20
19
 
21
- type Props = $ReadOnly<{|
20
+ type Props = $ReadOnly<{
22
21
  onDismiss: () => void,
23
22
  onMinimize: () => void,
24
23
  level?: ?LogLevel,
25
- |}>;
24
+ }>;
26
25
 
27
- function LogBoxInspectorFooter(props: Props): React.Node {
26
+ export default function LogBoxInspectorFooter(props: Props): React.Node {
28
27
  if (props.level === 'syntax') {
29
28
  return (
30
29
  <View style={styles.root}>
@@ -39,34 +38,12 @@ function LogBoxInspectorFooter(props: Props): React.Node {
39
38
 
40
39
  return (
41
40
  <View style={styles.root}>
42
- <FooterButton text="Dismiss" onPress={props.onDismiss} />
43
- <FooterButton text="Minimize" onPress={props.onMinimize} />
41
+ <LogBoxInspectorFooterButton text="Dismiss" onPress={props.onDismiss} />
42
+ <LogBoxInspectorFooterButton text="Minimize" onPress={props.onMinimize} />
44
43
  </View>
45
44
  );
46
45
  }
47
46
 
48
- type ButtonProps = $ReadOnly<{|
49
- onPress: () => void,
50
- text: string,
51
- |}>;
52
-
53
- function FooterButton(props: ButtonProps): React.Node {
54
- return (
55
- <SafeAreaView style={styles.button}>
56
- <LogBoxButton
57
- backgroundColor={{
58
- default: 'transparent',
59
- pressed: LogBoxStyle.getBackgroundDarkColor(),
60
- }}
61
- onPress={props.onPress}>
62
- <View style={styles.buttonContent}>
63
- <Text style={styles.buttonLabel}>{props.text}</Text>
64
- </View>
65
- </LogBoxButton>
66
- </SafeAreaView>
67
- );
68
- }
69
-
70
47
  const styles = StyleSheet.create({
71
48
  root: {
72
49
  backgroundColor: LogBoxStyle.getBackgroundColor(1),
@@ -79,17 +56,6 @@ const styles = StyleSheet.create({
79
56
  button: {
80
57
  flex: 1,
81
58
  },
82
- buttonContent: {
83
- alignItems: 'center',
84
- height: 48,
85
- justifyContent: 'center',
86
- },
87
- buttonLabel: {
88
- color: LogBoxStyle.getTextColor(1),
89
- fontSize: 14,
90
- includeFontPadding: false,
91
- lineHeight: 20,
92
- },
93
59
  syntaxErrorText: {
94
60
  textAlign: 'center',
95
61
  width: '100%',
@@ -102,5 +68,3 @@ const styles = StyleSheet.create({
102
68
  color: LogBoxStyle.getTextColor(0.6),
103
69
  },
104
70
  });
105
-
106
- export default LogBoxInspectorFooter;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
12
+ import View from '../../Components/View/View';
13
+ import StyleSheet from '../../StyleSheet/StyleSheet';
14
+ import Text from '../../Text/Text';
15
+ import LogBoxButton from './LogBoxButton';
16
+ import * as LogBoxStyle from './LogBoxStyle';
17
+ import * as React from 'react';
18
+
19
+ type ButtonProps = $ReadOnly<{
20
+ onPress: () => void,
21
+ text: string,
22
+ }>;
23
+
24
+ export default function LogBoxInspectorFooterButton(
25
+ props: ButtonProps,
26
+ ): React.Node {
27
+ return (
28
+ <SafeAreaView style={styles.button}>
29
+ <LogBoxButton
30
+ backgroundColor={{
31
+ default: 'transparent',
32
+ pressed: LogBoxStyle.getBackgroundDarkColor(),
33
+ }}
34
+ onPress={props.onPress}>
35
+ <View style={styles.buttonContent}>
36
+ <Text style={styles.buttonLabel}>{props.text}</Text>
37
+ </View>
38
+ </LogBoxButton>
39
+ </SafeAreaView>
40
+ );
41
+ }
42
+
43
+ const styles = StyleSheet.create({
44
+ button: {
45
+ flex: 1,
46
+ },
47
+ buttonContent: {
48
+ alignItems: 'center',
49
+ height: 48,
50
+ justifyContent: 'center',
51
+ },
52
+ buttonLabel: {
53
+ color: LogBoxStyle.getTextColor(1),
54
+ fontSize: 14,
55
+ includeFontPadding: false,
56
+ lineHeight: 20,
57
+ },
58
+ });