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.
@@ -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
  );
@@ -10,17 +10,16 @@
10
10
  */
11
11
 
12
12
  import type {PressEvent} from '../Types/CoreEventTypes';
13
+ import type {TextProps} from './TextProps';
13
14
 
14
15
  import * as PressabilityDebug from '../Pressability/PressabilityDebug';
15
16
  import usePressability from '../Pressability/usePressability';
16
17
  import flattenStyle from '../StyleSheet/flattenStyle';
17
18
  import processColor from '../StyleSheet/processColor';
18
- import StyleSheet from '../StyleSheet/StyleSheet';
19
19
  import {getAccessibilityRoleFromRole} from '../Utilities/AcessibilityMapping';
20
20
  import Platform from '../Utilities/Platform';
21
21
  import TextAncestor from './TextAncestor';
22
22
  import {NativeText, NativeVirtualText} from './TextNativeComponent';
23
- import {type TextProps} from './TextProps';
24
23
  import * as React from 'react';
25
24
  import {useContext, useMemo, useState} from 'react';
26
25
 
@@ -40,6 +39,7 @@ const Text: React.AbstractComponent<
40
39
  accessible,
41
40
  accessibilityLabel,
42
41
  accessibilityRole,
42
+ accessibilityState,
43
43
  allowFontScaling,
44
44
  'aria-busy': ariaBusy,
45
45
  'aria-checked': ariaChecked,
@@ -68,13 +68,23 @@ const Text: React.AbstractComponent<
68
68
 
69
69
  const [isHighlighted, setHighlighted] = useState(false);
70
70
 
71
- const _accessibilityState = {
72
- busy: ariaBusy ?? props.accessibilityState?.busy,
73
- checked: ariaChecked ?? props.accessibilityState?.checked,
74
- disabled: ariaDisabled ?? props.accessibilityState?.disabled,
75
- expanded: ariaExpanded ?? props.accessibilityState?.expanded,
76
- selected: ariaSelected ?? props.accessibilityState?.selected,
77
- };
71
+ let _accessibilityState;
72
+ if (
73
+ accessibilityState != null ||
74
+ ariaBusy != null ||
75
+ ariaChecked != null ||
76
+ ariaDisabled != null ||
77
+ ariaExpanded != null ||
78
+ ariaSelected != null
79
+ ) {
80
+ _accessibilityState = {
81
+ busy: ariaBusy ?? accessibilityState?.busy,
82
+ checked: ariaChecked ?? accessibilityState?.checked,
83
+ disabled: ariaDisabled ?? accessibilityState?.disabled,
84
+ expanded: ariaExpanded ?? accessibilityState?.expanded,
85
+ selected: ariaSelected ?? accessibilityState?.selected,
86
+ };
87
+ }
78
88
 
79
89
  const _disabled =
80
90
  restProps.disabled != null
@@ -178,25 +188,11 @@ const Text: React.AbstractComponent<
178
188
  ? null
179
189
  : processColor(restProps.selectionColor);
180
190
 
181
- let style = flattenStyle(restProps.style);
182
-
183
- let _selectable = restProps.selectable;
184
- if (style?.userSelect != null) {
185
- _selectable = userSelectToSelectableMap[style.userSelect];
186
- }
187
-
188
- if (style?.verticalAlign != null) {
189
- style = StyleSheet.compose(style, {
190
- textAlignVertical:
191
- verticalAlignToTextAlignVerticalMap[style.verticalAlign],
192
- });
193
- }
191
+ let style = restProps.style;
194
192
 
195
193
  if (__DEV__) {
196
194
  if (PressabilityDebug.isEnabled() && onPress != null) {
197
- style = StyleSheet.compose(restProps.style, {
198
- color: 'magenta',
199
- });
195
+ style = [restProps.style, {color: 'magenta'}];
200
196
  }
201
197
  }
202
198
 
@@ -216,10 +212,22 @@ const Text: React.AbstractComponent<
216
212
  default: accessible,
217
213
  });
218
214
 
219
- let flattenedStyle = flattenStyle(style);
215
+ style = flattenStyle(style);
216
+
217
+ if (typeof style?.fontWeight === 'number') {
218
+ style.fontWeight = style?.fontWeight.toString();
219
+ }
220
+
221
+ let _selectable = restProps.selectable;
222
+ if (style?.userSelect != null) {
223
+ _selectable = userSelectToSelectableMap[style.userSelect];
224
+ delete style.userSelect;
225
+ }
220
226
 
221
- if (typeof flattenedStyle?.fontWeight === 'number') {
222
- flattenedStyle.fontWeight = flattenedStyle?.fontWeight.toString();
227
+ if (style?.verticalAlign != null) {
228
+ style.textAlignVertical =
229
+ verticalAlignToTextAlignVerticalMap[style.verticalAlign];
230
+ delete style.verticalAlign;
223
231
  }
224
232
 
225
233
  const _hasOnPressOrOnLongPress =
@@ -229,24 +237,32 @@ const Text: React.AbstractComponent<
229
237
  return (
230
238
  <NativeVirtualText
231
239
  {...restProps}
232
- accessibilityState={_accessibilityState}
233
240
  {...eventHandlersForText}
234
241
  accessibilityLabel={ariaLabel ?? accessibilityLabel}
235
242
  accessibilityRole={
236
243
  role ? getAccessibilityRoleFromRole(role) : accessibilityRole
237
244
  }
245
+ accessibilityState={_accessibilityState}
246
+ accessible={
247
+ accessible == null && Platform.OS === 'android'
248
+ ? _hasOnPressOrOnLongPress
249
+ : _accessible
250
+ }
251
+ allowFontScaling={allowFontScaling !== false}
252
+ disabled={_disabled}
253
+ ellipsizeMode={ellipsizeMode ?? 'tail'}
238
254
  isHighlighted={isHighlighted}
239
255
  isPressable={isPressable}
240
- selectable={_selectable}
241
256
  nativeID={id ?? nativeID}
242
257
  numberOfLines={numberOfLines}
243
- selectionColor={selectionColor}
244
- style={flattenedStyle}
245
258
  ref={forwardedRef}
259
+ selectable={_selectable}
260
+ selectionColor={selectionColor}
261
+ style={style}
246
262
  />
247
263
  );
248
264
  } else {
249
- let styleProps: ViewStyleProp = (restProps.style: any);
265
+ let styleProps: ViewStyleProp = style;
250
266
  if (
251
267
  styleProps &&
252
268
  styleProps.borderColor &&
@@ -259,7 +275,7 @@ const Text: React.AbstractComponent<
259
275
  styleProps.borderTopWidth)
260
276
  ) {
261
277
  let textStyleProps = Array.isArray(styleProps)
262
- ? StyleSheet.flatten(styleProps)
278
+ ? flattenStyle(styleProps)
263
279
  : styleProps;
264
280
  let {
265
281
  margin,
@@ -290,26 +306,26 @@ const Text: React.AbstractComponent<
290
306
  <NativeText
291
307
  {...textPropsLessStyle}
292
308
  {...eventHandlersForText}
293
- disabled={_disabled}
294
- selectable={_selectable}
309
+ accessibilityLabel={ariaLabel ?? accessibilityLabel}
310
+ accessibilityRole={
311
+ role ? getAccessibilityRoleFromRole(role) : accessibilityRole
312
+ }
313
+ accessibilityState={nativeTextAccessibilityState}
295
314
  accessible={
296
315
  accessible == null && Platform.OS === 'android'
297
316
  ? _hasOnPressOrOnLongPress
298
317
  : _accessible
299
318
  }
300
- accessibilityLabel={ariaLabel ?? accessibilityLabel}
301
- accessibilityState={nativeTextAccessibilityState}
302
- accessibilityRole={
303
- role ? getAccessibilityRoleFromRole(role) : accessibilityRole
304
- }
305
319
  allowFontScaling={allowFontScaling !== false}
320
+ disabled={_disabled}
306
321
  ellipsizeMode={ellipsizeMode ?? 'tail'}
307
322
  isHighlighted={isHighlighted}
308
323
  nativeID={id ?? nativeID}
309
324
  numberOfLines={numberOfLines}
325
+ ref={forwardedRef}
326
+ selectable={_selectable}
310
327
  selectionColor={selectionColor}
311
328
  style={((rest: any): TextStyleProp)}
312
- ref={forwardedRef}
313
329
  />
314
330
  </TextAncestor.Provider>
315
331
  </View>
@@ -320,26 +336,26 @@ const Text: React.AbstractComponent<
320
336
  <NativeText
321
337
  {...restProps}
322
338
  {...eventHandlersForText}
323
- disabled={_disabled}
324
- selectable={_selectable}
339
+ accessibilityLabel={ariaLabel ?? accessibilityLabel}
340
+ accessibilityRole={
341
+ role ? getAccessibilityRoleFromRole(role) : accessibilityRole
342
+ }
343
+ accessibilityState={nativeTextAccessibilityState}
325
344
  accessible={
326
345
  accessible == null && Platform.OS === 'android'
327
346
  ? _hasOnPressOrOnLongPress
328
347
  : _accessible
329
348
  }
330
- accessibilityLabel={ariaLabel ?? accessibilityLabel}
331
- accessibilityState={nativeTextAccessibilityState}
332
- accessibilityRole={
333
- role ? getAccessibilityRoleFromRole(role) : accessibilityRole
334
- }
335
349
  allowFontScaling={allowFontScaling !== false}
350
+ disabled={_disabled}
336
351
  ellipsizeMode={ellipsizeMode ?? 'tail'}
337
352
  isHighlighted={isHighlighted}
338
353
  nativeID={id ?? nativeID}
339
354
  numberOfLines={numberOfLines}
340
- selectionColor={selectionColor}
341
- style={flattenedStyle}
342
355
  ref={forwardedRef}
356
+ selectable={_selectable}
357
+ selectionColor={selectionColor}
358
+ style={style}
343
359
  />
344
360
  </TextAncestor.Provider>
345
361
  );
@@ -51,6 +51,28 @@
51
51
  INTERNAL_REACT_RECOMPOSER_4( \
52
52
  (__VA_ARGS__, INTERNAL_REACT_MODULE_3_ARGS, INTERNAL_REACT_MODULE_2_ARGS, INTERNAL_REACT_MODULE_1_ARG, ))
53
53
 
54
+ // Another version of REACT_MODULE but does not do auto registration
55
+ #define INTERNAL_REACT_MODULE_NOREG_3_ARGS(moduleStruct, moduleName, eventEmitterName) \
56
+ struct moduleStruct; \
57
+ template <class TRegistry> \
58
+ constexpr void GetReactModuleInfo(moduleStruct *, TRegistry &registry) noexcept { \
59
+ registry.RegisterModule( \
60
+ moduleName, eventEmitterName, winrt::Microsoft::ReactNative::ReactAttributeId<__COUNTER__>{}); \
61
+ }
62
+
63
+ #define INTERNAL_REACT_MODULE_NOREG_2_ARGS(moduleStruct, moduleName) \
64
+ INTERNAL_REACT_MODULE_NOREG_3_ARGS(moduleStruct, moduleName, L"")
65
+
66
+ #define INTERNAL_REACT_MODULE_NOREG_1_ARG(moduleStruct) \
67
+ INTERNAL_REACT_MODULE_NOREG_2_ARGS(moduleStruct, L## #moduleStruct)
68
+
69
+ #define INTERNAL_REACT_MODULE_NOREG(...) \
70
+ INTERNAL_REACT_RECOMPOSER_4( \
71
+ (__VA_ARGS__, \
72
+ INTERNAL_REACT_MODULE_NOREG_3_ARGS, \
73
+ INTERNAL_REACT_MODULE_NOREG_2_ARGS, \
74
+ INTERNAL_REACT_MODULE_NOREG_1_ARG, ))
75
+
54
76
  // Provide meta data information about struct member.
55
77
  // For each member with a 'custom attribute' macro we create a static method to provide meta data.
56
78
  // The member Id is generated as a ReactMemberId<__COUNTER__> type.
@@ -62,7 +84,7 @@
62
84
  visitor.Visit( \
63
85
  &TStruct::member, \
64
86
  attributeId, \
65
- winrt::Microsoft::ReactNative::React##memberKind##Attribute{jsMemberName, jsModuleName}); \
87
+ winrt::Microsoft::ReactNative::React##memberKind##Attribute(jsMemberName, jsModuleName)); \
66
88
  }
67
89
 
68
90
  #define INTERNAL_REACT_MEMBER_3_ARGS(memberKind, member, jsMemberName) \
@@ -30,6 +30,11 @@
30
30
  #define REACT_MODULE(/* moduleStruct, [opt] moduleName, [opt] eventEmitterName */...) \
31
31
  INTERNAL_REACT_MODULE(__VA_ARGS__)(__VA_ARGS__)
32
32
 
33
+ // REACT_MODULE_NOREG is REACT_MODULE without auto registration
34
+ // they have the same arguments
35
+ #define REACT_MODULE_NOREG(/* moduleStruct, [opt] moduleName, [opt] eventEmitterName */...) \
36
+ INTERNAL_REACT_MODULE_NOREG(__VA_ARGS__)(__VA_ARGS__)
37
+
33
38
  // REACT_INIT(method)
34
39
  // Arguments:
35
40
  // - method (required) - the method name the macro is attached to.
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.71.21</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.71.23</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>71</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>21</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>23</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>558faa07e799af7b36c2654a505161ae152b2c36</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>6e285ab254f6c38e4bc8a84fc338a42671c37239</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.71.21",
3
+ "version": "0.71.23",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,10 +23,10 @@
23
23
  "dependencies": {
24
24
  "@babel/runtime": "^7.0.0",
25
25
  "@jest/create-cache-key-function": "^29.2.1",
26
- "@react-native-community/cli": "10.2.2",
26
+ "@react-native-community/cli": "10.2.4",
27
27
  "@react-native-community/cli-platform-android": "10.2.0",
28
- "@react-native-community/cli-platform-ios": "10.2.1",
29
- "@react-native-windows/cli": "0.71.10",
28
+ "@react-native-community/cli-platform-ios": "10.2.4",
29
+ "@react-native-windows/cli": "0.71.11",
30
30
  "@react-native/assets": "1.0.0",
31
31
  "@react-native/normalize-color": "2.1.0",
32
32
  "@react-native/polyfills": "2.0.0",
@@ -38,9 +38,9 @@
38
38
  "invariant": "^2.2.4",
39
39
  "jest-environment-node": "^29.2.1",
40
40
  "memoize-one": "^5.0.0",
41
- "metro-react-native-babel-transformer": "0.73.9",
42
- "metro-runtime": "0.73.9",
43
- "metro-source-map": "0.73.9",
41
+ "metro-react-native-babel-transformer": "0.73.10",
42
+ "metro-runtime": "0.73.10",
43
+ "metro-source-map": "0.73.10",
44
44
  "mkdirp": "^0.5.1",
45
45
  "nullthrows": "^1.1.1",
46
46
  "pretty-format": "^26.5.2",
@@ -72,10 +72,10 @@
72
72
  "flow-bin": "^0.191.0",
73
73
  "jscodeshift": "^0.13.1",
74
74
  "just-scripts": "^1.3.3",
75
- "metro-config": "0.73.9",
75
+ "metro-config": "0.73.10",
76
76
  "prettier": "^2.4.1",
77
77
  "react": "18.2.0",
78
- "react-native": "0.71.6",
78
+ "react-native": "0.71.12",
79
79
  "react-native-platform-override": "^1.8.3",
80
80
  "react-refresh": "^0.4.0",
81
81
  "typescript": "^4.9.5"