@office-iss/react-native-win32 0.71.10 → 0.71.12

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.
@@ -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.
@@ -9,17 +9,16 @@
9
9
  */
10
10
 
11
11
  import type {PressEvent} from '../Types/CoreEventTypes';
12
+ import type {TextProps} from './TextProps';
12
13
 
13
14
  import * as PressabilityDebug from '../Pressability/PressabilityDebug';
14
15
  import usePressability from '../Pressability/usePressability';
15
16
  import flattenStyle from '../StyleSheet/flattenStyle';
16
17
  import processColor from '../StyleSheet/processColor';
17
- import StyleSheet from '../StyleSheet/StyleSheet';
18
18
  import {getAccessibilityRoleFromRole} from '../Utilities/AcessibilityMapping';
19
19
  import Platform from '../Utilities/Platform';
20
20
  import TextAncestor from './TextAncestor';
21
21
  import {NativeText, NativeVirtualText} from './TextNativeComponent';
22
- import {type TextProps} from './TextProps';
23
22
  import * as React from 'react';
24
23
  import {useContext, useMemo, useState} from 'react';
25
24
 
@@ -36,6 +35,7 @@ const Text: React.AbstractComponent<
36
35
  accessible,
37
36
  accessibilityLabel,
38
37
  accessibilityRole,
38
+ accessibilityState,
39
39
  allowFontScaling,
40
40
  'aria-busy': ariaBusy,
41
41
  'aria-checked': ariaChecked,
@@ -64,13 +64,23 @@ const Text: React.AbstractComponent<
64
64
 
65
65
  const [isHighlighted, setHighlighted] = useState(false);
66
66
 
67
- const _accessibilityState = {
68
- busy: ariaBusy ?? props.accessibilityState?.busy,
69
- checked: ariaChecked ?? props.accessibilityState?.checked,
70
- disabled: ariaDisabled ?? props.accessibilityState?.disabled,
71
- expanded: ariaExpanded ?? props.accessibilityState?.expanded,
72
- selected: ariaSelected ?? props.accessibilityState?.selected,
73
- };
67
+ let _accessibilityState;
68
+ if (
69
+ accessibilityState != null ||
70
+ ariaBusy != null ||
71
+ ariaChecked != null ||
72
+ ariaDisabled != null ||
73
+ ariaExpanded != null ||
74
+ ariaSelected != null
75
+ ) {
76
+ _accessibilityState = {
77
+ busy: ariaBusy ?? accessibilityState?.busy,
78
+ checked: ariaChecked ?? accessibilityState?.checked,
79
+ disabled: ariaDisabled ?? accessibilityState?.disabled,
80
+ expanded: ariaExpanded ?? accessibilityState?.expanded,
81
+ selected: ariaSelected ?? accessibilityState?.selected,
82
+ };
83
+ }
74
84
 
75
85
  const _disabled =
76
86
  restProps.disabled != null
@@ -174,25 +184,11 @@ const Text: React.AbstractComponent<
174
184
  ? null
175
185
  : processColor(restProps.selectionColor);
176
186
 
177
- let style = flattenStyle(restProps.style);
178
-
179
- let _selectable = restProps.selectable;
180
- if (style?.userSelect != null) {
181
- _selectable = userSelectToSelectableMap[style.userSelect];
182
- }
183
-
184
- if (style?.verticalAlign != null) {
185
- style = StyleSheet.compose(style, {
186
- textAlignVertical:
187
- verticalAlignToTextAlignVerticalMap[style.verticalAlign],
188
- });
189
- }
187
+ let style = restProps.style;
190
188
 
191
189
  if (__DEV__) {
192
190
  if (PressabilityDebug.isEnabled() && onPress != null) {
193
- style = StyleSheet.compose(restProps.style, {
194
- color: 'magenta',
195
- });
191
+ style = [restProps.style, {color: 'magenta'}];
196
192
  }
197
193
  }
198
194
 
@@ -211,10 +207,22 @@ const Text: React.AbstractComponent<
211
207
  default: accessible,
212
208
  });
213
209
 
214
- let flattenedStyle = flattenStyle(style);
210
+ style = flattenStyle(style);
211
+
212
+ if (typeof style?.fontWeight === 'number') {
213
+ style.fontWeight = style?.fontWeight.toString();
214
+ }
215
+
216
+ let _selectable = restProps.selectable;
217
+ if (style?.userSelect != null) {
218
+ _selectable = userSelectToSelectableMap[style.userSelect];
219
+ delete style.userSelect;
220
+ }
215
221
 
216
- if (typeof flattenedStyle?.fontWeight === 'number') {
217
- flattenedStyle.fontWeight = flattenedStyle?.fontWeight.toString();
222
+ if (style?.verticalAlign != null) {
223
+ style.textAlignVertical =
224
+ verticalAlignToTextAlignVerticalMap[style.verticalAlign];
225
+ delete style.verticalAlign;
218
226
  }
219
227
 
220
228
  const _hasOnPressOrOnLongPress =
@@ -223,46 +231,46 @@ const Text: React.AbstractComponent<
223
231
  return hasTextAncestor ? (
224
232
  <NativeVirtualText
225
233
  {...restProps}
226
- accessibilityState={_accessibilityState}
227
234
  {...eventHandlersForText}
228
235
  accessibilityLabel={ariaLabel ?? accessibilityLabel}
229
236
  accessibilityRole={
230
237
  role ? getAccessibilityRoleFromRole(role) : accessibilityRole
231
238
  }
239
+ accessibilityState={_accessibilityState}
232
240
  isHighlighted={isHighlighted}
233
241
  isPressable={isPressable}
234
- selectable={_selectable}
235
242
  nativeID={id ?? nativeID}
236
243
  numberOfLines={numberOfLines}
237
- selectionColor={selectionColor}
238
- style={flattenedStyle}
239
244
  ref={forwardedRef}
245
+ selectable={_selectable}
246
+ selectionColor={selectionColor}
247
+ style={style}
240
248
  />
241
249
  ) : (
242
250
  <TextAncestor.Provider value={true}>
243
251
  <NativeText
244
252
  {...restProps}
245
253
  {...eventHandlersForText}
246
- disabled={_disabled}
247
- selectable={_selectable}
254
+ accessibilityLabel={ariaLabel ?? accessibilityLabel}
255
+ accessibilityRole={
256
+ role ? getAccessibilityRoleFromRole(role) : accessibilityRole
257
+ }
258
+ accessibilityState={nativeTextAccessibilityState}
248
259
  accessible={
249
260
  accessible == null && Platform.OS === 'android'
250
261
  ? _hasOnPressOrOnLongPress
251
262
  : _accessible
252
263
  }
253
- accessibilityLabel={ariaLabel ?? accessibilityLabel}
254
- accessibilityState={nativeTextAccessibilityState}
255
- accessibilityRole={
256
- role ? getAccessibilityRoleFromRole(role) : accessibilityRole
257
- }
258
264
  allowFontScaling={allowFontScaling !== false}
265
+ disabled={_disabled}
259
266
  ellipsizeMode={ellipsizeMode ?? 'tail'}
260
267
  isHighlighted={isHighlighted}
261
268
  nativeID={id ?? nativeID}
262
269
  numberOfLines={numberOfLines}
263
- selectionColor={selectionColor}
264
- style={flattenedStyle}
265
270
  ref={forwardedRef}
271
+ selectable={_selectable}
272
+ selectionColor={selectionColor}
273
+ style={style}
266
274
  />
267
275
  </TextAncestor.Provider>
268
276
  );
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @flow strict
3
+ * @format
4
+ */
5
+
6
+ declare module 'ansi-regex' {
7
+ declare export type Options = {
8
+ /**
9
+ * Match only the first ANSI escape.
10
+ */
11
+ +onlyFirst?: boolean,
12
+ };
13
+ declare export default function ansiRegex(options?: Options): RegExp;
14
+ }
package/overrides.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "**/__snapshots__/**",
8
8
  "src/rntypes/**"
9
9
  ],
10
- "baseVersion": "0.71.6",
10
+ "baseVersion": "0.71.12",
11
11
  "overrides": [
12
12
  {
13
13
  "type": "derived",
@@ -113,11 +113,7 @@
113
113
  "type": "derived",
114
114
  "file": "src/Libraries/Components/TextInput/TextInput.win32.js",
115
115
  "baseFile": "Libraries/Components/TextInput/TextInput.js",
116
- "baseHash": "b59411676fb68eb715dc9b33991accf7f5ec4bbe"
117
- },
118
- {
119
- "type": "platform",
120
- "file": "src/Libraries/Components/TextInput/Win32TextInputNativeComponent.js"
116
+ "baseHash": "e5845da364f14fff72c9580123c41279eb493db4"
121
117
  },
122
118
  {
123
119
  "type": "patch",
@@ -125,6 +121,10 @@
125
121
  "baseFile": "Libraries/Components/TextInput/TextInputState.js",
126
122
  "baseHash": "60655baaca427e1c7c1b8884833b848335c4033b"
127
123
  },
124
+ {
125
+ "type": "platform",
126
+ "file": "src/Libraries/Components/TextInput/Win32TextInputNativeComponent.js"
127
+ },
128
128
  {
129
129
  "type": "copy",
130
130
  "file": "src/Libraries/Components/ToastAndroid/ToastAndroid.win32.js",
@@ -177,7 +177,7 @@
177
177
  "type": "patch",
178
178
  "file": "src/Libraries/Components/View/View.win32.js",
179
179
  "baseFile": "Libraries/Components/View/View.js",
180
- "baseHash": "91864d8f5518fa50da710f545ecdf5727248c45a"
180
+ "baseHash": "7945214eb22374ea322b95d12cf8d68a4cf321e4"
181
181
  },
182
182
  {
183
183
  "type": "derived",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-iss/react-native-win32",
3
- "version": "0.71.10",
3
+ "version": "0.71.12",
4
4
  "description": "Implementation of react native on top of Office's Win32 platform.",
5
5
  "license": "MIT",
6
6
  "main": "./index.win32.js",
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.0.0",
23
23
  "@jest/create-cache-key-function": "^29.2.1",
24
- "@react-native-community/cli": "10.2.2",
24
+ "@react-native-community/cli": "10.2.4",
25
25
  "@react-native-community/cli-platform-android": "10.2.0",
26
- "@react-native-community/cli-platform-ios": "10.2.1",
26
+ "@react-native-community/cli-platform-ios": "10.2.4",
27
27
  "@react-native/assets": "1.0.0",
28
28
  "@react-native/normalize-color": "2.1.0",
29
29
  "@react-native/polyfills": "2.0.0",
@@ -36,9 +36,9 @@
36
36
  "invariant": "^2.2.4",
37
37
  "jest-environment-node": "^29.2.1",
38
38
  "memoize-one": "^5.0.0",
39
- "metro-react-native-babel-transformer": "0.73.9",
40
- "metro-runtime": "0.73.9",
41
- "metro-source-map": "0.73.9",
39
+ "metro-react-native-babel-transformer": "0.73.10",
40
+ "metro-runtime": "0.73.10",
41
+ "metro-source-map": "0.73.10",
42
42
  "mkdirp": "^0.5.1",
43
43
  "nullthrows": "^1.1.1",
44
44
  "pretty-format": "^26.5.2",
@@ -73,7 +73,7 @@
73
73
  "just-scripts": "^1.3.3",
74
74
  "prettier": "^2.4.1",
75
75
  "react": "18.2.0",
76
- "react-native": "0.71.6",
76
+ "react-native": "0.71.12",
77
77
  "react-native-platform-override": "^1.8.3",
78
78
  "typescript": "^4.9.5"
79
79
  },
@@ -82,7 +82,7 @@
82
82
  "react-native": "^0.71.0"
83
83
  },
84
84
  "beachball": {
85
- "defaultNpmTag": "latest",
85
+ "defaultNpmTag": "v0.71-stable",
86
86
  "disallowedChangeTypes": [
87
87
  "major",
88
88
  "minor",