react-native-windows 0.0.0-canary.705 → 0.0.0-canary.706

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 (62) hide show
  1. package/.flowconfig +2 -1
  2. package/Libraries/Animated/components/AnimatedFlatList.js +1 -1
  3. package/Libraries/Animated/components/AnimatedSectionList.js +1 -1
  4. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  5. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +3 -1
  6. package/Libraries/Components/TextInput/TextInput.js +2 -0
  7. package/Libraries/Components/TextInput/TextInput.windows.js +2 -0
  8. package/Libraries/Components/ToastAndroid/ToastAndroid.js +9 -1
  9. package/Libraries/Components/ToastAndroid/ToastAndroid.windows.js +9 -1
  10. package/Libraries/Components/View/ViewNativeComponent.js +1 -0
  11. package/Libraries/Components/View/ViewPropTypes.js +9 -0
  12. package/Libraries/Components/View/ViewPropTypes.windows.js +9 -0
  13. package/Libraries/Core/ReactNativeVersion.js +1 -1
  14. package/Libraries/DOM/Nodes/ReadOnlyElement.js +28 -0
  15. package/Libraries/Image/Image.android.js +1 -1
  16. package/Libraries/Image/Image.ios.js +1 -0
  17. package/Libraries/Image/Image.windows.js +1 -0
  18. package/Libraries/NativeComponent/BaseViewConfig.android.js +2 -0
  19. package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -0
  20. package/Libraries/NativeComponent/BaseViewConfig.windows.js +2 -0
  21. package/Libraries/Network/RCTNetworking.android.js +2 -1
  22. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -1
  23. package/Libraries/Pressability/Pressability.js +7 -1
  24. package/Libraries/Pressability/Pressability.windows.js +7 -1
  25. package/Libraries/ReactNative/AppContainer.js +32 -9
  26. package/Libraries/ReactNative/FabricUIManager.js +7 -0
  27. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +3 -0
  28. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +9 -4
  29. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +28 -13
  30. package/Libraries/StyleSheet/PlatformColorValueTypes.windows.js +9 -4
  31. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js +1 -1
  32. package/Libraries/StyleSheet/StyleSheet.js +2 -0
  33. package/Libraries/StyleSheet/StyleSheetTypes.js +1 -1
  34. package/Libraries/StyleSheet/processColor.js +1 -2
  35. package/Libraries/Utilities/Platform.android.js +6 -8
  36. package/Libraries/Utilities/Platform.flow.js +84 -0
  37. package/Libraries/Utilities/Platform.flow.windows.js +111 -0
  38. package/Libraries/Utilities/Platform.ios.js +6 -8
  39. package/Libraries/Utilities/Platform.windows.js +6 -8
  40. package/Microsoft.ReactNative/Fabric/platform/react/components/view/windows/WindowsViewProps.cpp +85 -3
  41. package/Microsoft.ReactNative/Fabric/platform/react/components/view/windows/WindowsViewProps.h +27 -2
  42. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformTouch.h +10 -0
  43. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.h +10 -0
  44. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +32 -0
  45. package/Microsoft.ReactNative/Fabric/platform/react/renderer/core/graphicsConversions.h +1 -1
  46. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/Color.h +3 -2
  47. package/Microsoft.ReactNative/packages.lock.json +40 -41
  48. package/PropertySheets/Generated/PackageVersion.g.props +2 -2
  49. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/{ViewEventEmitter.cpp → BaseViewEventEmitter.cpp} +12 -12
  50. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/{ViewEventEmitter.h → BaseViewEventEmitter.h} +2 -4
  51. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/{ViewProps.cpp → BaseViewProps.cpp} +14 -97
  52. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/{ViewProps.h → BaseViewProps.h} +7 -8
  53. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/TouchEventEmitter.cpp +0 -16
  54. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewShadowNode.cpp +7 -20
  55. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/YogaLayoutableShadowNode.cpp +1020 -0
  56. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/YogaStylableProps.cpp +1 -2
  57. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/primitives.h +6 -43
  58. package/Shared/Shared.vcxitems +5 -2
  59. package/Shared/Shared.vcxitems.filters +2 -0
  60. package/package.json +8 -8
  61. package/types/experimental.d.ts +9 -0
  62. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +0 -1445
package/.flowconfig CHANGED
@@ -37,6 +37,7 @@
37
37
  <PROJECT_ROOT>/Libraries/LogBox/UI/LogBoxInspectorHeader.js
38
38
  <PROJECT_ROOT>/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js
39
39
  <PROJECT_ROOT>/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js
40
+ <PROJECT_ROOT>/Libraries/Utilities/Platform.flow.js
40
41
 
41
42
  ; Ignore react-native files in node_modules since they are copied into project root
42
43
  .*/node_modules/react-native/.*
@@ -133,4 +134,4 @@ untyped-import
133
134
  untyped-type-import
134
135
 
135
136
  [version]
136
- ^0.213.1
137
+ ^0.214.0
@@ -23,7 +23,7 @@ const FlatListWithEventThrottle = React.forwardRef(
23
23
  ref:
24
24
  | ((null | FlatList<mixed>) => mixed)
25
25
  | {current: null | FlatList<mixed>, ...},
26
- ) => <FlatList scrollEventThrottle={0.0001} {...props} ref={ref} />,
26
+ ) => <FlatList {...props} ref={ref} />,
27
27
  );
28
28
 
29
29
  export default (createAnimatedComponent(
@@ -27,7 +27,7 @@ const SectionListWithEventThrottle = React.forwardRef(
27
27
  current: null | SectionList<SectionBase<$FlowFixMe>>,
28
28
  ...
29
29
  },
30
- ) => <SectionList scrollEventThrottle={0.0001} {...props} ref={ref} />,
30
+ ) => <SectionList {...props} ref={ref} />,
31
31
  );
32
32
 
33
33
  export default (createAnimatedComponent(
@@ -10,9 +10,9 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import type {NativeColorValue} from '../../StyleSheet/PlatformColorValueTypes';
14
13
  import type {ProcessedColorValue} from '../../StyleSheet/processColor';
15
14
  import type {ColorValue} from '../../StyleSheet/StyleSheet';
15
+ import type {NativeColorValue} from '../../StyleSheet/StyleSheetTypes';
16
16
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
17
17
 
18
18
  import normalizeColor from '../../StyleSheet/normalizeColor';
@@ -181,7 +181,9 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
181
181
  ...props
182
182
  } = this.props;
183
183
  const drawStatusBar =
184
- Platform.Version >= 21 && this.props.statusBarBackgroundColor != null;
184
+ Platform.OS === 'android' &&
185
+ Platform.Version >= 21 &&
186
+ this.props.statusBarBackgroundColor != null;
185
187
  const drawerViewWrapper = (
186
188
  <View
187
189
  style={[
@@ -1380,6 +1380,7 @@ function InternalTextInput(props: Props): React.Node {
1380
1380
 
1381
1381
  const config = React.useMemo(
1382
1382
  () => ({
1383
+ hitSlop: props.hitSlop,
1383
1384
  onPress: (event: PressEvent) => {
1384
1385
  if (props.editable !== false) {
1385
1386
  if (inputRef.current != null) {
@@ -1394,6 +1395,7 @@ function InternalTextInput(props: Props): React.Node {
1394
1395
  }),
1395
1396
  [
1396
1397
  props.editable,
1398
+ props.hitSlop,
1397
1399
  props.onPressIn,
1398
1400
  props.onPressOut,
1399
1401
  props.rejectResponderTermination,
@@ -1469,6 +1469,7 @@ function InternalTextInput(props: Props): React.Node {
1469
1469
 
1470
1470
  const config = React.useMemo(
1471
1471
  () => ({
1472
+ hitSlop: props.hitSlop,
1472
1473
  onPress: (event: PressEvent) => {
1473
1474
  if (props.editable !== false) {
1474
1475
  if (inputRef.current != null) {
@@ -1483,6 +1484,7 @@ function InternalTextInput(props: Props): React.Node {
1483
1484
  }),
1484
1485
  [
1485
1486
  props.editable,
1487
+ props.hitSlop,
1486
1488
  props.onPressIn,
1487
1489
  props.onPressOut,
1488
1490
  props.rejectResponderTermination,
@@ -5,12 +5,20 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @format
8
- * @noflow
8
+ * @flow strict-local
9
9
  */
10
10
 
11
11
  'use strict';
12
12
 
13
13
  const ToastAndroid = {
14
+ // Dummy fallback toast duration constants
15
+ SHORT: (0: number),
16
+ LONG: (0: number),
17
+ // Dummy fallback toast gravity constants
18
+ TOP: (0: number),
19
+ BOTTOM: (0: number),
20
+ CENTER: (0: number),
21
+
14
22
  show: function (message: string, duration: number): void {
15
23
  console.warn('ToastAndroid is not supported on this platform.');
16
24
  },
@@ -5,12 +5,20 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @format
8
- * @noflow
8
+ * @flow strict-local
9
9
  */
10
10
 
11
11
  'use strict';
12
12
 
13
13
  const ToastAndroid = {
14
+ // Dummy fallback toast duration constants
15
+ SHORT: (0: number),
16
+ LONG: (0: number),
17
+ // Dummy fallback toast gravity constants
18
+ TOP: (0: number),
19
+ BOTTOM: (0: number),
20
+ CENTER: (0: number),
21
+
14
22
  show: function (message: string, duration: number): void {
15
23
  console.warn('ToastAndroid is not supported on this platform.');
16
24
  },
@@ -98,6 +98,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
98
98
  focusable: true,
99
99
  overflow: true,
100
100
  backfaceVisibility: true,
101
+ experimental_layoutConformance: true,
101
102
  },
102
103
  }
103
104
  : {
@@ -568,6 +568,15 @@ export type ViewProps = $ReadOnly<{|
568
568
  */
569
569
  collapsable?: ?boolean,
570
570
 
571
+ /**
572
+ * Contols whether this view, and its transitive children, are laid in a way
573
+ * consistent with web browsers ('strict'), or consistent with existing
574
+ * React Native code which may rely on incorrect behavior ('classic').
575
+ *
576
+ * This prop only works when using Fabric.
577
+ */
578
+ experimental_layoutConformance?: ?('strict' | 'classic'),
579
+
571
580
  /**
572
581
  * Used to locate this view from native classes. Has precedence over `nativeID` prop.
573
582
  *
@@ -634,6 +634,15 @@ export type ViewProps = $ReadOnly<{|
634
634
  */
635
635
  collapsable?: ?boolean,
636
636
 
637
+ /**
638
+ * Contols whether this view, and its transitive children, are laid in a way
639
+ * consistent with web browsers ('strict'), or consistent with existing
640
+ * React Native code which may rely on incorrect behavior ('classic').
641
+ *
642
+ * This prop only works when using Fabric.
643
+ */
644
+ experimental_layoutConformance?: ?('strict' | 'classic'),
645
+
637
646
  /**
638
647
  * Used to locate this view from native classes. Has precedence over `nativeID` prop.
639
648
  *
@@ -13,5 +13,5 @@ exports.version = {
13
13
  major: 0,
14
14
  minor: 73,
15
15
  patch: 0,
16
- prerelease: 'nightly-20230728-c168a4f88',
16
+ prerelease: 'nightly-20230811-68c7cfe62',
17
17
  };
@@ -170,6 +170,34 @@ export default class ReadOnlyElement extends ReadOnlyNode {
170
170
  getClientRects(): DOMRectList {
171
171
  throw new TypeError('Unimplemented');
172
172
  }
173
+
174
+ /**
175
+ * Pointer Capture APIs
176
+ */
177
+ hasPointerCapture(pointerId: number): boolean {
178
+ const node = getShadowNode(this);
179
+ if (node != null) {
180
+ return nullthrows(getFabricUIManager()).hasPointerCapture(
181
+ node,
182
+ pointerId,
183
+ );
184
+ }
185
+ return false;
186
+ }
187
+
188
+ setPointerCapture(pointerId: number): void {
189
+ const node = getShadowNode(this);
190
+ if (node != null) {
191
+ nullthrows(getFabricUIManager()).setPointerCapture(node, pointerId);
192
+ }
193
+ }
194
+
195
+ releasePointerCapture(pointerId: number): void {
196
+ const node = getShadowNode(this);
197
+ if (node != null) {
198
+ nullthrows(getFabricUIManager()).releasePointerCapture(node, pointerId);
199
+ }
200
+ }
173
201
  }
174
202
 
175
203
  function getChildElements(node: ReadOnlyNode): $ReadOnlyArray<ReadOnlyElement> {
@@ -112,7 +112,7 @@ export type ImageComponentStatics = $ReadOnly<{|
112
112
  getSizeWithHeaders: typeof getSizeWithHeaders,
113
113
  prefetch: typeof prefetch,
114
114
  prefetchWithMetadata: typeof prefetchWithMetadata,
115
- abortPrefetch: typeof abortPrefetch,
115
+ abortPrefetch?: typeof abortPrefetch,
116
116
  queryCache: typeof queryCache,
117
117
  resolveAssetSource: typeof resolveAssetSource,
118
118
  |}>;
@@ -91,6 +91,7 @@ export type ImageComponentStatics = $ReadOnly<{|
91
91
  getSizeWithHeaders: typeof getSizeWithHeaders,
92
92
  prefetch: typeof prefetch,
93
93
  prefetchWithMetadata: typeof prefetchWithMetadata,
94
+ abortPrefetch?: number => void,
94
95
  queryCache: typeof queryCache,
95
96
  resolveAssetSource: typeof resolveAssetSource,
96
97
  |}>;
@@ -93,6 +93,7 @@ export type ImageComponentStatics = $ReadOnly<{|
93
93
  getSizeWithHeaders: typeof getSizeWithHeaders,
94
94
  prefetch: typeof prefetch,
95
95
  prefetchWithMetadata: typeof prefetchWithMetadata,
96
+ abortPrefetch?: number => void,
96
97
  queryCache: typeof queryCache,
97
98
  resolveAssetSource: typeof resolveAssetSource,
98
99
  |}>;
@@ -273,6 +273,8 @@ const validAttributesForNonEventProps = {
273
273
  position: true,
274
274
 
275
275
  style: ReactNativeStyleAttributes,
276
+
277
+ experimental_layoutConformance: true,
276
278
  };
277
279
 
278
280
  // Props for bubbling and direct events
@@ -335,6 +335,8 @@ const validAttributesForNonEventProps = {
335
335
  direction: true,
336
336
 
337
337
  style: ReactNativeStyleAttributes,
338
+
339
+ experimental_layoutConformance: true,
338
340
  };
339
341
 
340
342
  // Props for bubbling and direct events
@@ -368,6 +368,8 @@ const validAttributesForNonEventProps = {
368
368
  enableFocusRing: true, // [Windows]
369
369
 
370
370
  style: ReactNativeStyleAttributes,
371
+
372
+ experimental_layoutConformance: true,
371
373
  };
372
374
 
373
375
  // Props for bubbling and direct events
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  import type {RequestBody} from './convertRequestBody';
12
+ import type {NativeResponseType} from './XMLHttpRequest';
12
13
 
13
14
  // Do not require the native RCTNetworking module directly! Use this wrapper module instead.
14
15
  // It will add the necessary requestId, so that you don't have to generate it yourself.
@@ -54,7 +55,7 @@ class RCTNetworking extends NativeEventEmitter<$FlowFixMe> {
54
55
  url: string,
55
56
  headers: Object,
56
57
  data: RequestBody,
57
- responseType: 'text' | 'base64',
58
+ responseType: NativeResponseType,
58
59
  incrementalUpdates: boolean,
59
60
  timeout: number,
60
61
  callback: (requestId: number) => mixed,
@@ -65,6 +65,8 @@ const PERMISSIONS = Object.freeze({
65
65
  READ_MEDIA_IMAGES: 'android.permission.READ_MEDIA_IMAGES',
66
66
  READ_MEDIA_VIDEO: 'android.permission.READ_MEDIA_VIDEO',
67
67
  READ_MEDIA_AUDIO: 'android.permission.READ_MEDIA_AUDIO',
68
+ READ_MEDIA_VISUAL_USER_SELECTED:
69
+ 'android.permission.READ_MEDIA_VISUAL_USER_SELECTED',
68
70
  WRITE_EXTERNAL_STORAGE: 'android.permission.WRITE_EXTERNAL_STORAGE',
69
71
  BLUETOOTH_CONNECT: 'android.permission.BLUETOOTH_CONNECT',
70
72
  BLUETOOTH_SCAN: 'android.permission.BLUETOOTH_SCAN',
@@ -115,6 +117,7 @@ class PermissionsAndroid {
115
117
  READ_MEDIA_IMAGES: string,
116
118
  READ_MEDIA_VIDEO: string,
117
119
  READ_MEDIA_AUDIO: string,
120
+ READ_MEDIA_VISUAL_USER_SELECTED: string,
118
121
  READ_PHONE_NUMBERS: string,
119
122
  READ_PHONE_STATE: string,
120
123
  READ_SMS: string,
@@ -287,7 +290,6 @@ class PermissionsAndroid {
287
290
  NativePermissionsAndroid,
288
291
  'PermissionsAndroid is not installed correctly.',
289
292
  );
290
-
291
293
  return NativePermissionsAndroid.requestMultiplePermissions(permissions);
292
294
  }
293
295
  }
@@ -131,6 +131,12 @@ export type PressabilityConfig = $ReadOnly<{|
131
131
  */
132
132
  onPressOut?: ?(event: PressEvent) => mixed,
133
133
 
134
+ /**
135
+ * Whether to prevent any other native components from becoming responder
136
+ * while this pressable is responder.
137
+ */
138
+ blockNativeResponder?: ?boolean,
139
+
134
140
  /**
135
141
  * Returns whether a long press gesture should cancel the press gesture.
136
142
  * Defaults to true.
@@ -495,7 +501,7 @@ export default class Pressability {
495
501
  this._handleLongPress(event);
496
502
  }, delayLongPress + delayPressIn);
497
503
 
498
- return this._config.cancelable === false;
504
+ return this._config.blockNativeResponder === true;
499
505
  },
500
506
 
501
507
  onResponderMove: (event: PressEvent): void => {
@@ -142,6 +142,12 @@ export type PressabilityConfig = $ReadOnly<{|
142
142
  */
143
143
  onPressOut?: ?(event: PressEvent) => mixed,
144
144
 
145
+ /**
146
+ * Whether to prevent any other native components from becoming responder
147
+ * while this pressable is responder.
148
+ */
149
+ blockNativeResponder?: ?boolean,
150
+
145
151
  /**
146
152
  * Returns whether a long press gesture should cancel the press gesture.
147
153
  * Defaults to true.
@@ -528,7 +534,7 @@ export default class Pressability {
528
534
  this._handleLongPress(event);
529
535
  }, delayLongPress + delayPressIn);
530
536
 
531
- return this._config.cancelable === false;
537
+ return this._config.blockNativeResponder === true;
532
538
  },
533
539
 
534
540
  onResponderMove: (event: PressEvent): void => {
@@ -17,6 +17,8 @@ import {type EventSubscription} from '../vendor/emitter/EventEmitter';
17
17
  import {RootTagContext, createRootTag} from './RootTag';
18
18
  import * as React from 'react';
19
19
 
20
+ const reactDevToolsHook = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
21
+
20
22
  type Props = $ReadOnly<{|
21
23
  children?: React.Node,
22
24
  fabric?: boolean,
@@ -45,9 +47,21 @@ class AppContainer extends React.Component<Props, State> {
45
47
  };
46
48
  _mainRef: ?React.ElementRef<typeof View>;
47
49
  _subscription: ?EventSubscription = null;
50
+ _reactDevToolsAgentListener: ?() => void = null;
48
51
 
49
52
  static getDerivedStateFromError: any = undefined;
50
53
 
54
+ mountReactDevToolsOverlays(): void {
55
+ const DevtoolsOverlay = require('../Inspector/DevtoolsOverlay').default;
56
+ const devtoolsOverlay = <DevtoolsOverlay inspectedView={this._mainRef} />;
57
+
58
+ const TraceUpdateOverlay =
59
+ require('../Components/TraceUpdateOverlay/TraceUpdateOverlay').default;
60
+ const traceUpdateOverlay = <TraceUpdateOverlay />;
61
+
62
+ this.setState({devtoolsOverlay, traceUpdateOverlay});
63
+ }
64
+
51
65
  componentDidMount(): void {
52
66
  if (__DEV__) {
53
67
  if (!this.props.internal_excludeInspector) {
@@ -69,16 +83,21 @@ class AppContainer extends React.Component<Props, State> {
69
83
  this.setState({inspector});
70
84
  },
71
85
  );
72
- if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__ != null) {
73
- const DevtoolsOverlay =
74
- require('../Inspector/DevtoolsOverlay').default;
75
- const devtoolsOverlay = (
76
- <DevtoolsOverlay inspectedView={this._mainRef} />
86
+
87
+ if (reactDevToolsHook != null) {
88
+ if (reactDevToolsHook.reactDevtoolsAgent) {
89
+ // In case if this is not the first AppContainer rendered and React DevTools are already attached
90
+ this.mountReactDevToolsOverlays();
91
+ return;
92
+ }
93
+
94
+ this._reactDevToolsAgentListener = () =>
95
+ this.mountReactDevToolsOverlays();
96
+
97
+ reactDevToolsHook.on(
98
+ 'react-devtools',
99
+ this._reactDevToolsAgentListener,
77
100
  );
78
- const TraceUpdateOverlay =
79
- require('../Components/TraceUpdateOverlay/TraceUpdateOverlay').default;
80
- const traceUpdateOverlay = <TraceUpdateOverlay />;
81
- this.setState({devtoolsOverlay, traceUpdateOverlay});
82
101
  }
83
102
  }
84
103
  }
@@ -88,6 +107,10 @@ class AppContainer extends React.Component<Props, State> {
88
107
  if (this._subscription != null) {
89
108
  this._subscription.remove();
90
109
  }
110
+
111
+ if (reactDevToolsHook != null && this._reactDevToolsAgentListener != null) {
112
+ reactDevToolsHook.off('react-devtools', this._reactDevToolsAgentListener);
113
+ }
91
114
  }
92
115
 
93
116
  render(): React.Node {
@@ -91,6 +91,13 @@ export interface Spec {
91
91
  +getScrollPosition: (
92
92
  node: Node,
93
93
  ) => ?[/* scrollLeft: */ number, /* scrollTop: */ number];
94
+
95
+ /**
96
+ * Support methods for the Pointer Capture APIs.
97
+ */
98
+ +hasPointerCapture: (node: Node, pointerId: number) => boolean;
99
+ +setPointerCapture: (node: Node, pointerId: number) => void;
100
+ +releasePointerCapture: (node: Node, pointerId: number) => void;
94
101
  }
95
102
 
96
103
  let nativeFabricUIManagerProxy: ?Spec;
@@ -312,6 +312,9 @@ const FabricUIManagerMock: IFabricUIManagerMock = {
312
312
  return [x, y, width, height];
313
313
  },
314
314
  ),
315
+ hasPointerCapture: jest.fn((node: Node, pointerId: number): boolean => false),
316
+ setPointerCapture: jest.fn((node: Node, pointerId: number): void => {}),
317
+ releasePointerCapture: jest.fn((node: Node, pointerId: number): void => {}),
315
318
  setNativeProps: jest.fn((node: Node, newProps: NodeProps): void => {}),
316
319
  dispatchCommand: jest.fn(
317
320
  (node: Node, commandName: string, args: Array<mixed>): void => {},
@@ -9,20 +9,25 @@
9
9
  */
10
10
 
11
11
  import type {ProcessedColorValue} from './processColor';
12
- import type {ColorValue} from './StyleSheet';
12
+ import type {ColorValue, NativeColorValue} from './StyleSheet';
13
13
 
14
- export opaque type NativeColorValue = {
14
+ /** The actual type of the opaque NativeColorValue on Android platform */
15
+ type LocalNativeColorValue = {
15
16
  resource_paths?: Array<string>,
16
17
  };
17
18
 
18
19
  export const PlatformColor = (...names: Array<string>): ColorValue => {
19
- return {resource_paths: names};
20
+ /* $FlowExpectedError[incompatible-return]
21
+ * LocalNativeColorValue is the actual type of the opaque NativeColorValue on Android platform */
22
+ return ({resource_paths: names}: LocalNativeColorValue);
20
23
  };
21
24
 
22
25
  export const normalizeColorObject = (
23
26
  color: NativeColorValue,
24
27
  ): ?ProcessedColorValue => {
25
- if ('resource_paths' in color) {
28
+ /* $FlowExpectedError[incompatible-cast]
29
+ * LocalNativeColorValue is the actual type of the opaque NativeColorValue on Android platform */
30
+ if ('resource_paths' in (color: LocalNativeColorValue)) {
26
31
  return color;
27
32
  }
28
33
  return null;
@@ -9,9 +9,10 @@
9
9
  */
10
10
 
11
11
  import type {ProcessedColorValue} from './processColor';
12
- import type {ColorValue} from './StyleSheet';
12
+ import type {ColorValue, NativeColorValue} from './StyleSheet';
13
13
 
14
- export opaque type NativeColorValue = {
14
+ /** The actual type of the opaque NativeColorValue on iOS platform */
15
+ type LocalNativeColorValue = {
15
16
  semantic?: Array<string>,
16
17
  dynamic?: {
17
18
  light: ?(ColorValue | ProcessedColorValue),
@@ -22,7 +23,8 @@ export opaque type NativeColorValue = {
22
23
  };
23
24
 
24
25
  export const PlatformColor = (...names: Array<string>): ColorValue => {
25
- return {semantic: names};
26
+ // $FlowExpectedError[incompatible-return] LocalNativeColorValue is the iOS LocalNativeColorValue type
27
+ return ({semantic: names}: LocalNativeColorValue);
26
28
  };
27
29
 
28
30
  export type DynamicColorIOSTuplePrivate = {
@@ -35,19 +37,21 @@ export type DynamicColorIOSTuplePrivate = {
35
37
  export const DynamicColorIOSPrivate = (
36
38
  tuple: DynamicColorIOSTuplePrivate,
37
39
  ): ColorValue => {
38
- return {
40
+ return ({
39
41
  dynamic: {
40
42
  light: tuple.light,
41
43
  dark: tuple.dark,
42
44
  highContrastLight: tuple.highContrastLight,
43
45
  highContrastDark: tuple.highContrastDark,
44
46
  },
45
- };
47
+ /* $FlowExpectedError[incompatible-return]
48
+ * LocalNativeColorValue is the actual type of the opaque NativeColorValue on iOS platform */
49
+ }: LocalNativeColorValue);
46
50
  };
47
51
 
48
- export const normalizeColorObject = (
49
- color: NativeColorValue,
50
- ): ?ProcessedColorValue => {
52
+ const _normalizeColorObject = (
53
+ color: LocalNativeColorValue,
54
+ ): ?LocalNativeColorValue => {
51
55
  if ('semantic' in color) {
52
56
  // an ios semantic color
53
57
  return color;
@@ -56,7 +60,7 @@ export const normalizeColorObject = (
56
60
 
57
61
  // a dynamic, appearance aware color
58
62
  const dynamic = color.dynamic;
59
- const dynamicColor: NativeColorValue = {
63
+ const dynamicColor: LocalNativeColorValue = {
60
64
  dynamic: {
61
65
  // $FlowFixMe[incompatible-use]
62
66
  light: normalizeColor(dynamic.light),
@@ -70,17 +74,22 @@ export const normalizeColorObject = (
70
74
  };
71
75
  return dynamicColor;
72
76
  }
73
-
74
77
  return null;
75
78
  };
76
79
 
77
- export const processColorObject = (
80
+ export const normalizeColorObject: (
78
81
  color: NativeColorValue,
79
- ): ?NativeColorValue => {
82
+ /* $FlowExpectedError[incompatible-type]
83
+ * LocalNativeColorValue is the actual type of the opaque NativeColorValue on iOS platform */
84
+ ) => ?ProcessedColorValue = _normalizeColorObject;
85
+
86
+ const _processColorObject = (
87
+ color: LocalNativeColorValue,
88
+ ): ?LocalNativeColorValue => {
80
89
  if ('dynamic' in color && color.dynamic != null) {
81
90
  const processColor = require('./processColor').default;
82
91
  const dynamic = color.dynamic;
83
- const dynamicColor: NativeColorValue = {
92
+ const dynamicColor: LocalNativeColorValue = {
84
93
  dynamic: {
85
94
  // $FlowFixMe[incompatible-use]
86
95
  light: processColor(dynamic.light),
@@ -96,3 +105,9 @@ export const processColorObject = (
96
105
  }
97
106
  return color;
98
107
  };
108
+
109
+ export const processColorObject: (
110
+ color: NativeColorValue,
111
+ /* $FlowExpectedError[incompatible-type]
112
+ * LocalNativeColorValue is the actual type of the opaque NativeColorValue on iOS platform */
113
+ ) => ?NativeColorValue = _processColorObject;
@@ -10,21 +10,26 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import type {ColorValue} from './StyleSheet';
13
+ import type {ColorValue, NativeColorValue} from './StyleSheet';
14
14
  import type {ProcessedColorValue} from './processColor';
15
15
 
16
- export opaque type NativeColorValue = {
16
+ /** The actual type of the opaque NativeColorValue on Windows platform */
17
+ type LocalNativeColorValue = {
17
18
  windowsbrush?: Array<string>,
18
19
  };
19
20
 
20
21
  export const PlatformColor = (...names: Array<string>): ColorValue => {
21
- return {windowsbrush: names};
22
+ /* $FlowExpectedError[incompatible-return]
23
+ * LocalNativeColorValue is the actual type of the opaque NativeColorValue on Windows platform */
24
+ return ({windowsbrush: names}: LocalNativeColorValue);
22
25
  };
23
26
 
24
27
  export const normalizeColorObject = (
25
28
  color: NativeColorValue,
26
29
  ): ?ProcessedColorValue => {
27
- if ('windowsbrush' in color) {
30
+ /* $FlowExpectedError[incompatible-cast]
31
+ * LocalNativeColorValue is the actual type of the opaque NativeColorValue on Windows platform */
32
+ if ('windowsbrush' in (color: LocalNativeColorValue)) {
28
33
  return color;
29
34
  }
30
35
  return null;
@@ -10,7 +10,7 @@
10
10
 
11
11
  import type {ColorValue} from './StyleSheet';
12
12
 
13
- import {DynamicColorIOSPrivate} from './PlatformColorValueTypes';
13
+ import {DynamicColorIOSPrivate} from './PlatformColorValueTypes.ios';
14
14
 
15
15
  export type DynamicColorIOSTuple = {
16
16
  light: ColorValue,
@@ -27,6 +27,8 @@ const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleA
27
27
  const PixelRatio = require('../Utilities/PixelRatio').default;
28
28
  const flatten = require('./flattenStyle');
29
29
 
30
+ export type {NativeColorValue} from './StyleSheetTypes';
31
+
30
32
  /**
31
33
  * This type should be used as the type for anything that is a color. It is
32
34
  * most useful when using DynamicColorIOS which can be a string or a dynamic