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

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 (125) hide show
  1. package/.flowconfig +4 -3
  2. package/CHANGELOG.json +31 -1
  3. package/CHANGELOG.md +20 -4
  4. package/Libraries/Animated/AnimatedImplementation.js +7 -7
  5. package/Libraries/Animated/animations/Animation.js +10 -0
  6. package/Libraries/Animated/animations/TimingAnimation.js +1 -0
  7. package/Libraries/Animated/components/AnimatedScrollView.js +2 -2
  8. package/Libraries/Animated/createAnimatedComponent.js +1 -1
  9. package/Libraries/Animated/useAnimatedProps.js +71 -4
  10. package/Libraries/Blob/FileReader.js +1 -1
  11. package/Libraries/Blob/URL.js +2 -62
  12. package/Libraries/Blob/URLSearchParams.js +71 -0
  13. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
  14. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +1 -1
  15. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +3 -0
  16. package/Libraries/Components/ScrollView/ScrollView.js +5 -5
  17. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +3 -3
  18. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
  19. package/Libraries/Components/StatusBar/StatusBar.js +3 -1
  20. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +3 -0
  21. package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
  22. package/Libraries/Components/TextInput/TextInput.js +19 -10
  23. package/Libraries/Components/TextInput/TextInput.win32.js +19 -10
  24. package/Libraries/Components/View/ReactNativeStyleAttributes.js +11 -0
  25. package/Libraries/Components/View/ReactNativeViewAttributes.js +2 -0
  26. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +2 -0
  27. package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  28. package/Libraries/Components/View/ViewNativeComponent.js +6 -0
  29. package/Libraries/Components/View/ViewPropTypes.js +14 -0
  30. package/Libraries/Components/View/ViewPropTypes.win32.js +14 -0
  31. package/Libraries/Core/InitializeCore.js +1 -1
  32. package/Libraries/Core/ReactNativeVersion.js +1 -1
  33. package/Libraries/Core/setUpErrorHandling.js +7 -1
  34. package/Libraries/Image/AssetSourceResolver.js +28 -1
  35. package/Libraries/Image/Image.android.js +9 -14
  36. package/Libraries/Image/Image.ios.js +11 -22
  37. package/Libraries/Image/Image.win32.js +10 -21
  38. package/Libraries/Image/ImageBackground.js +1 -8
  39. package/Libraries/Image/ImageUtils.js +9 -9
  40. package/Libraries/Image/ImageViewNativeComponent.js +3 -0
  41. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  42. package/Libraries/Lists/FlatList.js +1 -1
  43. package/Libraries/Lists/SectionList.js +1 -1
  44. package/Libraries/Lists/SectionListModern.js +3 -3
  45. package/Libraries/LogBox/Data/LogBoxData.js +30 -4
  46. package/Libraries/NativeComponent/BaseViewConfig.android.js +1 -0
  47. package/Libraries/NativeComponent/BaseViewConfig.ios.js +4 -0
  48. package/Libraries/NativeComponent/BaseViewConfig.win32.js +4 -0
  49. package/Libraries/NativeComponent/NativeComponentRegistry.js +13 -20
  50. package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -21
  51. package/Libraries/Network/XMLHttpRequest.js +4 -2
  52. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +1 -1
  53. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +5 -5
  54. package/Libraries/ReactNative/RendererImplementation.js +26 -4
  55. package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
  56. package/Libraries/Renderer/shims/ReactNativeTypes.js +9 -4
  57. package/Libraries/StyleSheet/StyleSheet.js +1 -1
  58. package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
  59. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +11 -0
  60. package/Libraries/StyleSheet/StyleSheetTypes.js +14 -2
  61. package/Libraries/StyleSheet/processBackgroundImage.js +384 -0
  62. package/Libraries/StyleSheet/processFilter.js +4 -4
  63. package/Libraries/Text/Text.js +7 -6
  64. package/Libraries/Text/Text.win32.js +7 -6
  65. package/Libraries/Text/TextNativeComponent.js +7 -0
  66. package/Libraries/Text/TextNativeComponent.win32.js +7 -0
  67. package/Libraries/Utilities/Appearance.js +65 -73
  68. package/Libraries/Utilities/DevLoadingView.js +2 -4
  69. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  70. package/Libraries/Utilities/stringifyViewConfig.js +22 -0
  71. package/Libraries/Utilities/useColorScheme.js +3 -3
  72. package/Libraries/WebSocket/WebSocket.js +1 -1
  73. package/flow/jest.js +2 -2
  74. package/index.js +2 -1
  75. package/index.win32.js +2 -1
  76. package/jest/mockModal.js +1 -3
  77. package/jest/mockScrollView.js +1 -1
  78. package/jest/renderer.js +2 -2
  79. package/jest/setup.js +8 -12
  80. package/overrides.json +12 -12
  81. package/package.json +14 -14
  82. package/src/private/{core/components → components}/HScrollViewNativeComponents.js +8 -8
  83. package/src/private/{core/components → components}/VScrollViewNativeComponents.js +7 -7
  84. package/src/private/{core/components → components}/useSyncOnScroll.js +2 -2
  85. package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -10
  86. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +16 -3
  87. package/src/private/hooks/DebouncedEffectImplementation.js +148 -0
  88. package/src/private/hooks/useDebouncedEffect.js +23 -0
  89. package/{Libraries/Core → src/private/renderer/errorhandling}/ErrorHandlers.js +5 -4
  90. package/src/private/setup/setUpDOM.js +28 -0
  91. package/src/private/setup/setUpIntersectionObserver.js +27 -0
  92. package/src/private/setup/setUpMutationObserver.js +26 -0
  93. package/src/private/setup/setUpPerformanceObserver.js +64 -0
  94. package/src/private/specs/modules/NativeAppearance.js +3 -3
  95. package/src/private/specs/modules/NativeDebuggerSessionObserver.js +23 -0
  96. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
  97. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +5 -3
  98. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
  99. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +14 -17
  100. package/src/private/{specs/modules → webapis/intersectionobserver/specs}/NativeIntersectionObserver.js +2 -2
  101. package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver/specs}/__mocks__/NativeIntersectionObserver.js +4 -4
  102. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserver.js +5 -3
  103. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +24 -15
  104. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationRecord.js +4 -6
  105. package/src/private/{specs/modules → webapis/mutationobserver/specs}/NativeMutationObserver.js +2 -2
  106. package/{Libraries/MutationObserver → src/private/webapis/mutationobserver/specs}/__mocks__/NativeMutationObserver.js +5 -5
  107. package/src/private/webapis/performance/{EventCounts.js → EventTiming.js} +65 -3
  108. package/src/private/webapis/performance/LongTasks.js +39 -0
  109. package/src/private/webapis/performance/Performance.js +22 -9
  110. package/src/private/webapis/performance/PerformanceEntry.js +35 -17
  111. package/src/private/webapis/performance/PerformanceObserver.js +29 -43
  112. package/src/private/webapis/performance/RawPerformanceEntry.js +19 -1
  113. package/src/private/webapis/performance/UserTiming.js +17 -12
  114. package/src/private/webapis/performance/specs/NativePerformanceObserver.js +1 -1
  115. package/src-win/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
  116. package/types/experimental.d.ts +10 -2
  117. package/Libraries/Core/setUpIntersectionObserver.js +0 -16
  118. package/Libraries/Core/setUpMutationObserver.js +0 -16
  119. package/Libraries/Core/setUpPerformanceObserver.js +0 -18
  120. package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +0 -13
  121. package/Libraries/MutationObserver/NativeMutationObserver.js +0 -13
  122. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +0 -135
  123. package/src/private/core/setUpDOM.js +0 -18
  124. package/src/private/webapis/performance/PerformanceEventTiming.js +0 -55
  125. /package/src/private/{core → styles}/composeStyles.js +0 -0
@@ -90,6 +90,8 @@ type DataDetectorTypes =
90
90
  | 'none'
91
91
  | 'all';
92
92
 
93
+ export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
94
+
93
95
  /**
94
96
  * DocumentSelectionState is responsible for maintaining selection information
95
97
  * for a document.
@@ -649,11 +651,39 @@ export interface TextInputProps
649
651
  autoFocus?: boolean | undefined;
650
652
 
651
653
  /**
652
- * If true, the text field will blur when submitted.
653
- * The default value is true.
654
+ * If `true`, the text field will blur when submitted.
655
+ * The default value is true for single-line fields and false for
656
+ * multiline fields. Note that for multiline fields, setting `blurOnSubmit`
657
+ * to `true` means that pressing return will blur the field and trigger the
658
+ * `onSubmitEditing` event instead of inserting a newline into the field.
659
+ *
660
+ * @deprecated
661
+ * Note that `submitBehavior` now takes the place of `blurOnSubmit` and will
662
+ * override any behavior defined by `blurOnSubmit`.
663
+ * @see submitBehavior
654
664
  */
655
665
  blurOnSubmit?: boolean | undefined;
656
666
 
667
+ /**
668
+ * When the return key is pressed,
669
+ *
670
+ * For single line inputs:
671
+ *
672
+ * - `'newline`' defaults to `'blurAndSubmit'`
673
+ * - `undefined` defaults to `'blurAndSubmit'`
674
+ *
675
+ * For multiline inputs:
676
+ *
677
+ * - `'newline'` adds a newline
678
+ * - `undefined` defaults to `'newline'`
679
+ *
680
+ * For both single line and multiline inputs:
681
+ *
682
+ * - `'submit'` will only send a submit event and not blur the input
683
+ * - `'blurAndSubmit`' will both blur the input and send a submit event
684
+ */
685
+ submitBehavior?: SubmitBehavior | undefined;
686
+
657
687
  /**
658
688
  * If true, caret is hidden. The default value is false.
659
689
  */
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
12
+ import type {____TextStyle_Internal as TextStyleInternal} from '../../StyleSheet/StyleSheetTypes';
12
13
  import type {
13
14
  PressEvent,
14
15
  ScrollEvent,
@@ -1534,10 +1535,18 @@ function InternalTextInput(props: Props): React.Node {
1534
1535
  };
1535
1536
  }
1536
1537
 
1537
- let style = flattenStyle<TextStyleProp>(props.style);
1538
- if (typeof style?.fontWeight === 'number') {
1539
- // $FlowFixMe
1540
- style = [style, {fontWeight: style.fontWeight.toString()}];
1538
+ // Keep the original (potentially nested) style when possible, as React can diff these more efficiently
1539
+ let _style = props.style;
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
1550
  }
1542
1551
 
1543
1552
  if (Platform.OS === 'ios') {
@@ -1548,10 +1557,10 @@ function InternalTextInput(props: Props): React.Node {
1548
1557
 
1549
1558
  const useMultilineDefaultStyle =
1550
1559
  props.multiline === true &&
1551
- (style == null ||
1552
- (style.padding == null &&
1553
- style.paddingVertical == null &&
1554
- style.paddingTop == null));
1560
+ (flattenedStyle == null ||
1561
+ (flattenedStyle.padding == null &&
1562
+ flattenedStyle.paddingVertical == null &&
1563
+ flattenedStyle.paddingTop == null));
1555
1564
 
1556
1565
  textInput = (
1557
1566
  <RCTTextInputView
@@ -1578,7 +1587,7 @@ function InternalTextInput(props: Props): React.Node {
1578
1587
  selectionColor={selectionColor}
1579
1588
  style={StyleSheet.compose(
1580
1589
  useMultilineDefaultStyle ? styles.multilineDefault : null,
1581
- style,
1590
+ _style,
1582
1591
  )}
1583
1592
  text={text}
1584
1593
  />
@@ -1645,7 +1654,7 @@ function InternalTextInput(props: Props): React.Node {
1645
1654
  onScroll={_onScroll}
1646
1655
  onSelectionChange={_onSelectionChange}
1647
1656
  placeholder={placeholder}
1648
- style={style}
1657
+ style={_style}
1649
1658
  text={text}
1650
1659
  textBreakStrategy={props.textBreakStrategy}
1651
1660
  />
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
12
+ import type {____TextStyle_Internal as TextStyleInternal} from '../../StyleSheet/StyleSheetTypes';
12
13
  import type {
13
14
  PressEvent,
14
15
  ScrollEvent,
@@ -1641,10 +1642,18 @@ function InternalTextInput(props: Props): React.Node {
1641
1642
  };
1642
1643
  }
1643
1644
 
1644
- let style = flattenStyle<TextStyleProp>(props.style);
1645
- if (typeof style?.fontWeight === 'number') {
1646
- // $FlowFixMe
1647
- style = [style, {fontWeight: style.fontWeight.toString()}];
1645
+ // Keep the original (potentially nested) style when possible, as React can diff these more efficiently
1646
+ let _style = props.style;
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
1657
  }
1649
1658
 
1650
1659
  if (Platform.OS === 'ios') {
@@ -1655,10 +1664,10 @@ function InternalTextInput(props: Props): React.Node {
1655
1664
 
1656
1665
  const useMultilineDefaultStyle =
1657
1666
  props.multiline === true &&
1658
- (style == null ||
1659
- (style.padding == null &&
1660
- style.paddingVertical == null &&
1661
- style.paddingTop == null));
1667
+ (flattenedStyle == null ||
1668
+ (flattenedStyle.padding == null &&
1669
+ flattenedStyle.paddingVertical == null &&
1670
+ flattenedStyle.paddingTop == null));
1662
1671
 
1663
1672
  textInput = (
1664
1673
  <RCTTextInputView
@@ -1686,7 +1695,7 @@ function InternalTextInput(props: Props): React.Node {
1686
1695
  selectionColor={selectionColor}
1687
1696
  style={StyleSheet.compose(
1688
1697
  useMultilineDefaultStyle ? styles.multilineDefault : null,
1689
- style,
1698
+ _style,
1690
1699
  )}
1691
1700
  text={text}
1692
1701
  />
@@ -1754,7 +1763,7 @@ function InternalTextInput(props: Props): React.Node {
1754
1763
  onScroll={_onScroll}
1755
1764
  onSelectionChange={_onSelectionChange}
1756
1765
  placeholder={placeholder}
1757
- style={style}
1766
+ style={_style}
1758
1767
  text={text}
1759
1768
  textBreakStrategy={props.textBreakStrategy}
1760
1769
  />
@@ -11,6 +11,7 @@
11
11
  import type {AnyAttributeType} from '../../Renderer/shims/ReactNativeTypes';
12
12
 
13
13
  import processAspectRatio from '../../StyleSheet/processAspectRatio';
14
+ import processBackgroundImage from '../../StyleSheet/processBackgroundImage';
14
15
  import processBoxShadow from '../../StyleSheet/processBoxShadow';
15
16
  import processColor from '../../StyleSheet/processColor';
16
17
  import processFilter from '../../StyleSheet/processFilter';
@@ -126,11 +127,21 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
126
127
  */
127
128
  experimental_mixBlendMode: true,
128
129
 
130
+ /**
131
+ * Isolation
132
+ */
133
+ isolation: true,
134
+
129
135
  /*
130
136
  * BoxShadow
131
137
  */
132
138
  experimental_boxShadow: {process: processBoxShadow},
133
139
 
140
+ /**
141
+ * Linear Gradient
142
+ */
143
+ experimental_backgroundImage: {process: processBackgroundImage},
144
+
134
145
  /**
135
146
  * View
136
147
  */
@@ -22,6 +22,8 @@ const UIView = {
22
22
  accessibilityValue: true,
23
23
  accessibilityHint: true,
24
24
  accessibilityLanguage: true,
25
+ accessibilityShowsLargeContentViewer: true,
26
+ accessibilityLargeContentTitle: true,
25
27
  importantForAccessibility: true,
26
28
  nativeID: true,
27
29
  testID: true,
@@ -22,6 +22,8 @@ const UIView = {
22
22
  accessibilityValue: true,
23
23
  accessibilityHint: true,
24
24
  accessibilityLanguage: true,
25
+ accessibilityShowsLargeContentViewer: true,
26
+ accessibilityLargeContentTitle: true,
25
27
  importantForAccessibility: true,
26
28
  nativeID: true,
27
29
  testID: true,
@@ -366,6 +366,21 @@ export interface AccessibilityPropsIOS {
366
366
  * @platform ios
367
367
  */
368
368
  accessibilityLanguage?: string | undefined;
369
+
370
+ /**
371
+ * A Boolean value that indicates whether or not to show the item in the large content viewer.
372
+ * Available on iOS 13.0+
373
+ * https://reactnative.dev/docs/accessibility#accessibilityshowslargecontentviewer
374
+ * @platform ios
375
+ */
376
+ accessibilityShowsLargeContentViewer?: boolean | undefined;
377
+
378
+ /**
379
+ * When `accessibilityShowsLargeContentViewer` is set, this string will be used as title for the large content viewer.
380
+ * https://reactnative.dev/docs/accessibility#accessibilitylargecontenttitle
381
+ * @platform ios
382
+ */
383
+ accessibilityLargeContentTitle?: string | undefined;
369
384
  }
370
385
 
371
386
  // [Win32]
@@ -94,11 +94,17 @@ 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
+ },
97
100
 
98
101
  focusable: true,
99
102
  overflow: true,
100
103
  backfaceVisibility: true,
101
104
  experimental_layoutConformance: true,
105
+ experimental_backgroundImage: {
106
+ process: require('../../StyleSheet/processBackgroundImage').default,
107
+ },
102
108
  },
103
109
  }
104
110
  : {
@@ -415,6 +415,20 @@ type IOSViewProps = $ReadOnly<{|
415
415
  */
416
416
  accessibilityViewIsModal?: ?boolean,
417
417
 
418
+ /**
419
+ * @platform ios
420
+ *
421
+ * See https://reactnative.dev/docs/view#accessibilityshowslargecontentviewer
422
+ */
423
+ accessibilityShowsLargeContentViewer?: ?boolean,
424
+
425
+ /**
426
+ * @platform ios
427
+ *
428
+ * See https://reactnative.dev/docs/view#accessibilitylargecontenttitle
429
+ */
430
+ accessibilityLargeContentTitle?: ?string,
431
+
418
432
  /**
419
433
  * The aria-modal attribute indicates content contained within a modal with aria-modal="true"
420
434
  * should be accessible to the user.
@@ -416,6 +416,20 @@ type IOSViewProps = $ReadOnly<{|
416
416
  */
417
417
  accessibilityViewIsModal?: ?boolean,
418
418
 
419
+ /**
420
+ * @platform ios
421
+ *
422
+ * See https://reactnative.dev/docs/view#accessibilityshowslargecontentviewer
423
+ */
424
+ accessibilityShowsLargeContentViewer?: ?boolean,
425
+
426
+ /**
427
+ * @platform ios
428
+ *
429
+ * See https://reactnative.dev/docs/view#accessibilitylargecontenttitle
430
+ */
431
+ accessibilityLargeContentTitle?: ?string,
432
+
419
433
  /**
420
434
  * The aria-modal attribute indicates content contained within a modal with aria-modal="true"
421
435
  * should be accessible to the user.
@@ -29,7 +29,7 @@
29
29
  const start = Date.now();
30
30
 
31
31
  require('./setUpGlobals');
32
- require('../../src/private/core/setUpDOM');
32
+ require('../../src/private/setup/setUpDOM').default();
33
33
  require('./setUpPerformance');
34
34
  require('./setUpErrorHandling');
35
35
  require('./polyfillPromise');
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 76,
19
19
  patch: 0,
20
- prerelease: 'nightly-20240719-6d56cea28',
20
+ prerelease: 'nightly-20240824-09e88448c',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -21,7 +21,13 @@ ExceptionsManager.installConsoleErrorReporter();
21
21
  if (!global.__fbDisableExceptionsManager) {
22
22
  const handleError = (e: mixed, isFatal: boolean) => {
23
23
  try {
24
- ExceptionsManager.handleException(e, isFatal);
24
+ // TODO(T196834299): We should really use a c++ turbomodule for this
25
+ if (
26
+ !global.RN$handleException ||
27
+ !global.RN$handleException(e, isFatal)
28
+ ) {
29
+ ExceptionsManager.handleException(e, isFatal);
30
+ }
25
31
  } catch (ee) {
26
32
  console.log('Failed to print error: ', ee.message);
27
33
  throw e;
@@ -18,7 +18,10 @@ export type ResolvedAssetSource = {|
18
18
  +scale: number,
19
19
  |};
20
20
 
21
- import type {PackagerAsset} from '@react-native/assets-registry/registry';
21
+ import type {
22
+ AssetDestPathResolver,
23
+ PackagerAsset,
24
+ } from '@react-native/assets-registry/registry';
22
25
 
23
26
  const PixelRatio = require('../Utilities/PixelRatio').default;
24
27
  const Platform = require('../Utilities/Platform');
@@ -76,6 +79,10 @@ class AssetSourceResolver {
76
79
  return this.assetServerURL();
77
80
  }
78
81
 
82
+ if (this.asset.resolver != null) {
83
+ return this.getAssetUsingResolver(this.asset.resolver);
84
+ }
85
+
79
86
  if (Platform.OS === 'android') {
80
87
  return this.isLoadedFromFileSystem()
81
88
  ? this.drawableFolderInBundle()
@@ -85,6 +92,26 @@ class AssetSourceResolver {
85
92
  }
86
93
  }
87
94
 
95
+ getAssetUsingResolver(resolver: AssetDestPathResolver): ResolvedAssetSource {
96
+ switch (resolver) {
97
+ case 'android':
98
+ return this.isLoadedFromFileSystem()
99
+ ? this.drawableFolderInBundle()
100
+ : this.resourceIdentifierWithoutScale();
101
+ case 'generic':
102
+ return this.scaledAssetURLNearBundle();
103
+ default:
104
+ throw new Error(
105
+ "Don't know how to get asset via provided resolver: " +
106
+ resolver +
107
+ '\nAsset: ' +
108
+ JSON.stringify(this.asset, null, '\t') +
109
+ '\nPossible resolvers are:' +
110
+ JSON.stringify(['android', 'generic'], null, '\t'),
111
+ );
112
+ }
113
+ }
114
+
88
115
  /**
89
116
  * Returns an absolute URL which can be used to fetch the asset
90
117
  * from the devserver
@@ -150,24 +150,20 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
150
150
  );
151
151
  }
152
152
 
153
- let style;
153
+ let style: ImageStyleProp;
154
154
  let sources;
155
155
  if (Array.isArray(source)) {
156
- style = flattenStyle<ImageStyleProp>([styles.base, props.style]);
156
+ style = [styles.base, props.style];
157
157
  sources = source;
158
158
  } else {
159
159
  const {uri} = source;
160
- const width = source.width ?? props.width;
161
- const height = source.height ?? props.height;
162
- style = flattenStyle<ImageStyleProp>([
163
- {width, height},
164
- styles.base,
165
- props.style,
166
- ]);
167
- sources = [source];
168
160
  if (uri === '') {
169
161
  console.warn('source.uri should not be an empty string');
170
162
  }
163
+ const width = source.width ?? props.width;
164
+ const height = source.height ?? props.height;
165
+ style = [{width, height}, styles.base, props.style];
166
+ sources = [source];
171
167
  }
172
168
 
173
169
  const {height, width, ...restProps} = props;
@@ -203,11 +199,10 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
203
199
  },
204
200
  };
205
201
 
206
- const objectFit = style?.objectFit
207
- ? convertObjectFitToResizeMode(style.objectFit)
208
- : null;
202
+ const flattenedStyle = flattenStyle<ImageStyleProp>(style);
203
+ const objectFit = convertObjectFitToResizeMode(flattenedStyle?.objectFit);
209
204
  const resizeMode =
210
- objectFit || props.resizeMode || style?.resizeMode || 'cover';
205
+ objectFit || props.resizeMode || flattenedStyle?.resizeMode || 'cover';
211
206
 
212
207
  const actualRef = useWrapRefWithImageAttachedCallbacks(forwardedRef);
213
208
 
@@ -8,7 +8,7 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {ImageStyle, ImageStyleProp} from '../StyleSheet/StyleSheet';
11
+ import type {ImageStyleProp} from '../StyleSheet/StyleSheet';
12
12
  import type {RootTag} from '../Types/RootTagTypes';
13
13
  import type {AbstractImageIOS, ImageIOS} from './ImageTypes.flow';
14
14
  import type {ImageSize} from './NativeImageLoaderAndroid';
@@ -112,38 +112,27 @@ let BaseImage: AbstractImageIOS = React.forwardRef((props, forwardedRef) => {
112
112
  height: undefined,
113
113
  };
114
114
 
115
+ let style: ImageStyleProp;
115
116
  let sources;
116
- let style: ImageStyle;
117
-
118
117
  if (Array.isArray(source)) {
119
- style =
120
- flattenStyle<ImageStyleProp>([styles.base, props.style]) ||
121
- ({}: ImageStyle);
118
+ style = [styles.base, props.style];
122
119
  sources = source;
123
120
  } else {
124
121
  const {uri} = source;
125
- const width = source.width ?? props.width;
126
- const height = source.height ?? props.height;
127
- style =
128
- flattenStyle<ImageStyleProp>([
129
- {width, height},
130
- styles.base,
131
- props.style,
132
- ]) || ({}: ImageStyle);
133
- sources = [source];
134
-
135
122
  if (uri === '') {
136
123
  console.warn('source.uri should not be an empty string');
137
124
  }
125
+ const width = source.width ?? props.width;
126
+ const height = source.height ?? props.height;
127
+ style = [{width, height}, styles.base, props.style];
128
+ sources = [source];
138
129
  }
139
130
 
140
- const objectFit =
141
- style.objectFit != null
142
- ? convertObjectFitToResizeMode(style.objectFit)
143
- : null;
131
+ const flattenedStyle = flattenStyle<ImageStyleProp>(style);
132
+ const objectFit = convertObjectFitToResizeMode(flattenedStyle?.objectFit);
144
133
  const resizeMode =
145
- objectFit || props.resizeMode || style.resizeMode || 'cover';
146
- const tintColor = props.tintColor ?? style.tintColor;
134
+ objectFit || props.resizeMode || flattenedStyle?.resizeMode || 'cover';
135
+ const tintColor = props.tintColor ?? flattenedStyle?.tintColor;
147
136
 
148
137
  if (props.children != null) {
149
138
  throw new Error(
@@ -131,38 +131,27 @@ let BaseImage: AbstractImageIOS = React.forwardRef((props, forwardedRef) => {
131
131
  height: undefined,
132
132
  };
133
133
 
134
+ let style: ImageStyleProp;
134
135
  let sources;
135
- let style: ImageStyle;
136
-
137
136
  if (Array.isArray(source)) {
138
- style =
139
- flattenStyle<ImageStyleProp>([styles.base, props.style]) ||
140
- ({}: ImageStyle);
137
+ style = [styles.base, props.style];
141
138
  sources = source;
142
139
  } else {
143
140
  const {uri} = source;
144
- const width = source.width ?? props.width;
145
- const height = source.height ?? props.height;
146
- style =
147
- flattenStyle<ImageStyleProp>([
148
- {width, height},
149
- styles.base,
150
- props.style,
151
- ]) || ({}: ImageStyle);
152
- sources = [source];
153
-
154
141
  if (uri === '') {
155
142
  console.warn('source.uri should not be an empty string');
156
143
  }
144
+ const width = source.width ?? props.width;
145
+ const height = source.height ?? props.height;
146
+ style = [{width, height}, styles.base, props.style];
147
+ sources = [source];
157
148
  }
158
149
 
159
- const objectFit =
160
- style.objectFit != null
161
- ? convertObjectFitToResizeMode(style.objectFit)
162
- : null;
150
+ const flattenedStyle = flattenStyle<ImageStyleProp>(style);
151
+ const objectFit = convertObjectFitToResizeMode(flattenedStyle?.objectFit);
163
152
  const resizeMode =
164
- objectFit || props.resizeMode || style.resizeMode || 'cover';
165
- const tintColor = props.tintColor ?? style.tintColor;
153
+ objectFit || props.resizeMode || flattenedStyle?.resizeMode || 'cover';
154
+ const tintColor = props.tintColor ?? flattenedStyle?.tintColor;
166
155
 
167
156
  if (props.children != null) {
168
157
  throw new Error(
@@ -55,14 +55,7 @@ class ImageBackground extends React.Component<ImageBackgroundProps> {
55
55
 
56
56
  _viewRef: ?React.ElementRef<typeof View> = null;
57
57
 
58
- _captureRef = (
59
- ref: null | React$ElementRef<
60
- React$AbstractComponent<
61
- ViewProps,
62
- React.ElementRef<HostComponent<ViewProps>>,
63
- >,
64
- >,
65
- ) => {
58
+ _captureRef = (ref: null | React.ElementRef<HostComponent<ViewProps>>) => {
66
59
  this._viewRef = ref;
67
60
  };
68
61
 
@@ -10,13 +10,13 @@
10
10
 
11
11
  type ResizeMode = 'cover' | 'contain' | 'stretch' | 'repeat' | 'center';
12
12
 
13
- export function convertObjectFitToResizeMode(objectFit: string): ResizeMode {
14
- const objectFitMap = {
15
- contain: 'contain',
16
- cover: 'cover',
17
- fill: 'stretch',
18
- 'scale-down': 'contain',
19
- };
20
- // $FlowFixMe[invalid-computed-prop]
21
- return objectFitMap[objectFit];
13
+ const objectFitMap: {[string]: ResizeMode} = {
14
+ contain: 'contain',
15
+ cover: 'cover',
16
+ fill: 'stretch',
17
+ 'scale-down': 'contain',
18
+ };
19
+
20
+ export function convertObjectFitToResizeMode(objectFit: ?string): ?ResizeMode {
21
+ return objectFit != null ? objectFitMap[objectFit] : undefined;
22
22
  }
@@ -113,6 +113,9 @@ 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
+ },
116
119
  },
117
120
  }
118
121
  : {
@@ -335,7 +335,7 @@ class NetworkOverlay extends React.Component<Props, State> {
335
335
  _renderItem = ({
336
336
  item,
337
337
  index,
338
- }: RenderItemProps<NetworkRequestInfo>): React.Element<any> => {
338
+ }: RenderItemProps<NetworkRequestInfo>): React.MixedElement => {
339
339
  const tableRowViewStyle = [
340
340
  styles.tableRow,
341
341
  index % 2 === 1 ? styles.tableRowOdd : styles.tableRowEven,
@@ -617,7 +617,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
617
617
  }
618
618
 
619
619
  _renderer = (
620
- ListItemComponent: ?(React.ComponentType<any> | React.Element<any>),
620
+ ListItemComponent: ?(React.ComponentType<any> | React.MixedElement),
621
621
  renderItem: ?RenderItemType<ItemT>,
622
622
  columnWrapperStyle: ?ViewStyleProp,
623
623
  numColumns: ?number,
@@ -33,7 +33,7 @@ type RequiredProps<SectionT: SectionBase<any>> = {|
33
33
  *
34
34
  * sections: $ReadOnlyArray<{
35
35
  * data: $ReadOnlyArray<SectionItem>,
36
- * renderItem?: ({item: SectionItem, ...}) => ?React.Element<*>,
36
+ * renderItem?: ({item: SectionItem, ...}) => ?React.MixedElement,
37
37
  * ItemSeparatorComponent?: ?ReactClass<{highlighted: boolean, ...}>,
38
38
  * }>
39
39
  */
@@ -16,7 +16,7 @@ import type {
16
16
  SectionBase as _SectionBase,
17
17
  VirtualizedSectionListProps,
18
18
  } from '@react-native/virtualized-lists';
19
- import type {AbstractComponent, Element, ElementRef} from 'react';
19
+ import type {AbstractComponent, ElementRef} from 'react';
20
20
 
21
21
  import Platform from '../Utilities/Platform';
22
22
  import {VirtualizedSectionList} from '@react-native/virtualized-lists';
@@ -34,7 +34,7 @@ type RequiredProps<SectionT: SectionBase<any>> = {|
34
34
  *
35
35
  * sections: $ReadOnlyArray<{
36
36
  * data: $ReadOnlyArray<SectionItem>,
37
- * renderItem?: ({item: SectionItem, ...}) => ?React.Element<*>,
37
+ * renderItem?: ({item: SectionItem, ...}) => ?React.MixedElement,
38
38
  * ItemSeparatorComponent?: ?ReactClass<{highlighted: boolean, ...}>,
39
39
  * }>
40
40
  */
@@ -56,7 +56,7 @@ type OptionalProps<SectionT: SectionBase<any>> = {|
56
56
  ...
57
57
  },
58
58
  ...
59
- }) => null | Element<any>,
59
+ }) => null | React.MixedElement,
60
60
  /**
61
61
  * A marker property for telling the list to re-render (since it implements `PureComponent`). If
62
62
  * any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the