react-native-windows 0.71.21 → 0.71.23

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.
@@ -240,36 +240,6 @@ export type enterKeyHintType =
240
240
  type PasswordRules = string;
241
241
 
242
242
  type IOSProps = $ReadOnly<{|
243
- /**
244
- * Give the keyboard and the system information about the
245
- * expected semantic meaning for the content that users enter.
246
- * @platform ios
247
- */
248
- autoComplete?: ?(
249
- | 'address-line1'
250
- | 'address-line2'
251
- | 'cc-number'
252
- | 'current-password'
253
- | 'country'
254
- | 'email'
255
- | 'name'
256
- | 'additional-name'
257
- | 'family-name'
258
- | 'given-name'
259
- | 'nickname'
260
- | 'honorific-prefix'
261
- | 'honorific-suffix'
262
- | 'new-password'
263
- | 'off'
264
- | 'one-time-code'
265
- | 'organization'
266
- | 'organization-title'
267
- | 'postal-code'
268
- | 'street-address'
269
- | 'tel'
270
- | 'url'
271
- | 'username'
272
- ),
273
243
  /**
274
244
  * When the clear button should appear on the right side of the text view.
275
245
  * This property is supported only for single-line TextInput component.
@@ -375,111 +345,6 @@ type IOSProps = $ReadOnly<{|
375
345
  |}>;
376
346
 
377
347
  type AndroidProps = $ReadOnly<{|
378
- /**
379
- * Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
380
- * To disable autocomplete, set `autoComplete` to `off`.
381
- *
382
- * *Android Only*
383
- *
384
- * Possible values for `autoComplete` are:
385
- *
386
- * - `birthdate-day`
387
- * - `birthdate-full`
388
- * - `birthdate-month`
389
- * - `birthdate-year`
390
- * - `cc-csc`
391
- * - `cc-exp`
392
- * - `cc-exp-day`
393
- * - `cc-exp-month`
394
- * - `cc-exp-year`
395
- * - `cc-number`
396
- * - `email`
397
- * - `gender`
398
- * - `name`
399
- * - `name-family`
400
- * - `name-given`
401
- * - `name-middle`
402
- * - `name-middle-initial`
403
- * - `name-prefix`
404
- * - `name-suffix`
405
- * - `password`
406
- * - `password-new`
407
- * - `postal-address`
408
- * - `postal-address-country`
409
- * - `postal-address-extended`
410
- * - `postal-address-extended-postal-code`
411
- * - `postal-address-locality`
412
- * - `postal-address-region`
413
- * - `postal-code`
414
- * - `street-address`
415
- * - `sms-otp`
416
- * - `tel`
417
- * - `tel-country-code`
418
- * - `tel-national`
419
- * - `tel-device`
420
- * - `username`
421
- * - `username-new`
422
- * - `off`
423
- *
424
- * @platform android
425
- */
426
- autoComplete?: ?(
427
- | 'birthdate-day'
428
- | 'birthdate-full'
429
- | 'birthdate-month'
430
- | 'birthdate-year'
431
- | 'cc-csc'
432
- | 'cc-exp'
433
- | 'cc-exp-day'
434
- | 'cc-exp-month'
435
- | 'cc-exp-year'
436
- | 'cc-number'
437
- | 'email'
438
- | 'gender'
439
- | 'name'
440
- | 'name-family'
441
- | 'name-given'
442
- | 'name-middle'
443
- | 'name-middle-initial'
444
- | 'name-prefix'
445
- | 'name-suffix'
446
- | 'password'
447
- | 'password-new'
448
- | 'postal-address'
449
- | 'postal-address-country'
450
- | 'postal-address-extended'
451
- | 'postal-address-extended-postal-code'
452
- | 'postal-address-locality'
453
- | 'postal-address-region'
454
- | 'postal-code'
455
- | 'street-address'
456
- | 'sms-otp'
457
- | 'tel'
458
- | 'tel-country-code'
459
- | 'tel-national'
460
- | 'tel-device'
461
- | 'username'
462
- | 'username-new'
463
- | 'off'
464
- // additional HTML autocomplete values
465
- | 'address-line1'
466
- | 'address-line2'
467
- | 'bday'
468
- | 'bday-day'
469
- | 'bday-month'
470
- | 'bday-year'
471
- | 'country'
472
- | 'current-password'
473
- | 'honorific-prefix'
474
- | 'honorific-suffix'
475
- | 'additional-name'
476
- | 'family-name'
477
- | 'given-name'
478
- | 'new-password'
479
- | 'one-time-code'
480
- | 'sex'
481
- ),
482
-
483
348
  /**
484
349
  * When provided it will set the color of the cursor (or "caret") in the component.
485
350
  * Unlike the behavior of `selectionColor` the cursor color will be set independently
@@ -607,6 +472,127 @@ export type Props = $ReadOnly<{|
607
472
  */
608
473
  autoCapitalize?: ?AutoCapitalize,
609
474
 
475
+ /**
476
+ * Specifies autocomplete hints for the system, so it can provide autofill.
477
+ * On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
478
+ * To disable autocomplete, set autoComplete to off.
479
+ *
480
+ * The following values work across platforms:
481
+ *
482
+ * - `additional-name`
483
+ * - `address-line1`
484
+ * - `address-line2`
485
+ * - `cc-number`
486
+ * - `country`
487
+ * - `current-password`
488
+ * - `email`
489
+ * - `family-name`
490
+ * - `given-name`
491
+ * - `honorific-prefix`
492
+ * - `honorific-suffix`
493
+ * - `name`
494
+ * - `new-password`
495
+ * - `off`
496
+ * - `one-time-code`
497
+ * - `postal-code`
498
+ * - `street-address`
499
+ * - `tel`
500
+ * - `username`
501
+ *
502
+ * The following values work on iOS only:
503
+ *
504
+ * - `nickname`
505
+ * - `organization`
506
+ * - `organization-title`
507
+ * - `url`
508
+ *
509
+ * The following values work on Android only:
510
+ *
511
+ * - `birthdate-day`
512
+ * - `birthdate-full`
513
+ * - `birthdate-month`
514
+ * - `birthdate-year`
515
+ * - `cc-csc`
516
+ * - `cc-exp`
517
+ * - `cc-exp-day`
518
+ * - `cc-exp-month`
519
+ * - `cc-exp-year`
520
+ * - `gender`
521
+ * - `name-family`
522
+ * - `name-given`
523
+ * - `name-middle`
524
+ * - `name-middle-initial`
525
+ * - `name-prefix`
526
+ * - `name-suffix`
527
+ * - `password`
528
+ * - `password-new`
529
+ * - `postal-address`
530
+ * - `postal-address-country`
531
+ * - `postal-address-extended`
532
+ * - `postal-address-extended-postal-code`
533
+ * - `postal-address-locality`
534
+ * - `postal-address-region`
535
+ * - `sms-otp`
536
+ * - `tel-country-code`
537
+ * - `tel-national`
538
+ * - `tel-device`
539
+ * - `username-new`
540
+ */
541
+ autoComplete?: ?(
542
+ | 'additional-name'
543
+ | 'address-line1'
544
+ | 'address-line2'
545
+ | 'birthdate-day'
546
+ | 'birthdate-full'
547
+ | 'birthdate-month'
548
+ | 'birthdate-year'
549
+ | 'cc-csc'
550
+ | 'cc-exp'
551
+ | 'cc-exp-day'
552
+ | 'cc-exp-month'
553
+ | 'cc-exp-year'
554
+ | 'cc-number'
555
+ | 'country'
556
+ | 'current-password'
557
+ | 'email'
558
+ | 'family-name'
559
+ | 'gender'
560
+ | 'given-name'
561
+ | 'honorific-prefix'
562
+ | 'honorific-suffix'
563
+ | 'name'
564
+ | 'name-family'
565
+ | 'name-given'
566
+ | 'name-middle'
567
+ | 'name-middle-initial'
568
+ | 'name-prefix'
569
+ | 'name-suffix'
570
+ | 'new-password'
571
+ | 'nickname'
572
+ | 'one-time-code'
573
+ | 'organization'
574
+ | 'organization-title'
575
+ | 'password'
576
+ | 'password-new'
577
+ | 'postal-address'
578
+ | 'postal-address-country'
579
+ | 'postal-address-extended'
580
+ | 'postal-address-extended-postal-code'
581
+ | 'postal-address-locality'
582
+ | 'postal-address-region'
583
+ | 'postal-code'
584
+ | 'street-address'
585
+ | 'sms-otp'
586
+ | 'tel'
587
+ | 'tel-country-code'
588
+ | 'tel-national'
589
+ | 'tel-device'
590
+ | 'url'
591
+ | 'username'
592
+ | 'username-new'
593
+ | 'off'
594
+ ),
595
+
610
596
  /**
611
597
  * If `false`, disables auto-correct. The default value is `true`.
612
598
  */
@@ -1113,6 +1099,18 @@ const emptyFunctionThatReturnsTrue = () => true;
1113
1099
  *
1114
1100
  */
1115
1101
  function InternalTextInput(props: Props): React.Node {
1102
+ const {
1103
+ 'aria-busy': ariaBusy,
1104
+ 'aria-checked': ariaChecked,
1105
+ 'aria-disabled': ariaDisabled,
1106
+ 'aria-expanded': ariaExpanded,
1107
+ 'aria-selected': ariaSelected,
1108
+ accessibilityState,
1109
+ id,
1110
+ tabIndex,
1111
+ ...otherProps
1112
+ } = props;
1113
+
1116
1114
  const inputRef = useRef<null | React.ElementRef<HostComponent<mixed>>>(null);
1117
1115
 
1118
1116
  // Android sends a "onTextChanged" event followed by a "onSelectionChanged" event, for
@@ -1490,13 +1488,25 @@ function InternalTextInput(props: Props): React.Node {
1490
1488
  props.onKeyUpCapture && props.onKeyUpCapture(event);
1491
1489
  };
1492
1490
 
1493
- const _accessibilityState = {
1494
- busy: props['aria-busy'] ?? props.accessibilityState?.busy,
1495
- checked: props['aria-checked'] ?? props.accessibilityState?.checked,
1496
- disabled: props['aria-disabled'] ?? props.accessibilityState?.disabled,
1497
- expanded: props['aria-expanded'] ?? props.accessibilityState?.expanded,
1498
- selected: props['aria-selected'] ?? props.accessibilityState?.selected,
1499
- };
1491
+ let _accessibilityState;
1492
+ if (
1493
+ accessibilityState != null ||
1494
+ ariaBusy != null ||
1495
+ ariaChecked != null ||
1496
+ ariaDisabled != null ||
1497
+ ariaExpanded != null ||
1498
+ ariaSelected != null
1499
+ ) {
1500
+ _accessibilityState = {
1501
+ busy: ariaBusy ?? accessibilityState?.busy,
1502
+ checked: ariaChecked ?? accessibilityState?.checked,
1503
+ disabled: ariaDisabled ?? accessibilityState?.disabled,
1504
+ expanded: ariaExpanded ?? accessibilityState?.expanded,
1505
+ selected: ariaSelected ?? accessibilityState?.selected,
1506
+ };
1507
+ }
1508
+
1509
+ let style = flattenStyle(props.style);
1500
1510
 
1501
1511
  if (focusable && !accessible) {
1502
1512
  console.warn(
@@ -1510,10 +1520,7 @@ function InternalTextInput(props: Props): React.Node {
1510
1520
  ? RCTMultilineTextInputView
1511
1521
  : RCTSinglelineTextInputView;
1512
1522
 
1513
- const style =
1514
- props.multiline === true
1515
- ? StyleSheet.flatten([styles.multilineInput, props.style])
1516
- : props.style;
1523
+ style = props.multiline === true ? [styles.multilineInput, style] : style;
1517
1524
 
1518
1525
  const useOnChangeSync =
1519
1526
  (props.unstable_onChangeSync || props.unstable_onChangeTextSync) &&
@@ -1522,15 +1529,16 @@ function InternalTextInput(props: Props): React.Node {
1522
1529
  textInput = (
1523
1530
  <RCTTextInputView
1524
1531
  ref={_setNativeRef}
1525
- {...props}
1532
+ {...otherProps}
1526
1533
  {...eventHandlers}
1527
- accessible={accessible}
1528
1534
  accessibilityState={_accessibilityState}
1535
+ accessible={accessible}
1529
1536
  submitBehavior={submitBehavior}
1530
1537
  caretHidden={caretHidden}
1531
1538
  dataDetectorTypes={props.dataDetectorTypes}
1532
- focusable={focusable}
1539
+ focusable={tabIndex !== undefined ? !tabIndex : focusable}
1533
1540
  mostRecentEventCount={mostRecentEventCount}
1541
+ nativeID={id ?? props.nativeID}
1534
1542
  onBlur={_onBlur}
1535
1543
  onKeyPressSync={props.unstable_onKeyPressSync}
1536
1544
  onChange={_onChange}
@@ -1546,7 +1554,6 @@ function InternalTextInput(props: Props): React.Node {
1546
1554
  />
1547
1555
  );
1548
1556
  } else if (Platform.OS === 'android') {
1549
- const style = [props.style];
1550
1557
  const autoCapitalize = props.autoCapitalize || 'sentences';
1551
1558
  const _accessibilityLabelledBy =
1552
1559
  props?.['aria-labelledby'] ?? props?.accessibilityLabelledBy;
@@ -1572,18 +1579,19 @@ function InternalTextInput(props: Props): React.Node {
1572
1579
  * fixed */
1573
1580
  <AndroidTextInput
1574
1581
  ref={_setNativeRef}
1575
- {...props}
1582
+ {...otherProps}
1576
1583
  {...eventHandlers}
1577
- accessible={accessible}
1578
1584
  accessibilityState={_accessibilityState}
1579
1585
  accessibilityLabelledBy={_accessibilityLabelledBy}
1586
+ accessible={accessible}
1580
1587
  autoCapitalize={autoCapitalize}
1581
1588
  submitBehavior={submitBehavior}
1582
1589
  caretHidden={caretHidden}
1583
1590
  children={children}
1584
1591
  disableFullscreenUI={props.disableFullscreenUI}
1585
- focusable={focusable}
1592
+ focusable={tabIndex !== undefined ? !tabIndex : focusable}
1586
1593
  mostRecentEventCount={mostRecentEventCount}
1594
+ nativeID={id ?? props.nativeID}
1587
1595
  numberOfLines={props.rows ?? props.numberOfLines}
1588
1596
  onBlur={_onBlur}
1589
1597
  onChange={_onChange}
@@ -1608,11 +1616,12 @@ function InternalTextInput(props: Props): React.Node {
1608
1616
  textInput = (
1609
1617
  <WindowsTextInput
1610
1618
  ref={_setNativeRef}
1611
- {...props}
1619
+ {...otherProps}
1612
1620
  accessible={accessible}
1613
- focusable={focusable}
1621
+ focusable={tabIndex !== undefined ? !tabIndex : focusable}
1614
1622
  dataDetectorTypes={props.dataDetectorTypes}
1615
1623
  mostRecentEventCount={mostRecentEventCount}
1624
+ nativeID={id ?? props.nativeID}
1616
1625
  onBlur={_onBlur}
1617
1626
  onChange={_onChange}
1618
1627
  onContentSizeChange={props.onContentSizeChange}
@@ -1738,11 +1747,12 @@ const ExportedForwardRef: React.AbstractComponent<
1738
1747
  React.ElementRef<HostComponent<mixed>> & ImperativeMethods,
1739
1748
  >,
1740
1749
  ) {
1741
- const style = flattenStyle(restProps.style);
1750
+ let style = flattenStyle(restProps.style);
1742
1751
 
1743
1752
  if (style?.verticalAlign != null) {
1744
1753
  style.textAlignVertical =
1745
1754
  verticalAlignToTextAlignVerticalMap[style.verticalAlign];
1755
+ delete style.verticalAlign;
1746
1756
  }
1747
1757
 
1748
1758
  return (
@@ -1783,6 +1793,8 @@ const ExportedForwardRef: React.AbstractComponent<
1783
1793
  );
1784
1794
  });
1785
1795
 
1796
+ ExportedForwardRef.displayName = 'TextInput';
1797
+
1786
1798
  /**
1787
1799
  * Switch to `deprecated-react-native-prop-types` for compatibility with future
1788
1800
  * releases. This is deprecated and will be removed in the future.
@@ -57,7 +57,6 @@ const View: React.AbstractComponent<
57
57
  nativeID,
58
58
  pointerEvents,
59
59
  role,
60
- style,
61
60
  tabIndex,
62
61
  ...otherProps
63
62
  }: ViewProps,
@@ -66,23 +65,42 @@ const View: React.AbstractComponent<
66
65
  const _accessibilityLabelledBy =
67
66
  ariaLabelledBy?.split(/\s*,\s*/g) ?? accessibilityLabelledBy;
68
67
 
69
- const _accessibilityState = {
70
- busy: ariaBusy ?? accessibilityState?.busy,
71
- checked: ariaChecked ?? accessibilityState?.checked,
72
- disabled: ariaDisabled ?? accessibilityState?.disabled,
73
- expanded: ariaExpanded ?? accessibilityState?.expanded,
74
- selected: ariaSelected ?? accessibilityState?.selected,
75
- };
68
+ let _accessibilityState;
69
+ if (
70
+ accessibilityState != null ||
71
+ ariaBusy != null ||
72
+ ariaChecked != null ||
73
+ ariaDisabled != null ||
74
+ ariaExpanded != null ||
75
+ ariaSelected != null
76
+ ) {
77
+ _accessibilityState = {
78
+ busy: ariaBusy ?? accessibilityState?.busy,
79
+ checked: ariaChecked ?? accessibilityState?.checked,
80
+ disabled: ariaDisabled ?? accessibilityState?.disabled,
81
+ expanded: ariaExpanded ?? accessibilityState?.expanded,
82
+ selected: ariaSelected ?? accessibilityState?.selected,
83
+ };
84
+ }
85
+ let _accessibilityValue;
86
+ if (
87
+ accessibilityValue != null ||
88
+ ariaValueMax != null ||
89
+ ariaValueMin != null ||
90
+ ariaValueNow != null ||
91
+ ariaValueText != null
92
+ ) {
93
+ _accessibilityValue = {
94
+ max: ariaValueMax ?? accessibilityValue?.max,
95
+ min: ariaValueMin ?? accessibilityValue?.min,
96
+ now: ariaValueNow ?? accessibilityValue?.now,
97
+ text: ariaValueText ?? accessibilityValue?.text,
98
+ };
99
+ }
76
100
 
77
- const _accessibilityValue = {
78
- max: ariaValueMax ?? accessibilityValue?.max,
79
- min: ariaValueMin ?? accessibilityValue?.min,
80
- now: ariaValueNow ?? accessibilityValue?.now,
81
- text: ariaValueText ?? accessibilityValue?.text,
82
- };
101
+ let style = flattenStyle(otherProps.style);
83
102
 
84
- const flattenedStyle = flattenStyle(style);
85
- const newPointerEvents = flattenedStyle?.pointerEvents || pointerEvents;
103
+ const newPointerEvents = style?.pointerEvents || pointerEvents;
86
104
 
87
105
  return (
88
106
  <TextAncestor.Provider value={false}>
@@ -61,7 +61,6 @@ const View: React.AbstractComponent<
61
61
  nativeID,
62
62
  pointerEvents,
63
63
  role,
64
- style,
65
64
  tabIndex,
66
65
  ...otherProps
67
66
  }: ViewProps,
@@ -70,23 +69,42 @@ const View: React.AbstractComponent<
70
69
  const _accessibilityLabelledBy =
71
70
  ariaLabelledBy?.split(/\s*,\s*/g) ?? accessibilityLabelledBy;
72
71
 
73
- const _accessibilityState = {
74
- busy: ariaBusy ?? accessibilityState?.busy,
75
- checked: ariaChecked ?? accessibilityState?.checked,
76
- disabled: ariaDisabled ?? accessibilityState?.disabled,
77
- expanded: ariaExpanded ?? accessibilityState?.expanded,
78
- selected: ariaSelected ?? accessibilityState?.selected,
79
- };
72
+ let _accessibilityState;
73
+ if (
74
+ accessibilityState != null ||
75
+ ariaBusy != null ||
76
+ ariaChecked != null ||
77
+ ariaDisabled != null ||
78
+ ariaExpanded != null ||
79
+ ariaSelected != null
80
+ ) {
81
+ _accessibilityState = {
82
+ busy: ariaBusy ?? accessibilityState?.busy,
83
+ checked: ariaChecked ?? accessibilityState?.checked,
84
+ disabled: ariaDisabled ?? accessibilityState?.disabled,
85
+ expanded: ariaExpanded ?? accessibilityState?.expanded,
86
+ selected: ariaSelected ?? accessibilityState?.selected,
87
+ };
88
+ }
89
+ let _accessibilityValue;
90
+ if (
91
+ accessibilityValue != null ||
92
+ ariaValueMax != null ||
93
+ ariaValueMin != null ||
94
+ ariaValueNow != null ||
95
+ ariaValueText != null
96
+ ) {
97
+ _accessibilityValue = {
98
+ max: ariaValueMax ?? accessibilityValue?.max,
99
+ min: ariaValueMin ?? accessibilityValue?.min,
100
+ now: ariaValueNow ?? accessibilityValue?.now,
101
+ text: ariaValueText ?? accessibilityValue?.text,
102
+ };
103
+ }
80
104
 
81
- const _accessibilityValue = {
82
- max: ariaValueMax ?? accessibilityValue?.max,
83
- min: ariaValueMin ?? accessibilityValue?.min,
84
- now: ariaValueNow ?? accessibilityValue?.now,
85
- text: ariaValueText ?? accessibilityValue?.text,
86
- };
105
+ let style = flattenStyle(otherProps.style);
87
106
 
88
- const flattenedStyle = flattenStyle(style);
89
- const newPointerEvents = flattenedStyle?.pointerEvents || pointerEvents;
107
+ const newPointerEvents = style?.pointerEvents || pointerEvents;
90
108
 
91
109
  const _keyDown = (event: KeyEvent) => {
92
110
  if (otherProps.keyDownEvents && event.isPropagationStopped() !== true) {
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 71,
15
- patch: 6,
15
+ patch: 12,
16
16
  prerelease: null,
17
17
  };
@@ -158,13 +158,13 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
158
158
  const {width = props.width, height = props.height, uri} = source;
159
159
  style = flattenStyle([{width, height}, styles.base, props.style]);
160
160
  sources = [source];
161
-
162
161
  if (uri === '') {
163
162
  console.warn('source.uri should not be an empty string');
164
163
  }
165
164
  }
166
165
 
167
166
  const {height, width, ...restProps} = props;
167
+
168
168
  const {onLoadStart, onLoad, onLoadEnd, onError} = props;
169
169
  const nativeProps = {
170
170
  ...restProps,
@@ -157,6 +157,9 @@ export default class VirtualizedList extends StateSafePureComponent<
157
157
  scrollToEnd(params?: ?{animated?: ?boolean, ...}) {
158
158
  const animated = params ? params.animated : true;
159
159
  const veryLast = this.props.getItemCount(this.props.data) - 1;
160
+ if (veryLast < 0) {
161
+ return;
162
+ }
160
163
  const frame = this.__getFrameMetricsApprox(veryLast, this.props);
161
164
  const offset = Math.max(
162
165
  0,
@@ -14,12 +14,38 @@ import type {LogBoxLogData} from './LogBoxLog';
14
14
  import parseErrorStack from '../../Core/Devtools/parseErrorStack';
15
15
  import UTFSequence from '../../UTFSequence';
16
16
  import stringifySafe from '../../Utilities/stringifySafe';
17
+ import ansiRegex from 'ansi-regex';
18
+
19
+ const ANSI_REGEX = ansiRegex().source;
17
20
 
18
21
  const BABEL_TRANSFORM_ERROR_FORMAT =
19
22
  /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/;
23
+
24
+ // https://github.com/babel/babel/blob/33dbb85e9e9fe36915273080ecc42aee62ed0ade/packages/babel-code-frame/src/index.ts#L183-L184
25
+ const BABEL_CODE_FRAME_MARKER_PATTERN = new RegExp(
26
+ [
27
+ // Beginning of a line (per 'm' flag)
28
+ '^',
29
+ // Optional ANSI escapes for colors
30
+ `(?:${ANSI_REGEX})*`,
31
+ // Marker
32
+ '>',
33
+ // Optional ANSI escapes for colors
34
+ `(?:${ANSI_REGEX})*`,
35
+ // Left padding for line number
36
+ ' +',
37
+ // Line number
38
+ '[0-9]+',
39
+ // Gutter
40
+ ' \\|',
41
+ ].join(''),
42
+ 'm',
43
+ );
44
+
20
45
  const BABEL_CODE_FRAME_ERROR_FORMAT =
21
46
  // eslint-disable-next-line no-control-regex
22
47
  /^(?:TransformError )?(?:.*):? (?:.*?)(\/.*): ([\s\S]+?)\n([ >]{2}[\d\s]+ \|[\s\S]+|\u{001b}[\s\S]+)/u;
48
+
23
49
  const METRO_ERROR_FORMAT =
24
50
  /^(?:InternalError Metro has encountered an error:) (.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/u;
25
51
 
@@ -241,27 +267,31 @@ export function parseLogBoxException(
241
267
  };
242
268
  }
243
269
 
244
- const babelCodeFrameError = message.match(BABEL_CODE_FRAME_ERROR_FORMAT);
270
+ // Perform a cheap match first before trying to parse the full message, which
271
+ // can get expensive for arbitrary input.
272
+ if (BABEL_CODE_FRAME_MARKER_PATTERN.test(message)) {
273
+ const babelCodeFrameError = message.match(BABEL_CODE_FRAME_ERROR_FORMAT);
245
274
 
246
- if (babelCodeFrameError) {
247
- // Codeframe errors are thrown from any use of buildCodeFrameError.
248
- const [fileName, content, codeFrame] = babelCodeFrameError.slice(1);
249
- return {
250
- level: 'syntax',
251
- stack: [],
252
- isComponentError: false,
253
- componentStack: [],
254
- codeFrame: {
255
- fileName,
256
- location: null, // We are not given the location.
257
- content: codeFrame,
258
- },
259
- message: {
260
- content,
261
- substitutions: [],
262
- },
263
- category: `${fileName}-${1}-${1}`,
264
- };
275
+ if (babelCodeFrameError) {
276
+ // Codeframe errors are thrown from any use of buildCodeFrameError.
277
+ const [fileName, content, codeFrame] = babelCodeFrameError.slice(1);
278
+ return {
279
+ level: 'syntax',
280
+ stack: [],
281
+ isComponentError: false,
282
+ componentStack: [],
283
+ codeFrame: {
284
+ fileName,
285
+ location: null, // We are not given the location.
286
+ content: codeFrame,
287
+ },
288
+ message: {
289
+ content,
290
+ substitutions: [],
291
+ },
292
+ category: `${fileName}-${1}-${1}`,
293
+ };
294
+ }
265
295
  }
266
296
 
267
297
  if (message.match(/^TransformError /)) {
@@ -180,6 +180,7 @@ export interface TransformsStyle {
180
180
  | SkewYTransform
181
181
  | MatrixTransform
182
182
  )[]
183
+ | string
183
184
  | undefined;
184
185
  /**
185
186
  * @deprecated Use matrix in transform prop instead.