react-native-windows 0.0.0-canary.718 → 0.0.0-canary.720

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 (25) hide show
  1. package/.flowconfig +2 -1
  2. package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
  3. package/Libraries/Components/TextInput/TextInput.flow.js +5 -0
  4. package/Libraries/Components/TextInput/TextInput.js +26 -11
  5. package/Libraries/Components/TextInput/TextInput.windows.js +26 -11
  6. package/Libraries/Core/ReactNativeVersion.js +1 -1
  7. package/Libraries/Image/resolveAssetSource.windows.js +115 -0
  8. package/Libraries/NativeComponent/NativeComponentRegistry.js +10 -4
  9. package/Libraries/Network/FormData.js +3 -1
  10. package/Libraries/ReactNative/BridgelessUIManager.js +15 -4
  11. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +0 -5
  12. package/Libraries/Utilities/PixelRatio.d.ts +4 -4
  13. package/Microsoft.ReactNative/Utils/ImageUtils.h +0 -1
  14. package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +0 -5
  15. package/PropertySheets/Generated/PackageVersion.g.props +2 -2
  16. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/YogaLayoutableShadowNode.cpp +8 -6
  17. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/YogaStylableProps.cpp +14 -14
  18. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/enums/YogaEnums.h +27 -0
  19. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.h +9 -8
  20. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.cpp +11 -12
  21. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.h +5 -7
  22. package/ReactCommon/Yoga.cpp +22 -22
  23. package/Shared/OInstance.cpp +1 -1
  24. package/package.json +10 -10
  25. package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +0 -85
package/.flowconfig CHANGED
@@ -28,6 +28,7 @@
28
28
  <PROJECT_ROOT>/Libraries/Components/View/View.js
29
29
  <PROJECT_ROOT>/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js
30
30
  <PROJECT_ROOT>/Libraries/Image/Image.js
31
+ <PROJECT_ROOT>/Libraries/Image/resolveAssetSource.js
31
32
  <PROJECT_ROOT>/Libraries/Network/RCTNetworking.js
32
33
  <PROJECT_ROOT>/Libraries/NewAppScreen/components/DebugInstructions.js
33
34
  <PROJECT_ROOT>/Libraries/NewAppScreen/components/ReloadInstructions.js
@@ -141,4 +142,4 @@ untyped-import
141
142
  untyped-type-import
142
143
 
143
144
  [version]
144
- ^0.217.0
145
+ ^0.217.2
@@ -738,6 +738,11 @@ export interface TextInputProps
738
738
  | ((e: NativeSyntheticEvent<TextInputEndEditingEventData>) => void)
739
739
  | undefined;
740
740
 
741
+ /**
742
+ * Called when a single tap gesture is detected.
743
+ */
744
+ onPress?: ((e: NativeSyntheticEvent<NativeTouchEvent>) => void) | undefined;
745
+
741
746
  /**
742
747
  * Callback that is called when a touch is engaged.
743
748
  */
@@ -766,6 +766,11 @@ export type Props = $ReadOnly<{|
766
766
  */
767
767
  unstable_onKeyPressSync?: ?(e: KeyPressEvent) => mixed,
768
768
 
769
+ /**
770
+ * Called when a single tap gesture is detected.
771
+ */
772
+ onPress?: ?(event: PressEvent) => mixed,
773
+
769
774
  /**
770
775
  * Called when a touch is engaged.
771
776
  */
@@ -808,6 +808,11 @@ export type Props = $ReadOnly<{|
808
808
  */
809
809
  unstable_onKeyPressSync?: ?(e: KeyPressEvent) => mixed,
810
810
 
811
+ /**
812
+ * Called when a single tap gesture is detected.
813
+ */
814
+ onPress?: ?(event: PressEvent) => mixed,
815
+
811
816
  /**
812
817
  * Called when a touch is engaged.
813
818
  */
@@ -1378,27 +1383,37 @@ function InternalTextInput(props: Props): React.Node {
1378
1383
  const accessible = props.accessible !== false;
1379
1384
  const focusable = props.focusable !== false;
1380
1385
 
1386
+ const {
1387
+ editable,
1388
+ hitSlop,
1389
+ onPress,
1390
+ onPressIn,
1391
+ onPressOut,
1392
+ rejectResponderTermination,
1393
+ } = props;
1394
+
1381
1395
  const config = React.useMemo(
1382
1396
  () => ({
1383
- hitSlop: props.hitSlop,
1397
+ hitSlop,
1384
1398
  onPress: (event: PressEvent) => {
1385
- if (props.editable !== false) {
1399
+ onPress?.(event);
1400
+ if (editable !== false) {
1386
1401
  if (inputRef.current != null) {
1387
1402
  inputRef.current.focus();
1388
1403
  }
1389
1404
  }
1390
1405
  },
1391
- onPressIn: props.onPressIn,
1392
- onPressOut: props.onPressOut,
1393
- cancelable:
1394
- Platform.OS === 'ios' ? !props.rejectResponderTermination : null,
1406
+ onPressIn: onPressIn,
1407
+ onPressOut: onPressOut,
1408
+ cancelable: Platform.OS === 'ios' ? !rejectResponderTermination : null,
1395
1409
  }),
1396
1410
  [
1397
- props.editable,
1398
- props.hitSlop,
1399
- props.onPressIn,
1400
- props.onPressOut,
1401
- props.rejectResponderTermination,
1411
+ editable,
1412
+ hitSlop,
1413
+ onPress,
1414
+ onPressIn,
1415
+ onPressOut,
1416
+ rejectResponderTermination,
1402
1417
  ],
1403
1418
  );
1404
1419
 
@@ -885,6 +885,11 @@ export type Props = $ReadOnly<{|
885
885
  */
886
886
  unstable_onKeyPressSync?: ?(e: KeyPressEvent) => mixed,
887
887
 
888
+ /**
889
+ * Called when a single tap gesture is detected.
890
+ */
891
+ onPress?: ?(event: PressEvent) => mixed,
892
+
888
893
  /**
889
894
  * Called when a touch is engaged.
890
895
  */
@@ -1467,27 +1472,37 @@ function InternalTextInput(props: Props): React.Node {
1467
1472
 
1468
1473
  const focusable = props.focusable !== false;
1469
1474
 
1475
+ const {
1476
+ editable,
1477
+ hitSlop,
1478
+ onPress,
1479
+ onPressIn,
1480
+ onPressOut,
1481
+ rejectResponderTermination,
1482
+ } = props;
1483
+
1470
1484
  const config = React.useMemo(
1471
1485
  () => ({
1472
- hitSlop: props.hitSlop,
1486
+ hitSlop,
1473
1487
  onPress: (event: PressEvent) => {
1474
- if (props.editable !== false) {
1488
+ onPress?.(event);
1489
+ if (editable !== false) {
1475
1490
  if (inputRef.current != null) {
1476
1491
  inputRef.current.focus();
1477
1492
  }
1478
1493
  }
1479
1494
  },
1480
- onPressIn: props.onPressIn,
1481
- onPressOut: props.onPressOut,
1482
- cancelable:
1483
- Platform.OS === 'ios' ? !props.rejectResponderTermination : null,
1495
+ onPressIn: onPressIn,
1496
+ onPressOut: onPressOut,
1497
+ cancelable: Platform.OS === 'ios' ? !rejectResponderTermination : null,
1484
1498
  }),
1485
1499
  [
1486
- props.editable,
1487
- props.hitSlop,
1488
- props.onPressIn,
1489
- props.onPressOut,
1490
- props.rejectResponderTermination,
1500
+ editable,
1501
+ hitSlop,
1502
+ onPress,
1503
+ onPressIn,
1504
+ onPressOut,
1505
+ rejectResponderTermination,
1491
1506
  ],
1492
1507
  );
1493
1508
 
@@ -13,5 +13,5 @@ exports.version = {
13
13
  major: 0,
14
14
  minor: 73,
15
15
  patch: 0,
16
- prerelease: 'nightly-20230925-2de964cfd',
16
+ prerelease: 'nightly-20231002-0371014a3',
17
17
  };
@@ -0,0 +1,115 @@
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
+ * @format
8
+ * @flow
9
+ */
10
+
11
+ // Resolves an asset into a `source` for `Image`.
12
+
13
+ 'use strict';
14
+
15
+ import type {ResolvedAssetSource} from './AssetSourceResolver';
16
+
17
+ const AssetSourceResolver = require('./AssetSourceResolver');
18
+ const Platform = require('../Utilities/Platform');
19
+ const {pickScale} = require('./AssetUtils');
20
+ const AssetRegistry = require('@react-native/assets-registry/registry');
21
+
22
+ let _customSourceTransformer, _serverURL, _scriptURL;
23
+
24
+ let _sourceCodeScriptURL: ?string;
25
+ function getSourceCodeScriptURL(): ?string {
26
+ if (_sourceCodeScriptURL) {
27
+ return _sourceCodeScriptURL;
28
+ }
29
+
30
+ let sourceCode =
31
+ global.nativeExtensions && global.nativeExtensions.SourceCode;
32
+ if (!sourceCode) {
33
+ sourceCode = require('../NativeModules/specs/NativeSourceCode').default;
34
+ }
35
+ _sourceCodeScriptURL = sourceCode.getConstants().scriptURL;
36
+ return _sourceCodeScriptURL;
37
+ }
38
+
39
+ function getDevServerURL(): ?string {
40
+ if (_serverURL === undefined) {
41
+ const sourceCodeScriptURL = getSourceCodeScriptURL();
42
+ const match =
43
+ sourceCodeScriptURL && sourceCodeScriptURL.match(/^https?:\/\/.*?\//);
44
+ if (match) {
45
+ // jsBundle was loaded from network
46
+ _serverURL = match[0];
47
+ } else {
48
+ // jsBundle was loaded from file
49
+ _serverURL = null;
50
+ }
51
+ }
52
+ return _serverURL;
53
+ }
54
+
55
+ function _coerceLocalScriptURL(scriptURL: ?string): ?string {
56
+ if (Platform.OS === 'windows') {
57
+ return scriptURL;
58
+ }
59
+
60
+ if (scriptURL) {
61
+ if (scriptURL.startsWith('assets://')) {
62
+ // android: running from within assets, no offline path to use
63
+ return null;
64
+ }
65
+ scriptURL = scriptURL.substring(0, scriptURL.lastIndexOf('/') + 1);
66
+ if (!scriptURL.includes('://')) {
67
+ // Add file protocol in case we have an absolute file path and not a URL.
68
+ // This shouldn't really be necessary. scriptURL should be a URL.
69
+ scriptURL = 'file://' + scriptURL;
70
+ }
71
+ }
72
+ return scriptURL;
73
+ }
74
+
75
+ function getScriptURL(): ?string {
76
+ if (_scriptURL === undefined) {
77
+ _scriptURL = _coerceLocalScriptURL(getSourceCodeScriptURL());
78
+ }
79
+ return _scriptURL;
80
+ }
81
+
82
+ function setCustomSourceTransformer(
83
+ transformer: (resolver: AssetSourceResolver) => ResolvedAssetSource,
84
+ ): void {
85
+ _customSourceTransformer = transformer;
86
+ }
87
+
88
+ /**
89
+ * `source` is either a number (opaque type returned by require('./foo.png'))
90
+ * or an `ImageSource` like { uri: '<http location || file path>' }
91
+ */
92
+ function resolveAssetSource(source: any): ?ResolvedAssetSource {
93
+ if (typeof source === 'object') {
94
+ return source;
95
+ }
96
+
97
+ const asset = AssetRegistry.getAssetByID(source);
98
+ if (!asset) {
99
+ return null;
100
+ }
101
+
102
+ const resolver = new AssetSourceResolver(
103
+ getDevServerURL(),
104
+ getScriptURL(),
105
+ asset,
106
+ );
107
+ if (_customSourceTransformer) {
108
+ return _customSourceTransformer(resolver);
109
+ }
110
+ return resolver.defaultAsset();
111
+ }
112
+
113
+ resolveAssetSource.pickScale = pickScale;
114
+ resolveAssetSource.setCustomSourceTransformer = setCustomSourceTransformer;
115
+ module.exports = resolveAssetSource;
@@ -55,14 +55,20 @@ export function get<Config>(
55
55
  ): HostComponent<Config> {
56
56
  ReactNativeViewConfigRegistry.register(name, () => {
57
57
  const {native, strict, verify} = getRuntimeConfig?.(name) ?? {
58
- native: true,
58
+ native: !global.RN$Bridgeless,
59
59
  strict: false,
60
60
  verify: false,
61
61
  };
62
62
 
63
- const viewConfig = native
64
- ? getNativeComponentAttributes(name)
65
- : createViewConfig(viewConfigProvider());
63
+ let viewConfig;
64
+ if (native) {
65
+ viewConfig = getNativeComponentAttributes(name);
66
+ } else {
67
+ viewConfig = createViewConfig(viewConfigProvider());
68
+ if (viewConfig == null) {
69
+ viewConfig = getNativeComponentAttributes(name);
70
+ }
71
+ }
66
72
 
67
73
  if (verify) {
68
74
  const nativeViewConfig = native
@@ -82,7 +82,9 @@ class FormData {
82
82
  // content type (cf. web Blob interface.)
83
83
  if (typeof value === 'object' && !Array.isArray(value) && value) {
84
84
  if (typeof value.name === 'string') {
85
- headers['content-disposition'] += '; filename="' + value.name + '"';
85
+ headers['content-disposition'] += `; filename="${
86
+ value.name
87
+ }"; filename*=utf-8''${encodeURI(value.name)}`;
86
88
  }
87
89
  if (typeof value.type === 'string') {
88
90
  headers['content-type'] = value.type;
@@ -13,7 +13,6 @@
13
13
  import type {RootTag} from '../Types/RootTagTypes';
14
14
 
15
15
  import {unstable_hasComponent} from '../NativeComponent/NativeComponentRegistryUnstable';
16
- import ReactNativeFeatureFlags from './ReactNativeFeatureFlags';
17
16
 
18
17
  let cachedConstants = null;
19
18
 
@@ -22,6 +21,10 @@ const errorMessageForMethod = (methodName: string): string =>
22
21
  methodName +
23
22
  "' is not available in the new React Native architecture.";
24
23
 
24
+ function nativeViewConfigsInBridgelessModeEnabled(): boolean {
25
+ return global.RN$LegacyInterop_UIManager_getConstants !== undefined;
26
+ }
27
+
25
28
  function getCachedConstants(): Object {
26
29
  if (!cachedConstants) {
27
30
  cachedConstants = global.RN$LegacyInterop_UIManager_getConstants();
@@ -29,9 +32,9 @@ function getCachedConstants(): Object {
29
32
  return cachedConstants;
30
33
  }
31
34
 
32
- module.exports = {
35
+ const UIManagerJS: {[string]: $FlowFixMe} = {
33
36
  getViewManagerConfig: (viewManagerName: string): mixed => {
34
- if (ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode()) {
37
+ if (nativeViewConfigsInBridgelessModeEnabled()) {
35
38
  return getCachedConstants()[viewManagerName];
36
39
  } else {
37
40
  console.error(
@@ -46,7 +49,7 @@ module.exports = {
46
49
  return unstable_hasComponent(viewManagerName);
47
50
  },
48
51
  getConstants: (): Object => {
49
- if (ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode()) {
52
+ if (nativeViewConfigsInBridgelessModeEnabled()) {
50
53
  return getCachedConstants();
51
54
  } else {
52
55
  console.error(errorMessageForMethod('getConstants'));
@@ -178,3 +181,11 @@ module.exports = {
178
181
  dismissPopupMenu: (): void =>
179
182
  console.error(errorMessageForMethod('dismissPopupMenu')),
180
183
  };
184
+
185
+ if (nativeViewConfigsInBridgelessModeEnabled()) {
186
+ Object.keys(getCachedConstants()).forEach(viewConfigName => {
187
+ UIManagerJS[viewConfigName] = getCachedConstants()[viewConfigName];
188
+ });
189
+ }
190
+
191
+ module.exports = UIManagerJS;
@@ -54,10 +54,6 @@ export type FeatureFlags = {|
54
54
  * Enables use of setNativeProps in JS driven animations.
55
55
  */
56
56
  shouldUseSetNativePropsInFabric: () => boolean,
57
- /**
58
- * Enables native view configs in brdgeless mode.
59
- */
60
- enableNativeViewConfigsInBridgelessMode: () => boolean,
61
57
  /**
62
58
  * Enables a hotfix for forcing materialization of views with elevation set.
63
59
  */
@@ -74,7 +70,6 @@ const ReactNativeFeatureFlags: FeatureFlags = {
74
70
  enableAccessToHostTreeInFabric: () => false,
75
71
  shouldUseAnimatedObjectForTransform: () => false,
76
72
  shouldUseSetNativePropsInFabric: () => false,
77
- enableNativeViewConfigsInBridgelessMode: () => false,
78
73
  shouldForceUnflattenForElevation: () => false,
79
74
  };
80
75
 
@@ -32,11 +32,11 @@ export interface PixelRatioStatic {
32
32
  used to calculate the absolute font size, so any elements that
33
33
  heavily depend on that should use this to do calculations.
34
34
 
35
- If a font scale is not set, this returns the device pixel ratio.
35
+ * on Android value reflects the user preference set in Settings > Display > Font size
36
+ * on iOS value reflects the user preference set in Settings > Display & Brightness > Text Size,
37
+ value can also be updated in Settings > Accessibility > Display & Text Size > Larger Text
36
38
 
37
- Currently this is only implemented on Android and reflects the user
38
- preference set in Settings > Display > Font size,
39
- on iOS it will always return the default pixel ratio.
39
+ If a font scale is not set, this returns the device pixel ratio.
40
40
  */
41
41
  getFontScale(): number;
42
42
 
@@ -13,7 +13,6 @@ enum class ImageSourceFormat { Bitmap = 0, Svg = 1 };
13
13
  struct ReactImageSource {
14
14
  std::string uri;
15
15
  std::string method;
16
- std::string bundleRootPath;
17
16
  std::vector<std::pair<std::string, std::string>> headers;
18
17
  double width = 0;
19
18
  double height = 0;
@@ -185,11 +185,6 @@ void ImageViewManager::EmitImageEvent(
185
185
 
186
186
  void ImageViewManager::setSource(winrt::Grid grid, const winrt::Microsoft::ReactNative::JSValue &data) {
187
187
  auto sources{json_type_traits<std::vector<ReactImageSource>>::parseJson(data)};
188
- sources[0].bundleRootPath = GetReactContext().SettingsSnapshot().BundleRootPath();
189
-
190
- if (sources[0].packagerAsset && sources[0].uri.find("file://") == 0) {
191
- sources[0].uri.replace(0, 7, sources[0].bundleRootPath);
192
- }
193
188
 
194
189
  auto reactImage{grid.as<ReactImage>()};
195
190
 
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.0.0-canary.718</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.0.0-canary.720</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>0</ReactNativeWindowsMinor>
16
16
  <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>true</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>a0946739c12f78f5151c1168ec73b57f0af9cbe9</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>eced4875349d205e61fbe17f9390dfae60b0cdee</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -533,9 +533,11 @@ void YogaLayoutableShadowNode::setSize(Size size) const {
533
533
 
534
534
  auto style = yogaNode_.getStyle();
535
535
  style.setDimension(
536
- YGDimensionWidth, yoga::CompactValue::ofMaybe<YGUnitPoint>(size.width));
536
+ yoga::Dimension::Width,
537
+ yoga::CompactValue::ofMaybe<YGUnitPoint>(size.width));
537
538
  style.setDimension(
538
- YGDimensionHeight, yoga::CompactValue::ofMaybe<YGUnitPoint>(size.height));
539
+ yoga::Dimension::Height,
540
+ yoga::CompactValue::ofMaybe<YGUnitPoint>(size.height));
539
541
  yogaNode_.setStyle(style);
540
542
  yogaNode_.setDirty(true);
541
543
  }
@@ -631,19 +633,19 @@ void YogaLayoutableShadowNode::layoutTree(
631
633
  auto ownerHeight = yogaFloatFromFloat(maximumSize.height);
632
634
 
633
635
  yogaStyle.setMaxDimension(
634
- YGDimensionWidth,
636
+ yoga::Dimension::Width,
635
637
  yoga::CompactValue::ofMaybe<YGUnitPoint>(maximumSize.width));
636
638
 
637
639
  yogaStyle.setMaxDimension(
638
- YGDimensionHeight,
640
+ yoga::Dimension::Height,
639
641
  yoga::CompactValue::ofMaybe<YGUnitPoint>(maximumSize.height));
640
642
 
641
643
  yogaStyle.setMinDimension(
642
- YGDimensionWidth,
644
+ yoga::Dimension::Width,
643
645
  yoga::CompactValue::ofMaybe<YGUnitPoint>(minimumSize.width));
644
646
 
645
647
  yogaStyle.setMinDimension(
646
- YGDimensionHeight,
648
+ yoga::Dimension::Height,
647
649
  yoga::CompactValue::ofMaybe<YGUnitPoint>(minimumSize.height));
648
650
 
649
651
  auto direction =
@@ -191,9 +191,9 @@ static inline T const getFieldValue(
191
191
 
192
192
  #define REBUILD_FIELD_YG_DIMENSION(field, setter, widthStr, heightStr) \
193
193
  REBUILD_YG_FIELD_SWITCH_CASE_INDEXED_SETTER( \
194
- field, setter, YGDimensionWidth, widthStr); \
194
+ field, setter, yoga::Dimension::Width, widthStr); \
195
195
  REBUILD_YG_FIELD_SWITCH_CASE_INDEXED_SETTER( \
196
- field, setter, YGDimensionHeight, heightStr);
196
+ field, setter, yoga::Dimension::Height, heightStr);
197
197
 
198
198
  #define REBUILD_FIELD_YG_GUTTER(field, rowGapStr, columnGapStr, gapStr) \
199
199
  REBUILD_YG_FIELD_SWITCH_CASE_INDEXED(field, YGGutterRow, rowGapStr); \
@@ -349,28 +349,28 @@ SharedDebugStringConvertibleList YogaStylableProps::getDebugProps() const {
349
349
  "border", yogaStyle.border(), defaultYogaStyle.border()),
350
350
  debugStringConvertibleItem(
351
351
  "width",
352
- yogaStyle.dimension(YGDimensionWidth),
353
- defaultYogaStyle.dimension(YGDimensionWidth)),
352
+ yogaStyle.dimension(yoga::Dimension::Width),
353
+ defaultYogaStyle.dimension(yoga::Dimension::Width)),
354
354
  debugStringConvertibleItem(
355
355
  "height",
356
- yogaStyle.dimension(YGDimensionHeight),
357
- defaultYogaStyle.dimension(YGDimensionHeight)),
356
+ yogaStyle.dimension(yoga::Dimension::Height),
357
+ defaultYogaStyle.dimension(yoga::Dimension::Height)),
358
358
  debugStringConvertibleItem(
359
359
  "minWidth",
360
- yogaStyle.minDimension(YGDimensionWidth),
361
- defaultYogaStyle.minDimension(YGDimensionWidth)),
360
+ yogaStyle.minDimension(yoga::Dimension::Width),
361
+ defaultYogaStyle.minDimension(yoga::Dimension::Width)),
362
362
  debugStringConvertibleItem(
363
363
  "minHeight",
364
- yogaStyle.minDimension(YGDimensionHeight),
365
- defaultYogaStyle.minDimension(YGDimensionHeight)),
364
+ yogaStyle.minDimension(yoga::Dimension::Height),
365
+ defaultYogaStyle.minDimension(yoga::Dimension::Height)),
366
366
  debugStringConvertibleItem(
367
367
  "maxWidth",
368
- yogaStyle.maxDimension(YGDimensionWidth),
369
- defaultYogaStyle.maxDimension(YGDimensionWidth)),
368
+ yogaStyle.maxDimension(yoga::Dimension::Width),
369
+ defaultYogaStyle.maxDimension(yoga::Dimension::Width)),
370
370
  debugStringConvertibleItem(
371
371
  "maxHeight",
372
- yogaStyle.maxDimension(YGDimensionHeight),
373
- defaultYogaStyle.maxDimension(YGDimensionHeight)),
372
+ yogaStyle.maxDimension(yoga::Dimension::Height),
373
+ defaultYogaStyle.maxDimension(yoga::Dimension::Height)),
374
374
  debugStringConvertibleItem(
375
375
  "aspectRatio",
376
376
  yogaStyle.aspectRatio(),
@@ -0,0 +1,27 @@
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
+
8
+ #pragma once
9
+
10
+ #include <type_traits>
11
+
12
+ namespace facebook::yoga {
13
+
14
+ template <typename EnumT>
15
+ constexpr inline int32_t ordinalCount();
16
+
17
+ template <typename EnumT>
18
+ constexpr inline int32_t bitCount();
19
+
20
+ // Polyfill of C++ 23 to_underlying()
21
+ // https://en.cppreference.com/w/cpp/utility/to_underlying
22
+ template <typename T>
23
+ constexpr auto to_underlying(T e) noexcept {
24
+ return static_cast<std::underlying_type_t<decltype(e)>>(e);
25
+ }
26
+
27
+ } // namespace facebook::yoga
@@ -10,6 +10,7 @@
10
10
  #include <array>
11
11
 
12
12
  #include <yoga/bits/NumericBitfield.h>
13
+ #include <yoga/enums/Dimension.h>
13
14
  #include <yoga/enums/Direction.h>
14
15
  #include <yoga/node/CachedMeasurement.h>
15
16
  #include <yoga/numeric/FloatOptional.h>
@@ -63,20 +64,20 @@ struct LayoutResults {
63
64
  hadOverflow_ = hadOverflow;
64
65
  }
65
66
 
66
- float dimension(YGDimension axis) const {
67
- return dimensions_[axis];
67
+ float dimension(Dimension axis) const {
68
+ return dimensions_[yoga::to_underlying(axis)];
68
69
  }
69
70
 
70
- void setDimension(YGDimension axis, float dimension) {
71
- dimensions_[axis] = dimension;
71
+ void setDimension(Dimension axis, float dimension) {
72
+ dimensions_[yoga::to_underlying(axis)] = dimension;
72
73
  }
73
74
 
74
- float measuredDimension(YGDimension axis) const {
75
- return measuredDimensions_[axis];
75
+ float measuredDimension(Dimension axis) const {
76
+ return measuredDimensions_[yoga::to_underlying(axis)];
76
77
  }
77
78
 
78
- void setMeasuredDimension(YGDimension axis, float dimension) {
79
- measuredDimensions_[axis] = dimension;
79
+ void setMeasuredDimension(Dimension axis, float dimension) {
80
+ measuredDimensions_[yoga::to_underlying(axis)] = dimension;
80
81
  }
81
82
 
82
83
  bool operator==(LayoutResults layout) const;
@@ -202,13 +202,13 @@ FloatOptional Node::getMarginForAxis(
202
202
  return getLeadingMargin(axis, widthSize) + getTrailingMargin(axis, widthSize);
203
203
  }
204
204
 
205
- FloatOptional Node::getGapForAxis(
206
- const FlexDirection axis,
207
- const float widthSize) const {
205
+ float Node::getGapForAxis(const FlexDirection axis, const float widthSize)
206
+ const {
208
207
  auto gap = isRow(axis)
209
- ? computeColumnGap(style_.gap(), CompactValue::ofZero())
210
- : computeRowGap(style_.gap(), CompactValue::ofZero());
211
- return yoga::resolveValue(gap, widthSize);
208
+ ? computeColumnGap(style_.gap(), CompactValue::ofUndefined())
209
+ : computeRowGap(style_.gap(), CompactValue::ofUndefined());
210
+ auto resolvedGap = yoga::resolveValue(gap, widthSize);
211
+ return maxOrDefined(resolvedGap.unwrap(), 0);
212
212
  }
213
213
 
214
214
  YGSize Node::measure(
@@ -339,7 +339,7 @@ void Node::setLayoutComputedFlexBasisGeneration(
339
339
 
340
340
  void Node::setLayoutMeasuredDimension(
341
341
  float measuredDimension,
342
- YGDimension dimension) {
342
+ Dimension dimension) {
343
343
  layout_.setMeasuredDimension(dimension, measuredDimension);
344
344
  }
345
345
 
@@ -347,7 +347,7 @@ void Node::setLayoutHadOverflow(bool hadOverflow) {
347
347
  layout_.setHadOverflow(hadOverflow);
348
348
  }
349
349
 
350
- void Node::setLayoutDimension(float dimensionValue, YGDimension dimension) {
350
+ void Node::setLayoutDimension(float dimensionValue, Dimension dimension) {
351
351
  layout_.setDimension(dimension, dimensionValue);
352
352
  }
353
353
 
@@ -433,14 +433,13 @@ YGValue Node::resolveFlexBasisPtr() const {
433
433
  }
434
434
 
435
435
  void Node::resolveDimension() {
436
- using namespace yoga;
437
436
  const Style& style = getStyle();
438
- for (auto dim : {YGDimensionWidth, YGDimensionHeight}) {
437
+ for (auto dim : {Dimension::Width, Dimension::Height}) {
439
438
  if (!style.maxDimension(dim).isUndefined() &&
440
439
  yoga::inexactEquals(style.maxDimension(dim), style.minDimension(dim))) {
441
- resolvedDimensions_[dim] = style.maxDimension(dim);
440
+ resolvedDimensions_[yoga::to_underlying(dim)] = style.maxDimension(dim);
442
441
  } else {
443
- resolvedDimensions_[dim] = style.dimension(dim);
442
+ resolvedDimensions_[yoga::to_underlying(dim)] = style.dimension(dim);
444
443
  }
445
444
  }
446
445
  }
@@ -14,6 +14,7 @@
14
14
  #include <yoga/Yoga.h>
15
15
 
16
16
  #include <yoga/config/Config.h>
17
+ #include <yoga/enums/Dimension.h>
17
18
  #include <yoga/enums/Direction.h>
18
19
  #include <yoga/enums/Errata.h>
19
20
  #include <yoga/enums/MeasureMode.h>
@@ -175,7 +176,7 @@ class YG_EXPORT Node : public ::YGNode {
175
176
  return resolvedDimensions_;
176
177
  }
177
178
 
178
- YGValue getResolvedDimension(YGDimension dimension) const {
179
+ YGValue getResolvedDimension(Dimension dimension) const {
179
180
  return resolvedDimensions_[static_cast<size_t>(dimension)];
180
181
  }
181
182
 
@@ -230,8 +231,7 @@ class YG_EXPORT Node : public ::YGNode {
230
231
  FloatOptional getMarginForAxis(
231
232
  const FlexDirection axis,
232
233
  const float widthSize) const;
233
- FloatOptional getGapForAxis(const FlexDirection axis, const float widthSize)
234
- const;
234
+ float getGapForAxis(const FlexDirection axis, const float widthSize) const;
235
235
  // Setters
236
236
 
237
237
  void setContext(void* context) {
@@ -293,11 +293,9 @@ class YG_EXPORT Node : public ::YGNode {
293
293
  void setLayoutComputedFlexBasis(const FloatOptional computedFlexBasis);
294
294
  void setLayoutComputedFlexBasisGeneration(
295
295
  uint32_t computedFlexBasisGeneration);
296
- void setLayoutMeasuredDimension(
297
- float measuredDimension,
298
- YGDimension dimension);
296
+ void setLayoutMeasuredDimension(float measuredDimension, Dimension dimension);
299
297
  void setLayoutHadOverflow(bool hadOverflow);
300
- void setLayoutDimension(float dimensionValue, YGDimension dimension);
298
+ void setLayoutDimension(float dimensionValue, Dimension dimension);
301
299
  void setLayoutDirection(Direction direction);
302
300
  void setLayoutMargin(float margin, YGEdge edge);
303
301
  void setLayoutBorder(float border, YGEdge edge);
@@ -661,97 +661,97 @@ void YGNodeStyleSetAspectRatio(const YGNodeRef node, const float aspectRatio) {
661
661
  void YGNodeStyleSetWidth(YGNodeRef node, float points) {
662
662
  auto value = CompactValue::ofMaybe<YGUnitPoint>(points);
663
663
  updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
664
- node, YGDimensionWidth, value);
664
+ node, Dimension::Width, value);
665
665
  }
666
666
  void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) {
667
667
  auto value = CompactValue::ofMaybe<YGUnitPercent>(percent);
668
668
  updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
669
- node, YGDimensionWidth, value);
669
+ node, Dimension::Width, value);
670
670
  }
671
671
  void YGNodeStyleSetWidthAuto(YGNodeRef node) {
672
672
  updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
673
- node, YGDimensionWidth, CompactValue::ofAuto());
673
+ node, Dimension::Width, CompactValue::ofAuto());
674
674
  }
675
675
  YGValue YGNodeStyleGetWidth(YGNodeConstRef node) {
676
- return resolveRef(node)->getStyle().dimension(YGDimensionWidth);
676
+ return resolveRef(node)->getStyle().dimension(Dimension::Width);
677
677
  }
678
678
 
679
679
  void YGNodeStyleSetHeight(YGNodeRef node, float points) {
680
680
  auto value = CompactValue::ofMaybe<YGUnitPoint>(points);
681
681
  updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
682
- node, YGDimensionHeight, value);
682
+ node, Dimension::Height, value);
683
683
  }
684
684
  void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) {
685
685
  auto value = CompactValue::ofMaybe<YGUnitPercent>(percent);
686
686
  updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
687
- node, YGDimensionHeight, value);
687
+ node, Dimension::Height, value);
688
688
  }
689
689
  void YGNodeStyleSetHeightAuto(YGNodeRef node) {
690
690
  updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
691
- node, YGDimensionHeight, CompactValue::ofAuto());
691
+ node, Dimension::Height, CompactValue::ofAuto());
692
692
  }
693
693
  YGValue YGNodeStyleGetHeight(YGNodeConstRef node) {
694
- return resolveRef(node)->getStyle().dimension(YGDimensionHeight);
694
+ return resolveRef(node)->getStyle().dimension(Dimension::Height);
695
695
  }
696
696
 
697
697
  void YGNodeStyleSetMinWidth(const YGNodeRef node, const float minWidth) {
698
698
  auto value = CompactValue::ofMaybe<YGUnitPoint>(minWidth);
699
699
  updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>(
700
- node, YGDimensionWidth, value);
700
+ node, Dimension::Width, value);
701
701
  }
702
702
  void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) {
703
703
  auto value = CompactValue::ofMaybe<YGUnitPercent>(minWidth);
704
704
  updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>(
705
- node, YGDimensionWidth, value);
705
+ node, Dimension::Width, value);
706
706
  }
707
707
  YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) {
708
- return resolveRef(node)->getStyle().minDimension(YGDimensionWidth);
708
+ return resolveRef(node)->getStyle().minDimension(Dimension::Width);
709
709
  }
710
710
 
711
711
  void YGNodeStyleSetMinHeight(const YGNodeRef node, const float minHeight) {
712
712
  auto value = CompactValue::ofMaybe<YGUnitPoint>(minHeight);
713
713
  updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>(
714
- node, YGDimensionHeight, value);
714
+ node, Dimension::Height, value);
715
715
  }
716
716
  void YGNodeStyleSetMinHeightPercent(
717
717
  const YGNodeRef node,
718
718
  const float minHeight) {
719
719
  auto value = CompactValue::ofMaybe<YGUnitPercent>(minHeight);
720
720
  updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>(
721
- node, YGDimensionHeight, value);
721
+ node, Dimension::Height, value);
722
722
  }
723
723
  YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) {
724
- return resolveRef(node)->getStyle().minDimension(YGDimensionHeight);
724
+ return resolveRef(node)->getStyle().minDimension(Dimension::Height);
725
725
  }
726
726
 
727
727
  void YGNodeStyleSetMaxWidth(const YGNodeRef node, const float maxWidth) {
728
728
  auto value = CompactValue::ofMaybe<YGUnitPoint>(maxWidth);
729
729
  updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>(
730
- node, YGDimensionWidth, value);
730
+ node, Dimension::Width, value);
731
731
  }
732
732
  void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) {
733
733
  auto value = CompactValue::ofMaybe<YGUnitPercent>(maxWidth);
734
734
  updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>(
735
- node, YGDimensionWidth, value);
735
+ node, Dimension::Width, value);
736
736
  }
737
737
  YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) {
738
- return resolveRef(node)->getStyle().maxDimension(YGDimensionWidth);
738
+ return resolveRef(node)->getStyle().maxDimension(Dimension::Width);
739
739
  }
740
740
 
741
741
  void YGNodeStyleSetMaxHeight(const YGNodeRef node, const float maxHeight) {
742
742
  auto value = CompactValue::ofMaybe<YGUnitPoint>(maxHeight);
743
743
  updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>(
744
- node, YGDimensionHeight, value);
744
+ node, Dimension::Height, value);
745
745
  }
746
746
  void YGNodeStyleSetMaxHeightPercent(
747
747
  const YGNodeRef node,
748
748
  const float maxHeight) {
749
749
  auto value = CompactValue::ofMaybe<YGUnitPercent>(maxHeight);
750
750
  updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>(
751
- node, YGDimensionHeight, value);
751
+ node, Dimension::Height, value);
752
752
  }
753
753
  YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) {
754
- return resolveRef(node)->getStyle().maxDimension(YGDimensionHeight);
754
+ return resolveRef(node)->getStyle().maxDimension(Dimension::Height);
755
755
  }
756
756
 
757
757
  namespace {
@@ -804,11 +804,11 @@ float YGNodeLayoutGetBottom(const YGNodeConstRef node) {
804
804
  }
805
805
 
806
806
  float YGNodeLayoutGetWidth(const YGNodeConstRef node) {
807
- return resolveRef(node)->getLayout().dimension(YGDimensionWidth);
807
+ return resolveRef(node)->getLayout().dimension(Dimension::Width);
808
808
  }
809
809
 
810
810
  float YGNodeLayoutGetHeight(const YGNodeConstRef node) {
811
- return resolveRef(node)->getLayout().dimension(YGDimensionHeight);
811
+ return resolveRef(node)->getLayout().dimension(Dimension::Height);
812
812
  }
813
813
 
814
814
  YGDirection YGNodeLayoutGetDirection(const YGNodeConstRef node) {
@@ -597,7 +597,7 @@ std::vector<std::unique_ptr<NativeModule>> InstanceImpl::GetDefaultNativeModules
597
597
  m_devSettings->useFastRefresh,
598
598
  m_devSettings->inlineSourceMap,
599
599
  hermesBytecodeVersion)
600
- : std::string();
600
+ : m_devSettings->bundleRootPath;
601
601
  modules.push_back(std::make_unique<CxxNativeModule>(
602
602
  m_innerInstance,
603
603
  facebook::react::SourceCodeModule::Name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.0.0-canary.718",
3
+ "version": "0.0.0-canary.720",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,13 +28,13 @@
28
28
  "@react-native-community/cli-platform-ios": "12.0.0-alpha.15",
29
29
  "@react-native-windows/cli": "0.0.0-canary.192",
30
30
  "@react-native/assets": "1.0.0",
31
- "@react-native/assets-registry": "0.73.0-nightly-20230925-2de964cfd",
32
- "@react-native/codegen": "0.73.0-nightly-20230925-2de964cfd",
33
- "@react-native/community-cli-plugin": "0.73.0-nightly-20230925-2de964cfd",
34
- "@react-native/gradle-plugin": "0.73.0-nightly-20230925-2de964cfd",
35
- "@react-native/js-polyfills": "0.73.0-nightly-20230925-2de964cfd",
36
- "@react-native/normalize-colors": "0.73.0-nightly-20230925-2de964cfd",
37
- "@react-native/virtualized-lists": "0.73.0-nightly-20230925-2de964cfd",
31
+ "@react-native/assets-registry": "0.73.0-nightly-20231002-0371014a3",
32
+ "@react-native/codegen": "0.73.0-nightly-20231002-0371014a3",
33
+ "@react-native/community-cli-plugin": "0.73.0-nightly-20231002-0371014a3",
34
+ "@react-native/gradle-plugin": "0.73.0-nightly-20231002-0371014a3",
35
+ "@react-native/js-polyfills": "0.73.0-nightly-20231002-0371014a3",
36
+ "@react-native/normalize-colors": "0.73.0-nightly-20231002-0371014a3",
37
+ "@react-native/virtualized-lists": "0.73.0-nightly-20231002-0371014a3",
38
38
  "abort-controller": "^3.0.0",
39
39
  "anser": "^1.4.9",
40
40
  "ansi-regex": "^5.0.0",
@@ -81,14 +81,14 @@
81
81
  "just-scripts": "^1.3.3",
82
82
  "prettier": "^2.4.1",
83
83
  "react": "18.2.0",
84
- "react-native": "0.73.0-nightly-20230925-2de964cfd",
84
+ "react-native": "0.73.0-nightly-20231002-0371014a3",
85
85
  "react-native-platform-override": "^1.9.16",
86
86
  "react-refresh": "^0.4.0",
87
87
  "typescript": "^4.9.5"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "react": "18.2.0",
91
- "react-native": "0.73.0-nightly-20230925-2de964cfd"
91
+ "react-native": "0.73.0-nightly-20231002-0371014a3"
92
92
  },
93
93
  "beachball": {
94
94
  "defaultNpmTag": "canary",
@@ -1,85 +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-local
8
- * @format
9
- */
10
-
11
- 'use strict';
12
-
13
- import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
14
-
15
- const ScrollViewViewConfig = {
16
- uiViewClassName: 'RCTScrollView',
17
- bubblingEventTypes: {},
18
- directEventTypes: {
19
- topScrollToTop: {
20
- registrationName: 'onScrollToTop',
21
- },
22
- },
23
- validAttributes: {
24
- alwaysBounceHorizontal: true,
25
- alwaysBounceVertical: true,
26
- automaticallyAdjustContentInsets: true,
27
- automaticallyAdjustKeyboardInsets: true,
28
- automaticallyAdjustsScrollIndicatorInsets: true,
29
- bounces: true,
30
- bouncesZoom: true,
31
- canCancelContentTouches: true,
32
- centerContent: true,
33
- contentInset: {
34
- diff: require('../../Utilities/differ/pointsDiffer'),
35
- },
36
- contentOffset: {
37
- diff: require('../../Utilities/differ/pointsDiffer'),
38
- },
39
- contentInsetAdjustmentBehavior: true,
40
- decelerationRate: true,
41
- directionalLockEnabled: true,
42
- disableIntervalMomentum: true,
43
- endFillColor: {
44
- process: require('../../StyleSheet/processColor').default,
45
- },
46
- fadingEdgeLength: true,
47
- indicatorStyle: true,
48
- inverted: true,
49
- isInvertedVirtualizedList: true,
50
- keyboardDismissMode: true,
51
- maintainVisibleContentPosition: true,
52
- maximumZoomScale: true,
53
- minimumZoomScale: true,
54
- nestedScrollEnabled: true,
55
- onMomentumScrollBegin: true,
56
- onMomentumScrollEnd: true,
57
- onScroll: true,
58
- onScrollBeginDrag: true,
59
- onScrollEndDrag: true,
60
- onScrollToTop: true,
61
- overScrollMode: true,
62
- pagingEnabled: true,
63
- persistentScrollbar: true,
64
- pinchGestureEnabled: true,
65
- scrollEnabled: true,
66
- scrollEventThrottle: true,
67
- scrollIndicatorInsets: {
68
- diff: require('../../Utilities/differ/pointsDiffer'),
69
- },
70
- scrollPerfTag: true,
71
- scrollToOverflowEnabled: true,
72
- scrollsToTop: true,
73
- sendMomentumEvents: true,
74
- showsHorizontalScrollIndicator: true,
75
- showsVerticalScrollIndicator: true,
76
- snapToAlignment: true,
77
- snapToEnd: true,
78
- snapToInterval: true,
79
- snapToOffsets: true,
80
- snapToStart: true,
81
- zoomScale: true,
82
- },
83
- };
84
-
85
- module.exports = (ScrollViewViewConfig: PartialViewConfig);