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

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.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,46 @@
2
2
  "name": "@office-iss/react-native-win32",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 21 Jun 2024 05:16:45 GMT",
5
+ "date": "Wed, 10 Jul 2024 05:13:25 GMT",
6
+ "version": "0.0.0-canary.256",
7
+ "tag": "@office-iss/react-native-win32_v0.0.0-canary.256",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "yajurgrover24@gmail.com",
12
+ "package": "@office-iss/react-native-win32",
13
+ "commit": "8a91af57691e38ed9ee537ec5a7aaa74f8bae1eb",
14
+ "comment": "Integrate 6/13"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@office-iss/react-native-win32",
19
+ "comment": "Bump @rnw-scripts/eslint-config to v1.2.24",
20
+ "commit": "not available"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@office-iss/react-native-win32",
25
+ "comment": "Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.28",
26
+ "commit": "not available"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@office-iss/react-native-win32",
31
+ "comment": "Bump @rnw-scripts/just-task to v2.3.41",
32
+ "commit": "not available"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@office-iss/react-native-win32",
37
+ "comment": "Bump react-native-platform-override to v1.9.43",
38
+ "commit": "not available"
39
+ }
40
+ ]
41
+ }
42
+ },
43
+ {
44
+ "date": "Fri, 21 Jun 2024 05:17:50 GMT",
6
45
  "version": "0.0.0-canary.255",
7
46
  "tag": "@office-iss/react-native-win32_v0.0.0-canary.255",
8
47
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,17 +1,29 @@
1
1
  # Change Log - @office-iss/react-native-win32
2
2
 
3
- This log was last generated on Fri, 21 Jun 2024 05:16:45 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 10 Jul 2024 05:13:25 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.0.0-canary.255
7
+ ## 0.0.0-canary.256
8
8
 
9
- Fri, 21 Jun 2024 05:16:45 GMT
9
+ Wed, 10 Jul 2024 05:13:25 GMT
10
10
 
11
11
  ### Changes
12
12
 
13
- - Bump react-native-platform-override to v1.9.42
13
+ - Integrate 6/13 (yajurgrover24@gmail.com)
14
+ - Bump @rnw-scripts/eslint-config to v1.2.24
15
+ - Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.28
16
+ - Bump @rnw-scripts/just-task to v2.3.41
17
+ - Bump react-native-platform-override to v1.9.43
14
18
 
19
+ ## 0.0.0-canary.255
20
+
21
+ Fri, 21 Jun 2024 05:17:50 GMT
22
+
23
+ ### Changes
24
+
25
+ - Bump react-native-platform-override to v1.9.42
26
+
15
27
  ## 0.0.0-canary.254
16
28
 
17
29
  Wed, 12 Jun 2024 05:16:24 GMT
@@ -8,11 +8,13 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
11
12
  import StyleSheet, {
12
13
  type ColorValue,
13
14
  type ViewStyleProp,
14
15
  } from '../../StyleSheet/StyleSheet';
15
16
  import Platform from '../../Utilities/Platform';
17
+ import useWindowDimensions from '../../Utilities/useWindowDimensions';
16
18
  import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent';
17
19
  import * as React from 'react';
18
20
 
@@ -86,6 +88,8 @@ type Props = $ReadOnly<{|
86
88
  |}>;
87
89
 
88
90
  const InputAccessoryView: React.AbstractComponent<Props> = (props: Props) => {
91
+ const {width} = useWindowDimensions();
92
+
89
93
  if (Platform.OS === 'ios') {
90
94
  if (React.Children.count(props.children) === 0) {
91
95
  return null;
@@ -96,7 +100,9 @@ const InputAccessoryView: React.AbstractComponent<Props> = (props: Props) => {
96
100
  style={[props.style, styles.container]}
97
101
  nativeID={props.nativeID}
98
102
  backgroundColor={props.backgroundColor}>
99
- {props.children}
103
+ <SafeAreaView style={[styles.safeAreaView, {width}]}>
104
+ {props.children}
105
+ </SafeAreaView>
100
106
  </RCTInputAccessoryViewNativeComponent>
101
107
  );
102
108
  } else {
@@ -109,6 +115,9 @@ const styles = StyleSheet.create({
109
115
  container: {
110
116
  position: 'absolute',
111
117
  },
118
+ safeAreaView: {
119
+ flex: 1,
120
+ },
112
121
  });
113
122
 
114
123
  export default InputAccessoryView;
@@ -136,11 +136,11 @@ export type AccessibilityActionEvent = SyntheticEvent<
136
136
  >;
137
137
 
138
138
  export type AccessibilityState = {
139
- disabled?: boolean,
140
- selected?: boolean,
139
+ disabled?: ?boolean,
140
+ selected?: ?boolean,
141
141
  checked?: ?boolean | 'mixed',
142
- busy?: boolean,
143
- expanded?: boolean,
142
+ busy?: ?boolean,
143
+ expanded?: ?boolean,
144
144
  ...
145
145
  };
146
146
 
@@ -147,13 +147,13 @@ export type AccessibilityActionEvent = SyntheticEvent<
147
147
  >;
148
148
 
149
149
  export type AccessibilityState = {
150
- disabled?: boolean,
151
- selected?: boolean,
150
+ disabled?: ?boolean,
151
+ selected?: ?boolean,
152
152
  checked?: ?boolean | 'mixed',
153
- busy?: boolean,
154
- expanded?: boolean,
155
- multiselectable?: boolean, // Win32
156
- required?: boolean, // Win32
153
+ busy?: ?boolean,
154
+ expanded?: ?boolean,
155
+ multiselectable?: ?boolean, // Win32
156
+ required?: ?boolean, // Win32
157
157
  ...
158
158
  };
159
159
 
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 75,
19
19
  patch: 0,
20
- prerelease: 'nightly-20240610-ced076210',
20
+ prerelease: 'nightly-20240613-f7aea0c8e',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -59,6 +59,22 @@ type AndroidImageProps = $ReadOnly<{|
59
59
  loadingIndicatorSource?: ?(number | $ReadOnly<{|uri: string|}>),
60
60
  progressiveRenderingEnabled?: ?boolean,
61
61
  fadeDuration?: ?number,
62
+
63
+ /**
64
+ * The mechanism that should be used to resize the image when the image's
65
+ * dimensions differ from the image view's dimensions. Defaults to `'auto'`.
66
+ * See https://reactnative.dev/docs/image#resizemethod-android
67
+ */
68
+ resizeMethod?: ?('auto' | 'resize' | 'scale'),
69
+
70
+ /**
71
+ * When the `resizeMethod` is set to `resize`, the destination dimensions are
72
+ * multiplied by this value. The `scale` method is used to perform the
73
+ * remainder of the resize.
74
+ * This is used to produce higher quality images when resizing to small dimensions.
75
+ * Defaults to 1.0.
76
+ */
77
+ resizeMultiplier?: ?number,
62
78
  |}>;
63
79
 
64
80
  export type ImageProps = {|
@@ -183,11 +199,6 @@ export type ImageProps = {|
183
199
  */
184
200
  onLoadStart?: ?() => void,
185
201
 
186
- /**
187
- * See https://reactnative.dev/docs/image#resizemethod
188
- */
189
- resizeMethod?: ?('auto' | 'resize' | 'scale'),
190
-
191
202
  /**
192
203
  * The image source (either a remote URL or a local file resource).
193
204
  *
@@ -82,13 +82,14 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
82
82
  validAttributes: {
83
83
  blurRadius: true,
84
84
  internal_analyticTag: true,
85
+ resizeMethod: true,
85
86
  resizeMode: true,
87
+ resizeMultiplier: true,
86
88
  tintColor: {
87
89
  process: require('../StyleSheet/processColor').default,
88
90
  },
89
91
  borderBottomLeftRadius: true,
90
92
  borderTopLeftRadius: true,
91
- resizeMethod: true,
92
93
  src: true,
93
94
  // NOTE: New Architecture expects this to be called `source`,
94
95
  // regardless of the platform, therefore propagate it as well.
@@ -462,7 +462,7 @@ export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {|
462
462
  }
463
463
  }
464
464
 
465
- if (componentStack.length === 0) {
465
+ if (componentStack.length === 0 && argsWithoutComponentStack.length === 0) {
466
466
  // Try finding the component stack elsewhere.
467
467
  for (const arg of args) {
468
468
  if (typeof arg === 'string' && isComponentStack(arg)) {
@@ -5,9 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @noformat
8
- * @flow
9
8
  * @nolint
10
- * @generated SignedSource<<c1cc197c110e3a49a5e8f6bd5d32b23f>>
9
+ * @flow
10
+ * @generated SignedSource<<bb39e39880fecbf572b5f8e7c2a95c5d>>
11
11
  */
12
12
 
13
13
  'use strict';
@@ -5,9 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @noformat
8
- * @flow strict-local
9
8
  * @nolint
10
- * @generated SignedSource<<2881c8e89ef0f73f4cf6612cb518b197>>
9
+ * @flow strict-local
10
+ * @generated SignedSource<<b1b5e34e426103a69612278fd5c9f77c>>
11
11
  */
12
12
 
13
13
  'use strict';
@@ -5,11 +5,10 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @noformat
8
- * @flow
9
8
  * @nolint
10
- * @generated SignedSource<<0debd6e5a17dc037cb4661315a886de6>>
9
+ * @flow
10
+ * @generated SignedSource<<475c7d864efc2948c6125ddb8a38a4fc>>
11
11
  */
12
-
13
12
  'use strict';
14
13
 
15
14
  import type {ReactNativeType} from './ReactNativeTypes';
@@ -5,9 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @noformat
8
- * @flow strict
9
8
  * @nolint
10
- * @generated SignedSource<<c41f61379973354629ee7bf55ba92541>>
9
+ * @flow strict
10
+ * @generated SignedSource<<e7a1421518e1d99f18c5b14e85f44843>>
11
11
  */
12
12
 
13
13
  import type {ElementRef, ElementType, Element, AbstractComponent} from 'react';
@@ -5,9 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @noformat
8
- * @flow strict-local
9
8
  * @nolint
10
- * @generated SignedSource<<73af5b3fe29d226634ed64bc861634df>>
9
+ * @flow strict-local
10
+ * @generated SignedSource<<69d0cc554d77cddb1c779dfbdf569505>>
11
11
  */
12
12
 
13
13
  'use strict';
@@ -5,9 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @noformat
8
- * @flow strict-local
9
8
  * @nolint
10
- * @generated SignedSource<<ede54ac2fa1b9a09e234cdf098048989>>
9
+ * @flow strict-local
10
+ * @generated SignedSource<<62e766b69d440dab0a2d249f0cea38e0>>
11
11
  */
12
12
 
13
13
  'use strict';
@@ -61,33 +61,38 @@ const Text: React.AbstractComponent<
61
61
 
62
62
  const [isHighlighted, setHighlighted] = useState(false);
63
63
 
64
- let _accessibilityState;
64
+ const _accessibilityLabel = ariaLabel ?? accessibilityLabel;
65
+
66
+ let _accessibilityState: ?TextProps['accessibilityState'] =
67
+ accessibilityState;
65
68
  if (
66
- accessibilityState != null ||
67
69
  ariaBusy != null ||
68
70
  ariaChecked != null ||
69
71
  ariaDisabled != null ||
70
72
  ariaExpanded != null ||
71
73
  ariaSelected != null
72
74
  ) {
73
- _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
- };
75
+ if (_accessibilityState != null) {
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
+ } else {
84
+ _accessibilityState = {
85
+ busy: ariaBusy,
86
+ checked: ariaChecked,
87
+ disabled: ariaDisabled,
88
+ expanded: ariaExpanded,
89
+ selected: ariaSelected,
90
+ };
91
+ }
80
92
  }
81
93
 
82
- const _disabled =
83
- restProps.disabled != null
84
- ? restProps.disabled
85
- : _accessibilityState?.disabled;
86
-
87
- const nativeTextAccessibilityState =
88
- _disabled !== _accessibilityState?.disabled
89
- ? {..._accessibilityState, disabled: _disabled}
90
- : _accessibilityState;
94
+ const _accessibilityStateDisabled = _accessibilityState?.disabled;
95
+ const _disabled = restProps.disabled ?? _accessibilityStateDisabled;
91
96
 
92
97
  const isPressable =
93
98
  (onPress != null ||
@@ -96,41 +101,47 @@ const Text: React.AbstractComponent<
96
101
  _disabled !== true;
97
102
 
98
103
  const initialized = useLazyInitialization(isPressable);
99
- const config = useMemo(
100
- () =>
101
- initialized
102
- ? {
103
- disabled: !isPressable,
104
- pressRectOffset: pressRetentionOffset,
105
- onLongPress,
106
- onPress,
107
- onPressIn(event: PressEvent) {
108
- // Updating isHighlighted causes unnecessary re-renders for platforms that don't use it
109
- // in the best case, and cause issues with text selection in the worst case. Forcing
110
- // the isHighlighted prop to false on all platforms except iOS.
111
- setHighlighted(
112
- (suppressHighlighting == null || !suppressHighlighting) &&
113
- Platform.OS === 'ios',
114
- );
115
- onPressIn?.(event);
116
- },
117
- onPressOut(event: PressEvent) {
118
- setHighlighted(false);
119
- onPressOut?.(event);
120
- },
121
- }
122
- : null,
123
- [
124
- initialized,
125
- isPressable,
126
- pressRetentionOffset,
104
+ const config = useMemo(() => {
105
+ if (!initialized) {
106
+ return null;
107
+ }
108
+
109
+ let _onPressIn = onPressIn;
110
+ let _onPressOut = onPressOut;
111
+
112
+ // Updating isHighlighted causes unnecessary re-renders for platforms that don't use it
113
+ // in the best case, and cause issues with text selection in the worst case. Forcing
114
+ // the isHighlighted prop to false on all platforms except iOS.
115
+ if (Platform.OS === 'ios') {
116
+ _onPressIn = (event: PressEvent) => {
117
+ setHighlighted(suppressHighlighting == null || !suppressHighlighting);
118
+ onPressIn?.(event);
119
+ };
120
+
121
+ _onPressOut = (event: PressEvent) => {
122
+ setHighlighted(false);
123
+ onPressOut?.(event);
124
+ };
125
+ }
126
+
127
+ return {
128
+ disabled: !isPressable,
129
+ pressRectOffset: pressRetentionOffset,
127
130
  onLongPress,
128
131
  onPress,
129
- onPressIn,
130
- onPressOut,
131
- suppressHighlighting,
132
- ],
133
- );
132
+ onPressIn: _onPressIn,
133
+ onPressOut: _onPressOut,
134
+ };
135
+ }, [
136
+ initialized,
137
+ isPressable,
138
+ pressRetentionOffset,
139
+ onLongPress,
140
+ onPress,
141
+ onPressIn,
142
+ onPressOut,
143
+ suppressHighlighting,
144
+ ]);
134
145
 
135
146
  const eventHandlers = usePressability(config);
136
147
  const eventHandlersForText = useMemo(
@@ -190,7 +201,6 @@ const Text: React.AbstractComponent<
190
201
  : processColor(restProps.selectionColor);
191
202
 
192
203
  let style = restProps.style;
193
-
194
204
  if (__DEV__) {
195
205
  if (PressabilityDebug.isEnabled() && onPress != null) {
196
206
  style = [restProps.style, {color: 'magenta'}];
@@ -205,82 +215,88 @@ const Text: React.AbstractComponent<
205
215
  numberOfLines = 0;
206
216
  }
207
217
 
208
- const hasTextAncestor = useContext(TextAncestor);
218
+ let _selectable = restProps.selectable;
209
219
 
210
- const _accessible = Platform.select({
211
- ios: accessible !== false,
212
- default: accessible,
213
- });
220
+ const processedStyle = flattenStyle(style);
221
+ if (processedStyle != null) {
222
+ if (typeof processedStyle.fontWeight === 'number') {
223
+ // $FlowFixMe[cannot-write]
224
+ processedStyle.fontWeight = processedStyle.fontWeight.toString();
225
+ }
214
226
 
215
- // $FlowFixMe[underconstrained-implicit-instantiation]
216
- style = flattenStyle(style);
227
+ if (processedStyle.userSelect != null) {
228
+ _selectable = userSelectToSelectableMap[processedStyle.userSelect];
229
+ // $FlowFixMe[cannot-write]
230
+ delete processedStyle.userSelect;
231
+ }
217
232
 
218
- if (typeof style?.fontWeight === 'number') {
219
- // $FlowFixMe[prop-missing]
220
- // $FlowFixMe[cannot-write]
221
- style.fontWeight = style?.fontWeight.toString();
233
+ if (processedStyle.verticalAlign != null) {
234
+ // $FlowFixMe[cannot-write]
235
+ processedStyle.textAlignVertical =
236
+ verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign];
237
+ // $FlowFixMe[cannot-write]
238
+ delete processedStyle.verticalAlign;
239
+ }
222
240
  }
223
241
 
224
- let _selectable = restProps.selectable;
225
- if (style?.userSelect != null) {
226
- // $FlowFixMe[invalid-computed-prop]
227
- _selectable = userSelectToSelectableMap[style.userSelect];
228
- // $FlowFixMe[prop-missing]
229
- // $FlowFixMe[cannot-write]
230
- delete style.userSelect;
242
+ const _nativeID = id ?? nativeID;
243
+
244
+ const hasTextAncestor = useContext(TextAncestor);
245
+ if (hasTextAncestor) {
246
+ return (
247
+ <NativeVirtualText
248
+ {...restProps}
249
+ {...eventHandlersForText}
250
+ accessibilityLabel={_accessibilityLabel}
251
+ accessibilityState={_accessibilityState}
252
+ isHighlighted={isHighlighted}
253
+ isPressable={isPressable}
254
+ nativeID={_nativeID}
255
+ numberOfLines={numberOfLines}
256
+ ref={forwardedRef}
257
+ selectable={_selectable}
258
+ selectionColor={selectionColor}
259
+ style={processedStyle}
260
+ />
261
+ );
231
262
  }
232
263
 
233
- if (style?.verticalAlign != null) {
234
- // $FlowFixMe[prop-missing]
235
- // $FlowFixMe[cannot-write]
236
- style.textAlignVertical =
237
- // $FlowFixMe[invalid-computed-prop]
238
- verticalAlignToTextAlignVerticalMap[style.verticalAlign];
239
- // $FlowFixMe[prop-missing]
240
- // $FlowFixMe[cannot-write]
241
- delete style.verticalAlign;
264
+ // If the disabled prop and accessibilityState.disabled are out of sync but not both in
265
+ // falsy states we need to update the accessibilityState object to use the disabled prop.
266
+ if (
267
+ _disabled !== _accessibilityStateDisabled &&
268
+ ((_disabled != null && _disabled !== false) ||
269
+ (_accessibilityStateDisabled != null &&
270
+ _accessibilityStateDisabled !== false))
271
+ ) {
272
+ _accessibilityState = {..._accessibilityState, disabled: _disabled};
242
273
  }
243
274
 
244
- const _hasOnPressOrOnLongPress =
245
- props.onPress != null || props.onLongPress != null;
275
+ const _accessible = Platform.select({
276
+ ios: accessible !== false,
277
+ android:
278
+ accessible == null ? onPress != null || onLongPress != null : accessible,
279
+ default: accessible,
280
+ });
246
281
 
247
- return hasTextAncestor ? (
248
- <NativeVirtualText
249
- {...restProps}
250
- {...eventHandlersForText}
251
- accessibilityLabel={ariaLabel ?? accessibilityLabel}
252
- accessibilityState={_accessibilityState}
253
- isHighlighted={isHighlighted}
254
- isPressable={isPressable}
255
- nativeID={id ?? nativeID}
256
- numberOfLines={numberOfLines}
257
- ref={forwardedRef}
258
- selectable={_selectable}
259
- selectionColor={selectionColor}
260
- style={style}
261
- />
262
- ) : (
282
+ return (
263
283
  <TextAncestor.Provider value={true}>
264
284
  <NativeText
265
285
  {...restProps}
266
286
  {...eventHandlersForText}
267
- accessibilityLabel={ariaLabel ?? accessibilityLabel}
268
- accessibilityState={nativeTextAccessibilityState}
269
- accessible={
270
- accessible == null && Platform.OS === 'android'
271
- ? _hasOnPressOrOnLongPress
272
- : _accessible
273
- }
287
+ accessibilityLabel={_accessibilityLabel}
288
+ accessibilityState={_accessibilityState}
289
+ accessible={_accessible}
274
290
  allowFontScaling={allowFontScaling !== false}
275
291
  disabled={_disabled}
276
292
  ellipsizeMode={ellipsizeMode ?? 'tail'}
277
293
  isHighlighted={isHighlighted}
278
- nativeID={id ?? nativeID}
294
+ nativeID={_nativeID}
279
295
  numberOfLines={numberOfLines}
280
296
  ref={forwardedRef}
281
297
  selectable={_selectable}
282
298
  selectionColor={selectionColor}
283
- style={style}
299
+ style={processedStyle}
284
300
  />
285
301
  </TextAncestor.Provider>
286
302
  );
@@ -75,9 +75,11 @@ const Text: React.AbstractComponent<
75
75
 
76
76
  const [isHighlighted, setHighlighted] = useState(false);
77
77
 
78
- let _accessibilityState;
78
+ const _accessibilityLabel = ariaLabel ?? accessibilityLabel;
79
+
80
+ let _accessibilityState: ?TextProps['accessibilityState'] =
81
+ accessibilityState;
79
82
  if (
80
- accessibilityState != null ||
81
83
  ariaBusy != null ||
82
84
  ariaChecked != null ||
83
85
  ariaDisabled != null ||
@@ -86,27 +88,32 @@ const Text: React.AbstractComponent<
86
88
  ariaRequired != null ||
87
89
  ariaSelected != null
88
90
  ) {
89
- _accessibilityState = {
90
- busy: ariaBusy ?? accessibilityState?.busy,
91
- checked: ariaChecked ?? accessibilityState?.checked,
92
- disabled: ariaDisabled ?? accessibilityState?.disabled,
93
- expanded: ariaExpanded ?? accessibilityState?.expanded,
94
- multiselectable:
95
- ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
96
- required: ariaRequired ?? accessibilityState?.required, // Win32
97
- selected: ariaSelected ?? accessibilityState?.selected,
98
- };
91
+ if (_accessibilityState != null) {
92
+ _accessibilityState = {
93
+ busy: ariaBusy ?? _accessibilityState.busy,
94
+ checked: ariaChecked ?? _accessibilityState.checked,
95
+ disabled: ariaDisabled ?? _accessibilityState.disabled,
96
+ expanded: ariaExpanded ?? _accessibilityState.expanded,
97
+ multiselectable:
98
+ ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
99
+ required: ariaRequired ?? accessibilityState?.required, // Win32
100
+ selected: ariaSelected ?? _accessibilityState.selected,
101
+ };
102
+ } else {
103
+ _accessibilityState = {
104
+ busy: ariaBusy,
105
+ checked: ariaChecked,
106
+ disabled: ariaDisabled,
107
+ expanded: ariaExpanded,
108
+ multiselectable: ariaMultiselectable, // Win32,
109
+ required: ariaRequired, // Win32
110
+ selected: ariaSelected,
111
+ };
112
+ }
99
113
  }
100
114
 
101
- const _disabled =
102
- restProps.disabled != null
103
- ? restProps.disabled
104
- : _accessibilityState?.disabled;
105
-
106
- const nativeTextAccessibilityState =
107
- _disabled !== _accessibilityState?.disabled
108
- ? {..._accessibilityState, disabled: _disabled}
109
- : _accessibilityState;
115
+ const _accessibilityStateDisabled = _accessibilityState?.disabled;
116
+ const _disabled = restProps.disabled ?? _accessibilityStateDisabled;
110
117
 
111
118
  const isPressable =
112
119
  (onPress != null ||
@@ -115,41 +122,47 @@ const Text: React.AbstractComponent<
115
122
  _disabled !== true;
116
123
 
117
124
  const initialized = useLazyInitialization(isPressable);
118
- const config = useMemo(
119
- () =>
120
- initialized
121
- ? {
122
- disabled: !isPressable,
123
- pressRectOffset: pressRetentionOffset,
124
- onLongPress,
125
- onPress,
126
- onPressIn(event: PressEvent) {
127
- // Updating isHighlighted causes unnecessary re-renders for platforms that don't use it
128
- // in the best case, and cause issues with text selection in the worst case. Forcing
129
- // the isHighlighted prop to false on all platforms except iOS.
130
- setHighlighted(
131
- (suppressHighlighting == null || !suppressHighlighting) &&
132
- Platform.OS === 'ios',
133
- );
134
- onPressIn?.(event);
135
- },
136
- onPressOut(event: PressEvent) {
137
- setHighlighted(false);
138
- onPressOut?.(event);
139
- },
140
- }
141
- : null,
142
- [
143
- initialized,
144
- isPressable,
145
- pressRetentionOffset,
125
+ const config = useMemo(() => {
126
+ if (!initialized) {
127
+ return null;
128
+ }
129
+
130
+ let _onPressIn = onPressIn;
131
+ let _onPressOut = onPressOut;
132
+
133
+ // Updating isHighlighted causes unnecessary re-renders for platforms that don't use it
134
+ // in the best case, and cause issues with text selection in the worst case. Forcing
135
+ // the isHighlighted prop to false on all platforms except iOS.
136
+ if (Platform.OS === 'ios') {
137
+ _onPressIn = (event: PressEvent) => {
138
+ setHighlighted(suppressHighlighting == null || !suppressHighlighting);
139
+ onPressIn?.(event);
140
+ };
141
+
142
+ _onPressOut = (event: PressEvent) => {
143
+ setHighlighted(false);
144
+ onPressOut?.(event);
145
+ };
146
+ }
147
+
148
+ return {
149
+ disabled: !isPressable,
150
+ pressRectOffset: pressRetentionOffset,
146
151
  onLongPress,
147
152
  onPress,
148
- onPressIn,
149
- onPressOut,
150
- suppressHighlighting,
151
- ],
152
- );
153
+ onPressIn: _onPressIn,
154
+ onPressOut: _onPressOut,
155
+ };
156
+ }, [
157
+ initialized,
158
+ isPressable,
159
+ pressRetentionOffset,
160
+ onLongPress,
161
+ onPress,
162
+ onPressIn,
163
+ onPressOut,
164
+ suppressHighlighting,
165
+ ]);
153
166
 
154
167
  const eventHandlers = usePressability(config);
155
168
  const eventHandlersForText = useMemo(
@@ -209,7 +222,6 @@ const Text: React.AbstractComponent<
209
222
  : processColor(restProps.selectionColor);
210
223
 
211
224
  let style = restProps.style;
212
-
213
225
  if (__DEV__) {
214
226
  if (PressabilityDebug.isEnabled() && onPress != null) {
215
227
  style = [restProps.style, {color: 'magenta'}];
@@ -224,94 +236,100 @@ const Text: React.AbstractComponent<
224
236
  numberOfLines = 0;
225
237
  }
226
238
 
227
- const hasTextAncestor = useContext(TextAncestor);
239
+ let _selectable = restProps.selectable;
228
240
 
229
- const _accessible = Platform.select({
230
- ios: accessible !== false,
231
- default: accessible,
232
- });
241
+ const processedStyle = flattenStyle(style);
242
+ if (processedStyle != null) {
243
+ if (typeof processedStyle.fontWeight === 'number') {
244
+ // $FlowFixMe[cannot-write]
245
+ processedStyle.fontWeight = processedStyle.fontWeight.toString();
246
+ }
233
247
 
234
- // $FlowFixMe[underconstrained-implicit-instantiation]
235
- style = flattenStyle(style);
248
+ if (processedStyle.userSelect != null) {
249
+ _selectable = userSelectToSelectableMap[processedStyle.userSelect];
250
+ // $FlowFixMe[cannot-write]
251
+ delete processedStyle.userSelect;
252
+ }
236
253
 
237
- if (typeof style?.fontWeight === 'number') {
238
- // $FlowFixMe[prop-missing]
239
- // $FlowFixMe[cannot-write]
240
- style.fontWeight = style?.fontWeight.toString();
254
+ if (processedStyle.verticalAlign != null) {
255
+ // $FlowFixMe[cannot-write]
256
+ processedStyle.textAlignVertical =
257
+ verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign];
258
+ // $FlowFixMe[cannot-write]
259
+ delete processedStyle.verticalAlign;
260
+ }
241
261
  }
242
262
 
243
- let _selectable = restProps.selectable;
244
- if (style?.userSelect != null) {
245
- // $FlowFixMe[invalid-computed-prop]
246
- _selectable = userSelectToSelectableMap[style.userSelect];
247
- // $FlowFixMe[prop-missing]
248
- // $FlowFixMe[cannot-write]
249
- delete style.userSelect;
263
+ const _nativeID = id ?? nativeID;
264
+
265
+ const hasTextAncestor = useContext(TextAncestor);
266
+ if (hasTextAncestor) {
267
+ return (
268
+ <NativeVirtualText
269
+ {...restProps}
270
+ {...eventHandlersForText}
271
+ accessibilityLabel={_accessibilityLabel}
272
+ accessibilityState={_accessibilityState}
273
+ accessibilityControls={ariaControls ?? accessibilityControls} // Win32
274
+ accessibilityDescribedBy={ariaDescribedBy ?? accessibilityDescribedBy} // Win32
275
+ accessibilityDescription={ariaDescription ?? accessibilityDescription} // Win32
276
+ accessibilityLevel={ariaLevel ?? accessibilityLevel} // Win32
277
+ accessibilityPositionInSet={ariaPosinset ?? accessibilityPositionInSet} // Win32
278
+ accessibilitySetSize={ariaSetsize ?? accessibilitySetSize} // Win32
279
+ isHighlighted={isHighlighted}
280
+ isPressable={isPressable}
281
+ nativeID={_nativeID}
282
+ numberOfLines={numberOfLines}
283
+ ref={forwardedRef}
284
+ selectable={_selectable}
285
+ selectionColor={selectionColor}
286
+ style={processedStyle}
287
+ />
288
+ );
250
289
  }
251
290
 
252
- if (style?.verticalAlign != null) {
253
- // $FlowFixMe[prop-missing]
254
- // $FlowFixMe[cannot-write]
255
- style.textAlignVertical =
256
- // $FlowFixMe[invalid-computed-prop]
257
- verticalAlignToTextAlignVerticalMap[style.verticalAlign];
258
- // $FlowFixMe[prop-missing]
259
- // $FlowFixMe[cannot-write]
260
- delete style.verticalAlign;
291
+ // If the disabled prop and accessibilityState.disabled are out of sync but not both in
292
+ // falsy states we need to update the accessibilityState object to use the disabled prop.
293
+ if (
294
+ _disabled !== _accessibilityStateDisabled &&
295
+ ((_disabled != null && _disabled !== false) ||
296
+ (_accessibilityStateDisabled != null &&
297
+ _accessibilityStateDisabled !== false))
298
+ ) {
299
+ _accessibilityState = {..._accessibilityState, disabled: _disabled};
261
300
  }
262
301
 
263
- const _hasOnPressOrOnLongPress =
264
- props.onPress != null || props.onLongPress != null;
302
+ const _accessible = Platform.select({
303
+ ios: accessible !== false,
304
+ android:
305
+ accessible == null ? onPress != null || onLongPress != null : accessible,
306
+ default: accessible !== false,
307
+ });
265
308
 
266
- return hasTextAncestor ? (
267
- <NativeVirtualText
268
- {...restProps}
269
- {...eventHandlersForText}
270
- accessibilityControls={ariaControls ?? accessibilityControls} // Win32
271
- accessibilityDescribedBy={ariaDescribedBy ?? accessibilityDescribedBy} // Win32
272
- accessibilityDescription={ariaDescription ?? accessibilityDescription} // Win32
273
- accessibilityLabel={ariaLabel ?? accessibilityLabel}
274
- accessibilityLevel={ariaLevel ?? accessibilityLevel} // Win32
275
- accessibilityPositionInSet={ariaPosinset ?? accessibilityPositionInSet} // Win32
276
- accessibilitySetSize={ariaSetsize ?? accessibilitySetSize} // Win32
277
- accessibilityState={_accessibilityState}
278
- isHighlighted={isHighlighted}
279
- isPressable={isPressable}
280
- nativeID={id ?? nativeID}
281
- numberOfLines={numberOfLines}
282
- ref={forwardedRef}
283
- selectable={_selectable}
284
- selectionColor={selectionColor}
285
- style={style}
286
- />
287
- ) : (
309
+ return (
288
310
  <TextAncestor.Provider value={true}>
289
311
  <NativeText
290
312
  {...restProps}
291
313
  {...eventHandlersForText}
314
+ accessibilityLabel={_accessibilityLabel}
315
+ accessibilityState={_accessibilityState}
316
+ accessible={_accessible}
292
317
  accessibilityControls={ariaControls ?? accessibilityControls} // Win32
293
318
  accessibilityDescribedBy={ariaDescribedBy ?? accessibilityDescribedBy} // Win32
294
319
  accessibilityDescription={ariaDescription ?? accessibilityDescription} // Win32
295
- accessibilityLabel={ariaLabel ?? accessibilityLabel}
296
320
  accessibilityLevel={ariaLevel ?? accessibilityLevel} // Win32
297
321
  accessibilityPositionInSet={ariaPosinset ?? accessibilityPositionInSet} // Win32
298
322
  accessibilitySetSize={ariaSetsize ?? accessibilitySetSize} // Win32
299
- accessibilityState={nativeTextAccessibilityState}
300
- accessible={
301
- accessible == null && Platform.OS === 'android'
302
- ? _hasOnPressOrOnLongPress
303
- : _accessible
304
- }
305
323
  allowFontScaling={allowFontScaling !== false}
306
324
  disabled={_disabled}
307
325
  ellipsizeMode={ellipsizeMode ?? 'tail'}
308
326
  isHighlighted={isHighlighted}
309
- nativeID={id ?? nativeID}
327
+ nativeID={_nativeID}
310
328
  numberOfLines={numberOfLines}
311
329
  ref={forwardedRef}
312
330
  selectable={_selectable}
313
331
  selectionColor={selectionColor}
314
- style={style}
332
+ style={processedStyle}
315
333
  />
316
334
  </TextAncestor.Provider>
317
335
  );
@@ -8,13 +8,14 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
12
+ import type {ProcessedColorValue} from '../StyleSheet/processColor';
13
+ import type {PressEvent} from '../Types/CoreEventTypes';
14
+ import type {TextProps} from './TextProps';
15
+
11
16
  import {createViewConfig} from '../NativeComponent/ViewConfig';
12
17
  import UIManager from '../ReactNative/UIManager';
13
18
  import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass';
14
- import {type HostComponent} from '../Renderer/shims/ReactNativeTypes';
15
- import {type ProcessedColorValue} from '../StyleSheet/processColor';
16
- import {type PressEvent} from '../Types/CoreEventTypes';
17
- import {type TextProps} from './TextProps';
18
19
 
19
20
  type NativeTextProps = $ReadOnly<{
20
21
  ...TextProps,
@@ -8,13 +8,14 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
12
+ import type {ProcessedColorValue} from '../StyleSheet/processColor';
13
+ import type {PressEvent} from '../Types/CoreEventTypes';
14
+ import type {TextProps} from './TextProps';
15
+
11
16
  import {createViewConfig} from '../NativeComponent/ViewConfig';
12
17
  import UIManager from '../ReactNative/UIManager';
13
18
  import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass';
14
- import {type HostComponent} from '../Renderer/shims/ReactNativeTypes';
15
- import {type ProcessedColorValue} from '../StyleSheet/processColor';
16
- import {type PressEvent} from '../Types/CoreEventTypes';
17
- import {type TextProps} from './TextProps';
18
19
 
19
20
  type NativeTextProps = $ReadOnly<{
20
21
  ...TextProps,
@@ -26,23 +26,23 @@ import type {
26
26
  } from '../Types/CoreEventTypes';
27
27
  import type {Node} from 'react';
28
28
 
29
- export type PressRetentionOffset = $ReadOnly<{|
29
+ export type PressRetentionOffset = $ReadOnly<{
30
30
  top: number,
31
31
  left: number,
32
32
  bottom: number,
33
33
  right: number,
34
- |}>;
34
+ }>;
35
35
 
36
- type PointerEventProps = $ReadOnly<{|
36
+ type PointerEventProps = $ReadOnly<{
37
37
  onPointerEnter?: (event: PointerEvent) => void,
38
38
  onPointerLeave?: (event: PointerEvent) => void,
39
39
  onPointerMove?: (event: PointerEvent) => void,
40
- |}>;
40
+ }>;
41
41
 
42
42
  /**
43
43
  * @see https://reactnative.dev/docs/text#reference
44
44
  */
45
- export type TextProps = $ReadOnly<{|
45
+ export type TextProps = $ReadOnly<{
46
46
  ...PointerEventProps,
47
47
 
48
48
  /**
@@ -265,4 +265,4 @@ export type TextProps = $ReadOnly<{|
265
265
  * See https://reactnative.dev/docs/text.html#linebreakstrategyios
266
266
  */
267
267
  lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
268
- |}>;
268
+ }>;
@@ -26,23 +26,23 @@ import type {
26
26
  } from '../Types/CoreEventTypes';
27
27
  import type {Node} from 'react';
28
28
 
29
- export type PressRetentionOffset = $ReadOnly<{|
29
+ export type PressRetentionOffset = $ReadOnly<{
30
30
  top: number,
31
31
  left: number,
32
32
  bottom: number,
33
33
  right: number,
34
- |}>;
34
+ }>;
35
35
 
36
- type PointerEventProps = $ReadOnly<{|
36
+ type PointerEventProps = $ReadOnly<{
37
37
  onPointerEnter?: (event: PointerEvent) => void,
38
38
  onPointerLeave?: (event: PointerEvent) => void,
39
39
  onPointerMove?: (event: PointerEvent) => void,
40
- |}>;
40
+ }>;
41
41
 
42
42
  /**
43
43
  * @see https://reactnative.dev/docs/text#reference
44
44
  */
45
- export type TextProps = $ReadOnly<{|
45
+ export type TextProps = $ReadOnly<{
46
46
  ...PointerEventProps,
47
47
 
48
48
  /**
@@ -278,4 +278,4 @@ export type TextProps = $ReadOnly<{|
278
278
  * See https://reactnative.dev/docs/text.html#linebreakstrategyios
279
279
  */
280
280
  lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
281
- |}>;
281
+ }>;
@@ -10,6 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
+ import type {EventSubscription} from '../vendor/emitter/EventEmitter';
13
14
  import type {SyntheticEvent} from './CoreEventTypes';
14
15
 
15
16
  // Event types
@@ -40,3 +41,5 @@ type DefaultTypes = number | boolean | string | $ReadOnlyArray<string>;
40
41
  //
41
42
  // eslint-disable-next-line no-unused-vars
42
43
  export type WithDefault<Type: DefaultTypes, Value: ?Type | string> = ?Type;
44
+
45
+ export type EventEmitter<T> = (handler: (T) => mixed) => EventSubscription;
package/overrides.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "**/__snapshots__/**",
8
8
  "src-win/rntypes/**"
9
9
  ],
10
- "baseVersion": "0.75.0-nightly-20240610-ced076210",
10
+ "baseVersion": "0.75.0-nightly-20240613-f7aea0c8e",
11
11
  "overrides": [
12
12
  {
13
13
  "type": "derived",
@@ -192,7 +192,7 @@
192
192
  "type": "derived",
193
193
  "file": "src-win/Libraries/Components/View/ViewAccessibility.win32.js",
194
194
  "baseFile": "packages/react-native/Libraries/Components/View/ViewAccessibility.js",
195
- "baseHash": "d12245b45ccdc5f473ba9484b5ec994cb45dae75"
195
+ "baseHash": "7ac427e8b7a78a8e938ce1b383ec6e911a6fa3b5"
196
196
  },
197
197
  {
198
198
  "type": "derived",
@@ -439,20 +439,20 @@
439
439
  "type": "derived",
440
440
  "file": "src-win/Libraries/Text/Text.win32.js",
441
441
  "baseFile": "packages/react-native/Libraries/Text/Text.js",
442
- "baseHash": "e800e91861873f94be7b43df80fae6f4b62a98e8"
442
+ "baseHash": "24376d16dfc834512d72348e2a434731440146d4"
443
443
  },
444
444
  {
445
445
  "type": "derived",
446
446
  "file": "src-win/Libraries/Text/TextNativeComponent.win32.js",
447
447
  "baseFile": "packages/react-native/Libraries/Text/TextNativeComponent.js",
448
- "baseHash": "abcdb74e2fe1e491baaefdd0ba6369199b8032d0",
448
+ "baseHash": "9f7ea4e5225a06e1ec3bb46a2f4bc9f72bf46873",
449
449
  "issue": 7074
450
450
  },
451
451
  {
452
452
  "type": "derived",
453
453
  "file": "src-win/Libraries/Text/TextProps.win32.js",
454
454
  "baseFile": "packages/react-native/Libraries/Text/TextProps.js",
455
- "baseHash": "7ecbe61c439e5c6f79fe5ae262f063060fa6a24f"
455
+ "baseHash": "8e56a028dee989ebb8b06f4c01a1d038f074597d"
456
456
  },
457
457
  {
458
458
  "type": "patch",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-iss/react-native-win32",
3
- "version": "0.0.0-canary.255",
3
+ "version": "0.0.0-canary.256",
4
4
  "description": "Implementation of react native on top of Office's Win32 platform.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,13 +30,13 @@
30
30
  "@react-native-community/cli-platform-android": "14.0.0-alpha.2",
31
31
  "@react-native-community/cli-platform-ios": "14.0.0-alpha.2",
32
32
  "@react-native/assets": "1.0.0",
33
- "@react-native/assets-registry": "0.75.0-nightly-20240610-ced076210",
34
- "@react-native/codegen": "0.75.0-nightly-20240610-ced076210",
35
- "@react-native/community-cli-plugin": "0.75.0-nightly-20240610-ced076210",
36
- "@react-native/gradle-plugin": "0.75.0-nightly-20240610-ced076210",
37
- "@react-native/js-polyfills": "0.75.0-nightly-20240610-ced076210",
38
- "@react-native/normalize-colors": "0.75.0-nightly-20240610-ced076210",
39
- "@react-native/virtualized-lists": "0.75.0-nightly-20240610-ced076210",
33
+ "@react-native/assets-registry": "0.75.0-nightly-20240613-f7aea0c8e",
34
+ "@react-native/codegen": "0.75.0-nightly-20240613-f7aea0c8e",
35
+ "@react-native/community-cli-plugin": "0.75.0-nightly-20240613-f7aea0c8e",
36
+ "@react-native/gradle-plugin": "0.75.0-nightly-20240613-f7aea0c8e",
37
+ "@react-native/js-polyfills": "0.75.0-nightly-20240613-f7aea0c8e",
38
+ "@react-native/normalize-colors": "0.75.0-nightly-20240613-f7aea0c8e",
39
+ "@react-native/virtualized-lists": "0.75.0-nightly-20240613-f7aea0c8e",
40
40
  "abort-controller": "^3.0.0",
41
41
  "anser": "^1.4.9",
42
42
  "ansi-regex": "^5.0.0",
@@ -71,11 +71,11 @@
71
71
  "devDependencies": {
72
72
  "@babel/core": "^7.20.0",
73
73
  "@babel/eslint-parser": "^7.20.0",
74
- "@react-native/metro-config": "0.75.0-nightly-20240610-ced076210",
74
+ "@react-native/metro-config": "0.75.0-nightly-20240613-f7aea0c8e",
75
75
  "@rnw-scripts/babel-react-native-config": "0.0.0",
76
- "@rnw-scripts/eslint-config": "1.2.23",
77
- "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.1.27",
78
- "@rnw-scripts/just-task": "2.3.40",
76
+ "@rnw-scripts/eslint-config": "1.2.24",
77
+ "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.1.28",
78
+ "@rnw-scripts/just-task": "2.3.41",
79
79
  "@rnw-scripts/metro-dev-config": "0.0.0",
80
80
  "@rnx-kit/jest-preset": "^0.1.0",
81
81
  "@types/node": "^18.0.0",
@@ -87,14 +87,14 @@
87
87
  "just-scripts": "^1.3.3",
88
88
  "prettier": "2.8.8",
89
89
  "react": "18.3.1",
90
- "react-native": "0.75.0-nightly-20240610-ced076210",
91
- "react-native-platform-override": "^1.9.42",
90
+ "react-native": "0.75.0-nightly-20240613-f7aea0c8e",
91
+ "react-native-platform-override": "^1.9.43",
92
92
  "typescript": "5.0.4"
93
93
  },
94
94
  "peerDependencies": {
95
95
  "@types/react": "^18.2.6",
96
96
  "react": "^18.2.0",
97
- "react-native": "0.75.0-nightly-20240610-ced076210"
97
+ "react-native": "0.75.0-nightly-20240613-f7aea0c8e"
98
98
  },
99
99
  "beachball": {
100
100
  "defaultNpmTag": "canary",