react-native-macos 0.71.16 → 0.71.17

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.
@@ -277,36 +277,6 @@ export type enterKeyHintType =
277
277
  type PasswordRules = string;
278
278
 
279
279
  type IOSProps = $ReadOnly<{|
280
- /**
281
- * Give the keyboard and the system information about the
282
- * expected semantic meaning for the content that users enter.
283
- * @platform ios
284
- */
285
- autoComplete?: ?(
286
- | 'address-line1'
287
- | 'address-line2'
288
- | 'cc-number'
289
- | 'current-password'
290
- | 'country'
291
- | 'email'
292
- | 'name'
293
- | 'additional-name'
294
- | 'family-name'
295
- | 'given-name'
296
- | 'nickname'
297
- | 'honorific-prefix'
298
- | 'honorific-suffix'
299
- | 'new-password'
300
- | 'off'
301
- | 'one-time-code'
302
- | 'organization'
303
- | 'organization-title'
304
- | 'postal-code'
305
- | 'street-address'
306
- | 'tel'
307
- | 'url'
308
- | 'username'
309
- ),
310
280
  /**
311
281
  * When the clear button should appear on the right side of the text view.
312
282
  * This property is supported only for single-line TextInput component.
@@ -501,111 +471,6 @@ type MacOSProps = $ReadOnly<{|
501
471
  // macOS]
502
472
 
503
473
  type AndroidProps = $ReadOnly<{|
504
- /**
505
- * 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.
506
- * To disable autocomplete, set `autoComplete` to `off`.
507
- *
508
- * *Android Only*
509
- *
510
- * Possible values for `autoComplete` are:
511
- *
512
- * - `birthdate-day`
513
- * - `birthdate-full`
514
- * - `birthdate-month`
515
- * - `birthdate-year`
516
- * - `cc-csc`
517
- * - `cc-exp`
518
- * - `cc-exp-day`
519
- * - `cc-exp-month`
520
- * - `cc-exp-year`
521
- * - `cc-number`
522
- * - `email`
523
- * - `gender`
524
- * - `name`
525
- * - `name-family`
526
- * - `name-given`
527
- * - `name-middle`
528
- * - `name-middle-initial`
529
- * - `name-prefix`
530
- * - `name-suffix`
531
- * - `password`
532
- * - `password-new`
533
- * - `postal-address`
534
- * - `postal-address-country`
535
- * - `postal-address-extended`
536
- * - `postal-address-extended-postal-code`
537
- * - `postal-address-locality`
538
- * - `postal-address-region`
539
- * - `postal-code`
540
- * - `street-address`
541
- * - `sms-otp`
542
- * - `tel`
543
- * - `tel-country-code`
544
- * - `tel-national`
545
- * - `tel-device`
546
- * - `username`
547
- * - `username-new`
548
- * - `off`
549
- *
550
- * @platform android
551
- */
552
- autoComplete?: ?(
553
- | 'birthdate-day'
554
- | 'birthdate-full'
555
- | 'birthdate-month'
556
- | 'birthdate-year'
557
- | 'cc-csc'
558
- | 'cc-exp'
559
- | 'cc-exp-day'
560
- | 'cc-exp-month'
561
- | 'cc-exp-year'
562
- | 'cc-number'
563
- | 'email'
564
- | 'gender'
565
- | 'name'
566
- | 'name-family'
567
- | 'name-given'
568
- | 'name-middle'
569
- | 'name-middle-initial'
570
- | 'name-prefix'
571
- | 'name-suffix'
572
- | 'password'
573
- | 'password-new'
574
- | 'postal-address'
575
- | 'postal-address-country'
576
- | 'postal-address-extended'
577
- | 'postal-address-extended-postal-code'
578
- | 'postal-address-locality'
579
- | 'postal-address-region'
580
- | 'postal-code'
581
- | 'street-address'
582
- | 'sms-otp'
583
- | 'tel'
584
- | 'tel-country-code'
585
- | 'tel-national'
586
- | 'tel-device'
587
- | 'username'
588
- | 'username-new'
589
- | 'off'
590
- // additional HTML autocomplete values
591
- | 'address-line1'
592
- | 'address-line2'
593
- | 'bday'
594
- | 'bday-day'
595
- | 'bday-month'
596
- | 'bday-year'
597
- | 'country'
598
- | 'current-password'
599
- | 'honorific-prefix'
600
- | 'honorific-suffix'
601
- | 'additional-name'
602
- | 'family-name'
603
- | 'given-name'
604
- | 'new-password'
605
- | 'one-time-code'
606
- | 'sex'
607
- ),
608
-
609
474
  /**
610
475
  * When provided it will set the color of the cursor (or "caret") in the component.
611
476
  * Unlike the behavior of `selectionColor` the cursor color will be set independently
@@ -710,6 +575,127 @@ export type Props = $ReadOnly<{|
710
575
  */
711
576
  autoCapitalize?: ?AutoCapitalize,
712
577
 
578
+ /**
579
+ * Specifies autocomplete hints for the system, so it can provide autofill.
580
+ * On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
581
+ * To disable autocomplete, set autoComplete to off.
582
+ *
583
+ * The following values work across platforms:
584
+ *
585
+ * - `additional-name`
586
+ * - `address-line1`
587
+ * - `address-line2`
588
+ * - `cc-number`
589
+ * - `country`
590
+ * - `current-password`
591
+ * - `email`
592
+ * - `family-name`
593
+ * - `given-name`
594
+ * - `honorific-prefix`
595
+ * - `honorific-suffix`
596
+ * - `name`
597
+ * - `new-password`
598
+ * - `off`
599
+ * - `one-time-code`
600
+ * - `postal-code`
601
+ * - `street-address`
602
+ * - `tel`
603
+ * - `username`
604
+ *
605
+ * The following values work on iOS only:
606
+ *
607
+ * - `nickname`
608
+ * - `organization`
609
+ * - `organization-title`
610
+ * - `url`
611
+ *
612
+ * The following values work on Android only:
613
+ *
614
+ * - `birthdate-day`
615
+ * - `birthdate-full`
616
+ * - `birthdate-month`
617
+ * - `birthdate-year`
618
+ * - `cc-csc`
619
+ * - `cc-exp`
620
+ * - `cc-exp-day`
621
+ * - `cc-exp-month`
622
+ * - `cc-exp-year`
623
+ * - `gender`
624
+ * - `name-family`
625
+ * - `name-given`
626
+ * - `name-middle`
627
+ * - `name-middle-initial`
628
+ * - `name-prefix`
629
+ * - `name-suffix`
630
+ * - `password`
631
+ * - `password-new`
632
+ * - `postal-address`
633
+ * - `postal-address-country`
634
+ * - `postal-address-extended`
635
+ * - `postal-address-extended-postal-code`
636
+ * - `postal-address-locality`
637
+ * - `postal-address-region`
638
+ * - `sms-otp`
639
+ * - `tel-country-code`
640
+ * - `tel-national`
641
+ * - `tel-device`
642
+ * - `username-new`
643
+ */
644
+ autoComplete?: ?(
645
+ | 'additional-name'
646
+ | 'address-line1'
647
+ | 'address-line2'
648
+ | 'birthdate-day'
649
+ | 'birthdate-full'
650
+ | 'birthdate-month'
651
+ | 'birthdate-year'
652
+ | 'cc-csc'
653
+ | 'cc-exp'
654
+ | 'cc-exp-day'
655
+ | 'cc-exp-month'
656
+ | 'cc-exp-year'
657
+ | 'cc-number'
658
+ | 'country'
659
+ | 'current-password'
660
+ | 'email'
661
+ | 'family-name'
662
+ | 'gender'
663
+ | 'given-name'
664
+ | 'honorific-prefix'
665
+ | 'honorific-suffix'
666
+ | 'name'
667
+ | 'name-family'
668
+ | 'name-given'
669
+ | 'name-middle'
670
+ | 'name-middle-initial'
671
+ | 'name-prefix'
672
+ | 'name-suffix'
673
+ | 'new-password'
674
+ | 'nickname'
675
+ | 'one-time-code'
676
+ | 'organization'
677
+ | 'organization-title'
678
+ | 'password'
679
+ | 'password-new'
680
+ | 'postal-address'
681
+ | 'postal-address-country'
682
+ | 'postal-address-extended'
683
+ | 'postal-address-extended-postal-code'
684
+ | 'postal-address-locality'
685
+ | 'postal-address-region'
686
+ | 'postal-code'
687
+ | 'street-address'
688
+ | 'sms-otp'
689
+ | 'tel'
690
+ | 'tel-country-code'
691
+ | 'tel-national'
692
+ | 'tel-device'
693
+ | 'url'
694
+ | 'username'
695
+ | 'username-new'
696
+ | 'off'
697
+ ),
698
+
713
699
  /**
714
700
  * If `false`, disables auto-correct. The default value is `true`.
715
701
  */
@@ -1229,6 +1215,18 @@ const emptyFunctionThatReturnsTrue = () => true;
1229
1215
  *
1230
1216
  */
1231
1217
  function InternalTextInput(props: Props): React.Node {
1218
+ const {
1219
+ 'aria-busy': ariaBusy,
1220
+ 'aria-checked': ariaChecked,
1221
+ 'aria-disabled': ariaDisabled,
1222
+ 'aria-expanded': ariaExpanded,
1223
+ 'aria-selected': ariaSelected,
1224
+ accessibilityState,
1225
+ id,
1226
+ tabIndex,
1227
+ ...otherProps
1228
+ } = props;
1229
+
1232
1230
  const inputRef = useRef<null | React.ElementRef<HostComponent<mixed>>>(null);
1233
1231
 
1234
1232
  // Android sends a "onTextChanged" event followed by a "onSelectionChanged" event, for
@@ -1551,13 +1549,25 @@ function InternalTextInput(props: Props): React.Node {
1551
1549
  // so omitting onBlur and onFocus pressability handlers here.
1552
1550
  const {onBlur, onFocus, ...eventHandlers} = usePressability(config) || {};
1553
1551
 
1554
- const _accessibilityState = {
1555
- busy: props['aria-busy'] ?? props.accessibilityState?.busy,
1556
- checked: props['aria-checked'] ?? props.accessibilityState?.checked,
1557
- disabled: props['aria-disabled'] ?? props.accessibilityState?.disabled,
1558
- expanded: props['aria-expanded'] ?? props.accessibilityState?.expanded,
1559
- selected: props['aria-selected'] ?? props.accessibilityState?.selected,
1560
- };
1552
+ let _accessibilityState;
1553
+ if (
1554
+ accessibilityState != null ||
1555
+ ariaBusy != null ||
1556
+ ariaChecked != null ||
1557
+ ariaDisabled != null ||
1558
+ ariaExpanded != null ||
1559
+ ariaSelected != null
1560
+ ) {
1561
+ _accessibilityState = {
1562
+ busy: ariaBusy ?? accessibilityState?.busy,
1563
+ checked: ariaChecked ?? accessibilityState?.checked,
1564
+ disabled: ariaDisabled ?? accessibilityState?.disabled,
1565
+ expanded: ariaExpanded ?? accessibilityState?.expanded,
1566
+ selected: ariaSelected ?? accessibilityState?.selected,
1567
+ };
1568
+ }
1569
+
1570
+ let style = flattenStyle(props.style);
1561
1571
 
1562
1572
  if (Platform.OS === 'ios' || Platform.OS === 'macos') {
1563
1573
  // [macOS]
@@ -1566,10 +1576,7 @@ function InternalTextInput(props: Props): React.Node {
1566
1576
  ? RCTMultilineTextInputView
1567
1577
  : RCTSinglelineTextInputView;
1568
1578
 
1569
- const style =
1570
- props.multiline === true
1571
- ? StyleSheet.flatten([styles.multilineInput, props.style])
1572
- : props.style;
1579
+ style = props.multiline === true ? [styles.multilineInput, style] : style;
1573
1580
 
1574
1581
  const useOnChangeSync =
1575
1582
  (props.unstable_onChangeSync || props.unstable_onChangeTextSync) &&
@@ -1578,15 +1585,16 @@ function InternalTextInput(props: Props): React.Node {
1578
1585
  textInput = (
1579
1586
  <RCTTextInputView
1580
1587
  ref={_setNativeRef}
1581
- {...props}
1588
+ {...otherProps}
1582
1589
  {...eventHandlers}
1583
- accessible={accessible}
1584
1590
  accessibilityState={_accessibilityState}
1591
+ accessible={accessible}
1585
1592
  submitBehavior={submitBehavior}
1586
1593
  caretHidden={caretHidden}
1587
1594
  dataDetectorTypes={props.dataDetectorTypes}
1588
- focusable={focusable}
1595
+ focusable={tabIndex !== undefined ? !tabIndex : focusable}
1589
1596
  mostRecentEventCount={mostRecentEventCount}
1597
+ nativeID={id ?? props.nativeID}
1590
1598
  onBlur={_onBlur}
1591
1599
  onKeyPressSync={props.unstable_onKeyPressSync}
1592
1600
  onChange={_onChange}
@@ -1604,7 +1612,6 @@ function InternalTextInput(props: Props): React.Node {
1604
1612
  />
1605
1613
  );
1606
1614
  } else if (Platform.OS === 'android') {
1607
- const style = [props.style];
1608
1615
  const autoCapitalize = props.autoCapitalize || 'sentences';
1609
1616
  const _accessibilityLabelledBy =
1610
1617
  props?.['aria-labelledby'] ?? props?.accessibilityLabelledBy;
@@ -1630,18 +1637,19 @@ function InternalTextInput(props: Props): React.Node {
1630
1637
  * fixed */
1631
1638
  <AndroidTextInput
1632
1639
  ref={_setNativeRef}
1633
- {...props}
1640
+ {...otherProps}
1634
1641
  {...eventHandlers}
1635
- accessible={accessible}
1636
1642
  accessibilityState={_accessibilityState}
1637
1643
  accessibilityLabelledBy={_accessibilityLabelledBy}
1644
+ accessible={accessible}
1638
1645
  autoCapitalize={autoCapitalize}
1639
1646
  submitBehavior={submitBehavior}
1640
1647
  caretHidden={caretHidden}
1641
1648
  children={children}
1642
1649
  disableFullscreenUI={props.disableFullscreenUI}
1643
- focusable={focusable}
1650
+ focusable={tabIndex !== undefined ? !tabIndex : focusable}
1644
1651
  mostRecentEventCount={mostRecentEventCount}
1652
+ nativeID={id ?? props.nativeID}
1645
1653
  numberOfLines={props.rows ?? props.numberOfLines}
1646
1654
  onBlur={_onBlur}
1647
1655
  onChange={_onChange}
@@ -1771,11 +1779,12 @@ const ExportedForwardRef: React.AbstractComponent<
1771
1779
  React.ElementRef<HostComponent<mixed>> & ImperativeMethods,
1772
1780
  >,
1773
1781
  ) {
1774
- const style = flattenStyle(restProps.style);
1782
+ let style = flattenStyle(restProps.style);
1775
1783
 
1776
1784
  if (style?.verticalAlign != null) {
1777
1785
  style.textAlignVertical =
1778
1786
  verticalAlignToTextAlignVerticalMap[style.verticalAlign];
1787
+ delete style.verticalAlign;
1779
1788
  }
1780
1789
 
1781
1790
  return (
@@ -1816,6 +1825,8 @@ const ExportedForwardRef: React.AbstractComponent<
1816
1825
  );
1817
1826
  });
1818
1827
 
1828
+ ExportedForwardRef.displayName = 'TextInput';
1829
+
1819
1830
  /**
1820
1831
  * Switch to `deprecated-react-native-prop-types` for compatibility with future
1821
1832
  * 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}>
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 71,
15
- patch: 16,
15
+ patch: 17,
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,
@@ -161,6 +161,9 @@ export default class VirtualizedList extends StateSafePureComponent<
161
161
  scrollToEnd(params?: ?{animated?: ?boolean, ...}) {
162
162
  const animated = params ? params.animated : true;
163
163
  const veryLast = this.props.getItemCount(this.props.data) - 1;
164
+ if (veryLast < 0) {
165
+ return;
166
+ }
164
167
  const frame = this.__getFrameMetricsApprox(veryLast, this.props);
165
168
  const offset = Math.max(
166
169
  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.