@office-iss/react-native-win32 0.0.0-canary.261 → 0.0.0-canary.262

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.
Files changed (32) hide show
  1. package/.flowconfig +1 -1
  2. package/CHANGELOG.json +22 -1
  3. package/CHANGELOG.md +13 -4
  4. package/Libraries/Animated/nodes/AnimatedObject.js +2 -5
  5. package/Libraries/Animated/nodes/AnimatedProps.js +2 -0
  6. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +0 -3
  7. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +0 -3
  8. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -3
  9. package/Libraries/Components/TextInput/TextInput.js +20 -24
  10. package/Libraries/Components/TextInput/TextInput.win32.js +20 -24
  11. package/Libraries/Components/View/ViewNativeComponent.js +0 -7
  12. package/Libraries/Core/ReactNativeVersion.js +1 -1
  13. package/Libraries/Image/ImageViewNativeComponent.js +0 -3
  14. package/Libraries/LogBox/Data/LogBoxData.js +8 -14
  15. package/Libraries/Modal/Modal.js +0 -1
  16. package/Libraries/NativeComponent/BaseViewConfig.android.js +6 -0
  17. package/Libraries/StyleSheet/processBackgroundImage.js +1 -1
  18. package/Libraries/StyleSheet/processBoxShadow.js +1 -1
  19. package/Libraries/StyleSheet/processFilter.js +5 -1
  20. package/Libraries/Text/Text.win32.js +1 -1
  21. package/Libraries/Text/TextNativeComponent.js +0 -6
  22. package/Libraries/Text/TextNativeComponent.win32.js +0 -6
  23. package/Libraries/Utilities/Appearance.js +62 -30
  24. package/Libraries/Utilities/HMRClient.js +1 -1
  25. package/Libraries/Utilities/createPerformanceLogger.js +0 -9
  26. package/Libraries/promiseRejectionTrackingOptions.js +1 -1
  27. package/overrides.json +4 -4
  28. package/package.json +13 -13
  29. package/src/private/featureflags/ReactNativeFeatureFlags.js +16 -1
  30. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -1
  31. package/src/private/fusebox/FuseboxSessionObserver.js +42 -0
  32. package/src/private/specs/modules/NativeDebuggerSessionObserver.js +0 -23
package/.flowconfig CHANGED
@@ -160,4 +160,4 @@ untyped-import
160
160
  untyped-type-import
161
161
 
162
162
  [version]
163
- ^0.244.0
163
+ ^0.245.0
package/CHANGELOG.json CHANGED
@@ -2,7 +2,28 @@
2
2
  "name": "@office-iss/react-native-win32",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 05 Sep 2024 05:13:08 GMT",
5
+ "date": "Sat, 07 Sep 2024 05:13:20 GMT",
6
+ "version": "0.0.0-canary.262",
7
+ "tag": "@office-iss/react-native-win32_v0.0.0-canary.262",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "tatianakapos@microsoft.com",
12
+ "package": "@office-iss/react-native-win32",
13
+ "commit": "55e32071ac30a673c7830f717fcbd1a3a228dcff",
14
+ "comment": "switch to optimized text"
15
+ },
16
+ {
17
+ "author": "34109996+chiaramooney@users.noreply.github.com",
18
+ "package": "@office-iss/react-native-win32",
19
+ "commit": "409bf6e085cc1aa6421cff078037f7b3774bd8ec",
20
+ "comment": "Integrate 8/31"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Thu, 05 Sep 2024 05:13:45 GMT",
6
27
  "version": "0.0.0-canary.261",
7
28
  "tag": "@office-iss/react-native-win32_v0.0.0-canary.261",
8
29
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,17 +1,26 @@
1
1
  # Change Log - @office-iss/react-native-win32
2
2
 
3
- This log was last generated on Thu, 05 Sep 2024 05:13:08 GMT and should not be manually modified.
3
+ <!-- This log was last generated on Sat, 07 Sep 2024 05:13:20 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.0.0-canary.261
7
+ ## 0.0.0-canary.262
8
8
 
9
- Thu, 05 Sep 2024 05:13:08 GMT
9
+ Sat, 07 Sep 2024 05:13:20 GMT
10
10
 
11
11
  ### Changes
12
12
 
13
- - Integrate 8/20 (34109996+chiaramooney@users.noreply.github.com)
13
+ - switch to optimized text (tatianakapos@microsoft.com)
14
+ - Integrate 8/31 (34109996+chiaramooney@users.noreply.github.com)
14
15
 
16
+ ## 0.0.0-canary.261
17
+
18
+ Thu, 05 Sep 2024 05:13:45 GMT
19
+
20
+ ### Changes
21
+
22
+ - Integrate 8/20 (34109996+chiaramooney@users.noreply.github.com)
23
+
15
24
  ## 0.0.0-canary.260
16
25
 
17
26
  Wed, 28 Aug 2024 05:14:44 GMT
@@ -23,7 +23,8 @@ function isPlainObject(value: any): boolean {
23
23
  return (
24
24
  value !== null &&
25
25
  typeof value === 'object' &&
26
- Object.getPrototypeOf(value).isPrototypeOf(Object)
26
+ Object.getPrototypeOf(value).isPrototypeOf(Object) &&
27
+ !React.isValidElement(value)
27
28
  );
28
29
  }
29
30
 
@@ -81,10 +82,6 @@ export function hasAnimatedNode(value: any, depth: number = 0): boolean {
81
82
  }
82
83
  }
83
84
  } else if (isPlainObject(value)) {
84
- // Don't consider React elements
85
- if (React.isValidElement(value)) {
86
- return false;
87
- }
88
85
  for (const key in value) {
89
86
  if (hasAnimatedNode(value[key], depth + 1)) {
90
87
  return true;
@@ -88,6 +88,8 @@ export default class AnimatedProps extends AnimatedNode {
88
88
  if (this.__isNative && this._animatedView) {
89
89
  this.__disconnectAnimatedView();
90
90
  }
91
+ this._animatedView = null;
92
+
91
93
  for (const key in this._props) {
92
94
  const value = this._props[key];
93
95
  if (value instanceof AnimatedNode) {
@@ -25,9 +25,6 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
25
25
  disableIntervalMomentum: true,
26
26
  maintainVisibleContentPosition: true,
27
27
  endFillColor: {process: require('../../StyleSheet/processColor').default},
28
- experimental_boxShadow: {
29
- process: require('../../StyleSheet/processBoxShadow').default,
30
- },
31
28
  fadingEdgeLength: true,
32
29
  nestedScrollEnabled: true,
33
30
  overScrollMode: true,
@@ -46,9 +46,6 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
46
46
  },
47
47
  decelerationRate: true,
48
48
  enableSyncOnScroll: true, // Fabric only.
49
- experimental_boxShadow: {
50
- process: require('../../StyleSheet/processBoxShadow').default,
51
- },
52
49
  disableIntervalMomentum: true,
53
50
  maintainVisibleContentPosition: true,
54
51
  pagingEnabled: true,
@@ -739,9 +739,6 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
739
739
  },
740
740
  borderTopLeftRadius: true,
741
741
  borderTopColor: {process: require('../../StyleSheet/processColor').default},
742
- experimental_boxShadow: {
743
- process: require('../../StyleSheet/processBoxShadow').default,
744
- },
745
742
  },
746
743
  };
747
744
 
@@ -1538,15 +1538,26 @@ function InternalTextInput(props: Props): React.Node {
1538
1538
  // Keep the original (potentially nested) style when possible, as React can diff these more efficiently
1539
1539
  let _style = props.style;
1540
1540
  const flattenedStyle = flattenStyle<TextStyleProp>(props.style);
1541
- if (typeof flattenedStyle?.fontWeight === 'number') {
1542
- _style = [
1543
- _style,
1544
- {
1545
- fontWeight:
1546
- // $FlowFixMe[incompatible-cast]
1547
- (flattenedStyle.fontWeight.toString(): TextStyleInternal['fontWeight']),
1548
- },
1549
- ];
1541
+ if (flattenedStyle != null) {
1542
+ let overrides: ?{...TextStyleInternal} = null;
1543
+ if (typeof flattenedStyle?.fontWeight === 'number') {
1544
+ overrides = overrides || ({}: {...TextStyleInternal});
1545
+ overrides.fontWeight =
1546
+ // $FlowFixMe[incompatible-cast]
1547
+ (flattenedStyle.fontWeight.toString(): TextStyleInternal['fontWeight']);
1548
+ }
1549
+
1550
+ if (flattenedStyle.verticalAlign != null) {
1551
+ overrides = overrides || ({}: {...TextStyleInternal});
1552
+ overrides.textAlignVertical =
1553
+ verticalAlignToTextAlignVerticalMap[flattenedStyle.verticalAlign];
1554
+ overrides.verticalAlign = undefined;
1555
+ }
1556
+
1557
+ if (overrides != null) {
1558
+ // $FlowFixMe[incompatible-type]
1559
+ _style = [_style, overrides];
1560
+ }
1550
1561
  }
1551
1562
 
1552
1563
  if (Platform.OS === 'ios') {
@@ -1782,20 +1793,6 @@ const ExportedForwardRef: React.AbstractComponent<
1782
1793
  },
1783
1794
  forwardedRef: ReactRefSetter<TextInputInstance>,
1784
1795
  ) {
1785
- // $FlowFixMe[underconstrained-implicit-instantiation]
1786
- let style = flattenStyle(restProps.style);
1787
-
1788
- if (style?.verticalAlign != null) {
1789
- // $FlowFixMe[prop-missing]
1790
- // $FlowFixMe[cannot-write]
1791
- style.textAlignVertical =
1792
- // $FlowFixMe[invalid-computed-prop]
1793
- verticalAlignToTextAlignVerticalMap[style.verticalAlign];
1794
- // $FlowFixMe[prop-missing]
1795
- // $FlowFixMe[cannot-write]
1796
- delete style.verticalAlign;
1797
- }
1798
-
1799
1796
  return (
1800
1797
  <InternalTextInput
1801
1798
  allowFontScaling={allowFontScaling}
@@ -1832,7 +1829,6 @@ const ExportedForwardRef: React.AbstractComponent<
1832
1829
  }
1833
1830
  {...restProps}
1834
1831
  forwardedRef={forwardedRef}
1835
- style={style}
1836
1832
  />
1837
1833
  );
1838
1834
  });
@@ -1645,15 +1645,26 @@ function InternalTextInput(props: Props): React.Node {
1645
1645
  // Keep the original (potentially nested) style when possible, as React can diff these more efficiently
1646
1646
  let _style = props.style;
1647
1647
  const flattenedStyle = flattenStyle<TextStyleProp>(props.style);
1648
- if (typeof flattenedStyle?.fontWeight === 'number') {
1649
- _style = [
1650
- _style,
1651
- {
1652
- fontWeight:
1653
- // $FlowFixMe[incompatible-cast]
1654
- (flattenedStyle.fontWeight.toString(): TextStyleInternal['fontWeight']),
1655
- },
1656
- ];
1648
+ if (flattenedStyle != null) {
1649
+ let overrides: ?{...TextStyleInternal} = null;
1650
+ if (typeof flattenedStyle?.fontWeight === 'number') {
1651
+ overrides = overrides || ({}: {...TextStyleInternal});
1652
+ overrides.fontWeight =
1653
+ // $FlowFixMe[incompatible-cast]
1654
+ (flattenedStyle.fontWeight.toString(): TextStyleInternal['fontWeight']);
1655
+ }
1656
+
1657
+ if (flattenedStyle.verticalAlign != null) {
1658
+ overrides = overrides || ({}: {...TextStyleInternal});
1659
+ overrides.textAlignVertical =
1660
+ verticalAlignToTextAlignVerticalMap[flattenedStyle.verticalAlign];
1661
+ overrides.verticalAlign = undefined;
1662
+ }
1663
+
1664
+ if (overrides != null) {
1665
+ // $FlowFixMe[incompatible-type]
1666
+ _style = [_style, overrides];
1667
+ }
1657
1668
  }
1658
1669
 
1659
1670
  if (Platform.OS === 'ios') {
@@ -1917,20 +1928,6 @@ const ExportedForwardRef: React.AbstractComponent<
1917
1928
  },
1918
1929
  forwardedRef: ReactRefSetter<TextInputInstance>,
1919
1930
  ) {
1920
- // $FlowFixMe[underconstrained-implicit-instantiation]
1921
- let style = flattenStyle(restProps.style);
1922
-
1923
- if (style?.verticalAlign != null) {
1924
- // $FlowFixMe[prop-missing]
1925
- // $FlowFixMe[cannot-write]
1926
- style.textAlignVertical =
1927
- // $FlowFixMe[invalid-computed-prop]
1928
- verticalAlignToTextAlignVerticalMap[style.verticalAlign];
1929
- // $FlowFixMe[prop-missing]
1930
- // $FlowFixMe[cannot-write]
1931
- delete style.verticalAlign;
1932
- }
1933
-
1934
1931
  return (
1935
1932
  <InternalTextInput
1936
1933
  allowFontScaling={allowFontScaling}
@@ -1966,7 +1963,6 @@ const ExportedForwardRef: React.AbstractComponent<
1966
1963
  }
1967
1964
  {...restProps}
1968
1965
  forwardedRef={forwardedRef}
1969
- style={style}
1970
1966
  />
1971
1967
  );
1972
1968
  });
@@ -94,17 +94,10 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
94
94
  borderBlockStartColor: {
95
95
  process: require('../../StyleSheet/processColor').default,
96
96
  },
97
- experimental_boxShadow: {
98
- process: require('../../StyleSheet/processBoxShadow').default,
99
- },
100
-
101
97
  focusable: true,
102
98
  overflow: true,
103
99
  backfaceVisibility: true,
104
100
  experimental_layoutConformance: true,
105
- experimental_backgroundImage: {
106
- process: require('../../StyleSheet/processBackgroundImage').default,
107
- },
108
101
  },
109
102
  }
110
103
  : {
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 76,
19
19
  patch: 0,
20
- prerelease: 'nightly-20240824-09e88448c',
20
+ prerelease: 'nightly-20240901-305b4357e',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -113,9 +113,6 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
113
113
  borderBottomRightRadius: true,
114
114
  borderTopRightRadius: true,
115
115
  loadingIndicatorSrc: true,
116
- experimental_boxShadow: {
117
- process: require('../StyleSheet/processBoxShadow').default,
118
- },
119
116
  },
120
117
  }
121
118
  : {
@@ -18,7 +18,7 @@ import type {
18
18
  Message,
19
19
  } from './parseLogBoxLog';
20
20
 
21
- import NativeDebuggerSessionObserver from '../../../src/private/specs/modules/NativeDebuggerSessionObserver';
21
+ import DebuggerSessionObserver from '../../../src/private/fusebox/FuseboxSessionObserver';
22
22
  import parseErrorStack from '../../Core/Devtools/parseErrorStack';
23
23
  import NativeDevSettings from '../../NativeModules/specs/NativeDevSettings';
24
24
  import NativeLogBox from '../../NativeModules/specs/NativeLogBox';
@@ -198,29 +198,23 @@ function appendNewLog(newLog: LogBoxLog) {
198
198
  }
199
199
 
200
200
  export function addLog(log: LogData): void {
201
- if (
202
- hostTargetSessionObserverSubscription == null &&
203
- NativeDebuggerSessionObserver != null
204
- ) {
205
- hostTargetSessionObserverSubscription =
206
- NativeDebuggerSessionObserver.subscribe(hasActiveSession => {
201
+ if (hostTargetSessionObserverSubscription == null) {
202
+ hostTargetSessionObserverSubscription = DebuggerSessionObserver.subscribe(
203
+ hasActiveSession => {
207
204
  if (hasActiveSession) {
208
205
  clearWarnings();
209
206
  } else {
210
207
  // Reset the flag so that we can show the message again if new warning was emitted
211
208
  hasShownFuseboxWarningsMigrationMessage = false;
212
209
  }
213
- });
210
+ },
211
+ );
214
212
  }
215
213
 
216
214
  // If Host has Fusebox support
217
- if (
218
- log.level === 'warn' &&
219
- global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__ &&
220
- NativeDebuggerSessionObserver != null
221
- ) {
215
+ if (log.level === 'warn' && global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) {
222
216
  // And there is no active debugging session
223
- if (!NativeDebuggerSessionObserver.hasActiveSession()) {
217
+ if (!DebuggerSessionObserver.hasActiveSession()) {
224
218
  showFuseboxWarningsMigrationMessageOnce();
225
219
  }
226
220
 
@@ -218,7 +218,6 @@ class Modal extends React.Component<Props, State> {
218
218
  }
219
219
 
220
220
  componentWillUnmount() {
221
- this.setState({isRendered: false});
222
221
  if (this._eventSubscription) {
223
222
  this._eventSubscription.remove();
224
223
  }
@@ -166,6 +166,12 @@ const validAttributesForNonEventProps = {
166
166
  backgroundColor: {process: require('../StyleSheet/processColor').default},
167
167
  transform: true,
168
168
  transformOrigin: true,
169
+ experimental_backgroundImage: {
170
+ process: require('../StyleSheet/processBackgroundImage').default,
171
+ },
172
+ experimental_boxShadow: {
173
+ process: require('../StyleSheet/processBoxShadow').default,
174
+ },
169
175
  experimental_filter: {
170
176
  process: require('../StyleSheet/processFilter').default,
171
177
  },
@@ -42,7 +42,7 @@ export default function processBackgroundImage(
42
42
  }
43
43
 
44
44
  if (typeof backgroundImage === 'string') {
45
- result = parseCSSLinearGradient(backgroundImage);
45
+ result = parseCSSLinearGradient(backgroundImage.replace(/\n/g, ' '));
46
46
  } else if (Array.isArray(backgroundImage)) {
47
47
  for (const bgImage of backgroundImage) {
48
48
  const processedColorStops: Array<{
@@ -33,7 +33,7 @@ export default function processBoxShadow(
33
33
 
34
34
  const boxShadowList =
35
35
  typeof rawBoxShadows === 'string'
36
- ? parseBoxShadowString(rawBoxShadows)
36
+ ? parseBoxShadowString(rawBoxShadows.replace(/\n/g, ' '))
37
37
  : rawBoxShadows;
38
38
 
39
39
  for (const rawBoxShadow of boxShadowList) {
@@ -44,6 +44,8 @@ export default function processFilter(
44
44
  }
45
45
 
46
46
  if (typeof filter === 'string') {
47
+ filter = filter.replace(/\n/g, ' ');
48
+
47
49
  // matches on functions with args and nested functions like "drop-shadow(10 10 10 rgba(0, 0, 0, 1))"
48
50
  const regex = /([\w-]+)\(([^()]*|\([^()]*\)|[^()]*\([^()]*\)[^()]*)\)/g;
49
51
  let matches;
@@ -80,7 +82,7 @@ export default function processFilter(
80
82
  }
81
83
  }
82
84
  }
83
- } else {
85
+ } else if (Array.isArray(filter)) {
84
86
  for (const filterFunction of filter) {
85
87
  const [filterName, filterValue] = Object.entries(filterFunction)[0];
86
88
  if (filterName === 'dropShadow') {
@@ -107,6 +109,8 @@ export default function processFilter(
107
109
  }
108
110
  }
109
111
  }
112
+ } else {
113
+ throw new TypeError(`${typeof filter} filter is not a string or array`);
110
114
  }
111
115
 
112
116
  return result;
@@ -273,7 +273,7 @@ const Text: React.AbstractComponent<TextProps, TextForwardRef> =
273
273
  accessible == null
274
274
  ? onPress != null || onLongPress != null
275
275
  : accessible,
276
- default: accessible,
276
+ default: accessible !== false, // Win32
277
277
  });
278
278
 
279
279
  let nativeText = null;
@@ -49,12 +49,6 @@ const textViewConfig = {
49
49
  dataDetectorType: true,
50
50
  android_hyphenationFrequency: true,
51
51
  lineBreakStrategyIOS: true,
52
- // boxShadow is currently per-component on Android instead of being on BaseViewConfig yet
53
- ...(Platform.OS === 'android' && {
54
- experimental_boxShadow: {
55
- process: require('../StyleSheet/processBoxShadow').default,
56
- },
57
- }),
58
52
  },
59
53
  directEventTypes: {
60
54
  topTextLayout: {
@@ -83,12 +83,6 @@ const textViewConfig = {
83
83
  textStyle: true,
84
84
  tooltip: true,
85
85
  // Windows]
86
- // boxShadow is currently per-component on Android instead of being on BaseViewConfig yet
87
- ...(Platform.OS === 'android' && {
88
- experimental_boxShadow: {
89
- process: require('../StyleSheet/processBoxShadow').default,
90
- },
91
- }),
92
86
  },
93
87
  directEventTypes: {
94
88
  topTextLayout: {
@@ -8,37 +8,64 @@
8
8
  * @flow strict-local
9
9
  */
10
10
 
11
+ import type {EventSubscription} from '../vendor/emitter/EventEmitter';
12
+ import type {AppearancePreferences, ColorSchemeName} from './NativeAppearance';
13
+ import typeof INativeAppearance from './NativeAppearance';
14
+
11
15
  import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
12
- import EventEmitter, {
13
- type EventSubscription,
14
- } from '../vendor/emitter/EventEmitter';
16
+ import EventEmitter from '../vendor/emitter/EventEmitter';
15
17
  import {isAsyncDebugging} from './DebugEnvironment';
16
- import NativeAppearance, {
17
- type AppearancePreferences,
18
- type ColorSchemeName,
19
- } from './NativeAppearance';
20
18
  import invariant from 'invariant';
21
19
 
22
- const eventEmitter = new EventEmitter<{
23
- change: [{colorScheme: ?ColorSchemeName}],
24
- }>();
25
-
26
- type NativeAppearanceEventDefinitions = {
27
- appearanceChanged: [AppearancePreferences],
20
+ type Appearance = {
21
+ colorScheme: ?ColorSchemeName,
28
22
  };
29
23
 
30
- // Cache the color scheme to reduce the cost of reading it between changes.
31
- // NOTE: If `NativeAppearance` is null, this will always be null.
32
- let appearance: ?{colorScheme: ?ColorSchemeName} = null;
24
+ let lazyState: ?{
25
+ +NativeAppearance: INativeAppearance,
26
+ // Cache the color scheme to reduce the cost of reading it between changes.
27
+ // NOTE: If `NativeAppearance` is null, this will always be null.
28
+ appearance: ?Appearance,
29
+ // NOTE: This is non-nullable to make it easier for `onChangedListener` to
30
+ // return a non-nullable `EventSubscription` value. This is not the common
31
+ // path, so we do not have to over-optimize it.
32
+ +eventEmitter: EventEmitter<{change: [Appearance]}>,
33
+ };
33
34
 
34
- if (NativeAppearance != null) {
35
- new NativeEventEmitter<NativeAppearanceEventDefinitions>(
36
- NativeAppearance,
37
- ).addListener('appearanceChanged', (newAppearance: AppearancePreferences) => {
38
- const colorScheme = toColorScheme(newAppearance.colorScheme);
39
- appearance = {colorScheme};
40
- eventEmitter.emit('change', appearance);
41
- });
35
+ /**
36
+ * Ensures that all state and listeners are lazily initialized correctly.
37
+ */
38
+ function getState(): $NonMaybeType<typeof lazyState> {
39
+ if (lazyState != null) {
40
+ return lazyState;
41
+ }
42
+ const eventEmitter = new EventEmitter<{change: [Appearance]}>();
43
+ // NOTE: Avoid initializing `NativeAppearance` until it is actually used.
44
+ const NativeAppearance = require('./NativeAppearance').default;
45
+ if (NativeAppearance == null) {
46
+ // Assign `null` to avoid re-initializing on subsequent invocations.
47
+ lazyState = {
48
+ NativeAppearance: null,
49
+ appearance: null,
50
+ eventEmitter,
51
+ };
52
+ } else {
53
+ const state: $NonMaybeType<typeof lazyState> = {
54
+ NativeAppearance,
55
+ appearance: null,
56
+ eventEmitter,
57
+ };
58
+ new NativeEventEmitter<{
59
+ appearanceChanged: [AppearancePreferences],
60
+ }>(NativeAppearance).addListener('appearanceChanged', newAppearance => {
61
+ state.appearance = {
62
+ colorScheme: toColorScheme(newAppearance.colorScheme),
63
+ };
64
+ eventEmitter.emit('change', state.appearance);
65
+ });
66
+ lazyState = state;
67
+ }
68
+ return lazyState;
42
69
  }
43
70
 
44
71
  /**
@@ -55,15 +82,17 @@ export function getColorScheme(): ?ColorSchemeName {
55
82
  }
56
83
  }
57
84
  let colorScheme = null;
85
+ const state = getState();
86
+ const {NativeAppearance} = state;
58
87
  if (NativeAppearance != null) {
59
- if (appearance == null) {
60
- // Lazily initialize `appearance`. This should only happen once because
61
- // we never reassign a null value to `appearance`.
62
- appearance = {
88
+ if (state.appearance == null) {
89
+ // Lazily initialize `state.appearance`. This should only
90
+ // happen once because we never reassign a null value to it.
91
+ state.appearance = {
63
92
  colorScheme: toColorScheme(NativeAppearance.getColorScheme()),
64
93
  };
65
94
  }
66
- colorScheme = appearance.colorScheme;
95
+ colorScheme = state.appearance.colorScheme;
67
96
  }
68
97
  return colorScheme;
69
98
  }
@@ -72,9 +101,11 @@ export function getColorScheme(): ?ColorSchemeName {
72
101
  * Updates the current color scheme to the supplied value.
73
102
  */
74
103
  export function setColorScheme(colorScheme: ?ColorSchemeName): void {
104
+ const state = getState();
105
+ const {NativeAppearance} = state;
75
106
  if (NativeAppearance != null) {
76
107
  NativeAppearance.setColorScheme(colorScheme ?? 'unspecified');
77
- appearance = {colorScheme};
108
+ state.appearance = {colorScheme};
78
109
  }
79
110
  }
80
111
 
@@ -84,6 +115,7 @@ export function setColorScheme(colorScheme: ?ColorSchemeName): void {
84
115
  export function addChangeListener(
85
116
  listener: ({colorScheme: ?ColorSchemeName}) => void,
86
117
  ): EventSubscription {
118
+ const {eventEmitter} = getState();
87
119
  return eventEmitter.addListener('change', listener);
88
120
  }
89
121
 
@@ -126,7 +126,7 @@ const HMRClient: HMRClientNativeInterface = {
126
126
  data: data.map(item =>
127
127
  typeof item === 'string'
128
128
  ? item
129
- : prettyFormat(item, {
129
+ : prettyFormat.format(item, {
130
130
  escapeString: true,
131
131
  highlight: true,
132
132
  maxDepth: 3,
@@ -15,11 +15,8 @@ import type {
15
15
  Timespan,
16
16
  } from './IPerformanceLogger';
17
17
 
18
- import * as Systrace from '../Performance/Systrace';
19
18
  import infoLog from './infoLog';
20
19
 
21
- const _cookies: {[key: string]: number, ...} = {};
22
-
23
20
  const PRINT_TO_CONSOLE: false = false; // Type as false to prevent accidentally committing `true`;
24
21
 
25
22
  export const getCurrentTimestamp: () => number =
@@ -233,7 +230,6 @@ class PerformanceLogger implements IPerformanceLogger {
233
230
  startTime: timestamp,
234
231
  startExtras: extras,
235
232
  };
236
- _cookies[key] = Systrace.beginAsyncEvent(key);
237
233
  if (PRINT_TO_CONSOLE) {
238
234
  infoLog('PerformanceLogger.js', 'start: ' + key);
239
235
  }
@@ -277,11 +273,6 @@ class PerformanceLogger implements IPerformanceLogger {
277
273
  if (PRINT_TO_CONSOLE) {
278
274
  infoLog('PerformanceLogger.js', 'end: ' + key);
279
275
  }
280
-
281
- if (_cookies[key] != null) {
282
- Systrace.endAsyncEvent(key, _cookies[key]);
283
- delete _cookies[key];
284
- }
285
276
  }
286
277
  }
287
278
 
@@ -27,7 +27,7 @@ let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
27
27
  stack = error.stack;
28
28
  } else {
29
29
  try {
30
- message = require('pretty-format')(rejection);
30
+ message = require('pretty-format').format(rejection);
31
31
  } catch {
32
32
  message =
33
33
  typeof rejection === 'string'
package/overrides.json CHANGED
@@ -7,13 +7,13 @@
7
7
  "**/__snapshots__/**",
8
8
  "src-win/rntypes/**"
9
9
  ],
10
- "baseVersion": "0.76.0-nightly-20240824-09e88448c",
10
+ "baseVersion": "0.76.0-nightly-20240901-305b4357e",
11
11
  "overrides": [
12
12
  {
13
13
  "type": "derived",
14
14
  "file": ".flowconfig",
15
15
  "baseFile": ".flowconfig",
16
- "baseHash": "27c9677306d4f1bd627a346969c592aee606811a"
16
+ "baseHash": "67b097833fd6733db6c64c57fbcb2efb3e9b51c5"
17
17
  },
18
18
  {
19
19
  "type": "derived",
@@ -116,7 +116,7 @@
116
116
  "type": "derived",
117
117
  "file": "src-win/Libraries/Components/TextInput/TextInput.win32.js",
118
118
  "baseFile": "packages/react-native/Libraries/Components/TextInput/TextInput.js",
119
- "baseHash": "259941a60002c5a2a4166a39404d099f0472941e"
119
+ "baseHash": "494c1159a38de1b57d3889a4dabdc3708204ad4d"
120
120
  },
121
121
  {
122
122
  "type": "patch",
@@ -445,7 +445,7 @@
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": "dcb764530f8a6529152d9791597865034e2c36ae",
448
+ "baseHash": "642b6fc1c5b5802e3612f39c2ae0135b149a65f8",
449
449
  "issue": 7074
450
450
  },
451
451
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-iss/react-native-win32",
3
- "version": "0.0.0-canary.261",
3
+ "version": "0.0.0-canary.262",
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",
31
31
  "@react-native-community/cli-platform-ios": "14.0.0",
32
32
  "@react-native/assets": "1.0.0",
33
- "@react-native/assets-registry": "0.76.0-nightly-20240824-09e88448c",
34
- "@react-native/codegen": "0.76.0-nightly-20240824-09e88448c",
35
- "@react-native/community-cli-plugin": "0.76.0-nightly-20240824-09e88448c",
36
- "@react-native/gradle-plugin": "0.76.0-nightly-20240824-09e88448c",
37
- "@react-native/js-polyfills": "0.76.0-nightly-20240824-09e88448c",
38
- "@react-native/normalize-colors": "0.76.0-nightly-20240824-09e88448c",
39
- "@react-native/virtualized-lists": "0.76.0-nightly-20240824-09e88448c",
33
+ "@react-native/assets-registry": "0.76.0-nightly-20240901-305b4357e",
34
+ "@react-native/codegen": "0.76.0-nightly-20240901-305b4357e",
35
+ "@react-native/community-cli-plugin": "0.76.0-nightly-20240901-305b4357e",
36
+ "@react-native/gradle-plugin": "0.76.0-nightly-20240901-305b4357e",
37
+ "@react-native/js-polyfills": "0.76.0-nightly-20240901-305b4357e",
38
+ "@react-native/normalize-colors": "0.76.0-nightly-20240901-305b4357e",
39
+ "@react-native/virtualized-lists": "0.76.0-nightly-20240901-305b4357e",
40
40
  "abort-controller": "^3.0.0",
41
41
  "anser": "^1.4.9",
42
42
  "ansi-regex": "^5.0.0",
@@ -50,8 +50,8 @@
50
50
  "jest-environment-node": "^29.6.3",
51
51
  "jsc-android": "^250231.0.0",
52
52
  "memoize-one": "^5.0.0",
53
- "metro-runtime": "^0.80.3",
54
- "metro-source-map": "^0.80.3",
53
+ "metro-runtime": "^0.80.10",
54
+ "metro-source-map": "^0.80.10",
55
55
  "mkdirp": "^0.5.1",
56
56
  "nullthrows": "^1.1.1",
57
57
  "pretty-format": "^26.5.2",
@@ -82,19 +82,19 @@
82
82
  "@types/prop-types": "15.7.1",
83
83
  "@types/react": "^18.2.6",
84
84
  "eslint": "^8.19.0",
85
- "flow-bin": "^0.244.0",
85
+ "flow-bin": "^0.245.0",
86
86
  "jscodeshift": "^0.14.0",
87
87
  "just-scripts": "^1.3.3",
88
88
  "prettier": "2.8.8",
89
89
  "react": "19.0.0-rc-fb9a90fa48-20240614",
90
- "react-native": "0.76.0-nightly-20240824-09e88448c",
90
+ "react-native": "0.76.0-nightly-20240901-305b4357e",
91
91
  "react-native-platform-override": "^1.9.45",
92
92
  "typescript": "5.0.4"
93
93
  },
94
94
  "peerDependencies": {
95
95
  "@types/react": "^18.2.6",
96
96
  "react": "^19.0.0-rc-fb9a90fa48-20240614",
97
- "react-native": "0.76.0-nightly-20240824-09e88448c"
97
+ "react-native": "0.76.0-nightly-20240901-305b4357e"
98
98
  },
99
99
  "beachball": {
100
100
  "defaultNpmTag": "canary",
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<3c32ce3847859db45d2e8bafb3cc31a1>>
7
+ * @generated SignedSource<<3693bce1a6719ef03c1c3148230771b4>>
8
8
  * @flow strict-local
9
9
  */
10
10
 
@@ -60,6 +60,7 @@ export type ReactNativeFeatureFlags = {
60
60
  enableFabricLogs: Getter<boolean>,
61
61
  enableFabricRendererExclusively: Getter<boolean>,
62
62
  enableGranularShadowTreeStateReconciliation: Getter<boolean>,
63
+ enableIOSViewClipToPaddingBox: Getter<boolean>,
63
64
  enableLayoutAnimationsOnIOS: Getter<boolean>,
64
65
  enableLongTaskAPI: Getter<boolean>,
65
66
  enableMicrotasks: Getter<boolean>,
@@ -73,6 +74,7 @@ export type ReactNativeFeatureFlags = {
73
74
  fixIncorrectScrollViewStateUpdateOnAndroid: Getter<boolean>,
74
75
  fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean>,
75
76
  fixMissedFabricStateUpdatesOnAndroid: Getter<boolean>,
77
+ fixMountingCoordinatorReportedPendingTransactionsOnAndroid: Getter<boolean>,
76
78
  forceBatchingMountItemsOnAndroid: Getter<boolean>,
77
79
  fuseboxEnabledDebug: Getter<boolean>,
78
80
  fuseboxEnabledRelease: Getter<boolean>,
@@ -87,6 +89,7 @@ export type ReactNativeFeatureFlags = {
87
89
  useNativeViewConfigsInBridgelessMode: Getter<boolean>,
88
90
  useNewReactImageViewBackgroundDrawing: Getter<boolean>,
89
91
  useOptimisedViewPreallocationOnAndroid: Getter<boolean>,
92
+ useOptimizedEventBatchingOnAndroid: Getter<boolean>,
90
93
  useRuntimeShadowNodeReferenceUpdate: Getter<boolean>,
91
94
  useRuntimeShadowNodeReferenceUpdateOnLayout: Getter<boolean>,
92
95
  useStateAlignmentMechanism: Getter<boolean>,
@@ -219,6 +222,10 @@ export const enableFabricRendererExclusively: Getter<boolean> = createNativeFlag
219
222
  * When enabled, the renderer would only fail commits when they propagate state and the last commit that updated state changed before committing.
220
223
  */
221
224
  export const enableGranularShadowTreeStateReconciliation: Getter<boolean> = createNativeFlagGetter('enableGranularShadowTreeStateReconciliation', false);
225
+ /**
226
+ * iOS Views will clip to their padding box vs border box
227
+ */
228
+ export const enableIOSViewClipToPaddingBox: Getter<boolean> = createNativeFlagGetter('enableIOSViewClipToPaddingBox', false);
222
229
  /**
223
230
  * When enabled, LayoutAnimations API will animate state changes on iOS.
224
231
  */
@@ -271,6 +278,10 @@ export const fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean> =
271
278
  * Enables a fix to prevent the possibility of state updates in Fabric being missed due to race conditions with previous state updates.
272
279
  */
273
280
  export const fixMissedFabricStateUpdatesOnAndroid: Getter<boolean> = createNativeFlagGetter('fixMissedFabricStateUpdatesOnAndroid', false);
281
+ /**
282
+ * Fixes a limitation on Android where the mounting coordinator would report there are no pending transactions but some of them were actually not processed due to the use of the push model.
283
+ */
284
+ export const fixMountingCoordinatorReportedPendingTransactionsOnAndroid: Getter<boolean> = createNativeFlagGetter('fixMountingCoordinatorReportedPendingTransactionsOnAndroid', false);
274
285
  /**
275
286
  * Forces the mounting layer on Android to always batch mount items instead of dispatching them immediately. This might fix some crashes related to synchronous state updates, where some views dispatch state updates during mount.
276
287
  */
@@ -327,6 +338,10 @@ export const useNewReactImageViewBackgroundDrawing: Getter<boolean> = createNati
327
338
  * Moves more of the work in view preallocation to the main thread to free up JS thread.
328
339
  */
329
340
  export const useOptimisedViewPreallocationOnAndroid: Getter<boolean> = createNativeFlagGetter('useOptimisedViewPreallocationOnAndroid', false);
341
+ /**
342
+ * Uses an optimized mechanism for event batching on Android that does not need to wait for a Choreographer frame callback.
343
+ */
344
+ export const useOptimizedEventBatchingOnAndroid: Getter<boolean> = createNativeFlagGetter('useOptimizedEventBatchingOnAndroid', false);
330
345
  /**
331
346
  * When enabled, cloning shadow nodes within react native will update the reference held by the current JS fiber tree.
332
347
  */
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<1f1710a12f6980b23bb6c0ece0060b59>>
7
+ * @generated SignedSource<<6d4aa48dfdd3b78ac5f0f8e70eb3895f>>
8
8
  * @flow strict-local
9
9
  */
10
10
 
@@ -37,6 +37,7 @@ export interface Spec extends TurboModule {
37
37
  +enableFabricLogs?: () => boolean;
38
38
  +enableFabricRendererExclusively?: () => boolean;
39
39
  +enableGranularShadowTreeStateReconciliation?: () => boolean;
40
+ +enableIOSViewClipToPaddingBox?: () => boolean;
40
41
  +enableLayoutAnimationsOnIOS?: () => boolean;
41
42
  +enableLongTaskAPI?: () => boolean;
42
43
  +enableMicrotasks?: () => boolean;
@@ -50,6 +51,7 @@ export interface Spec extends TurboModule {
50
51
  +fixIncorrectScrollViewStateUpdateOnAndroid?: () => boolean;
51
52
  +fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean;
52
53
  +fixMissedFabricStateUpdatesOnAndroid?: () => boolean;
54
+ +fixMountingCoordinatorReportedPendingTransactionsOnAndroid?: () => boolean;
53
55
  +forceBatchingMountItemsOnAndroid?: () => boolean;
54
56
  +fuseboxEnabledDebug?: () => boolean;
55
57
  +fuseboxEnabledRelease?: () => boolean;
@@ -64,6 +66,7 @@ export interface Spec extends TurboModule {
64
66
  +useNativeViewConfigsInBridgelessMode?: () => boolean;
65
67
  +useNewReactImageViewBackgroundDrawing?: () => boolean;
66
68
  +useOptimisedViewPreallocationOnAndroid?: () => boolean;
69
+ +useOptimizedEventBatchingOnAndroid?: () => boolean;
67
70
  +useRuntimeShadowNodeReferenceUpdate?: () => boolean;
68
71
  +useRuntimeShadowNodeReferenceUpdateOnLayout?: () => boolean;
69
72
  +useStateAlignmentMechanism?: () => boolean;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ class FuseboxSessionObserver {
13
+ #hasNativeSupport: boolean;
14
+
15
+ constructor() {
16
+ this.#hasNativeSupport = global.hasOwnProperty(
17
+ '__DEBUGGER_SESSION_OBSERVER__',
18
+ );
19
+ }
20
+
21
+ hasActiveSession(): boolean {
22
+ if (!this.#hasNativeSupport) {
23
+ return false;
24
+ }
25
+
26
+ return global.__DEBUGGER_SESSION_OBSERVER__.hasActiveSession;
27
+ }
28
+
29
+ subscribe(callback: (status: boolean) => void): () => void {
30
+ if (!this.#hasNativeSupport) {
31
+ return () => {};
32
+ }
33
+
34
+ global.__DEBUGGER_SESSION_OBSERVER__.subscribers.add(callback);
35
+ return () => {
36
+ global.__DEBUGGER_SESSION_OBSERVER__.subscribers.delete(callback);
37
+ };
38
+ }
39
+ }
40
+
41
+ const observerInstance: FuseboxSessionObserver = new FuseboxSessionObserver();
42
+ export default observerInstance;
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict
8
- * @format
9
- * @oncall react_native
10
- */
11
-
12
- import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
13
-
14
- import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
15
-
16
- export interface Spec extends TurboModule {
17
- +hasActiveSession: () => boolean;
18
- +subscribe: (callback: (hasActiveSession: boolean) => void) => () => void;
19
- }
20
-
21
- export default (TurboModuleRegistry.get<Spec>(
22
- 'NativeDebuggerSessionObserverCxx',
23
- ): ?Spec);