@office-iss/react-native-win32 0.66.2 → 0.67.0-preview.3

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 (120) hide show
  1. package/.eslintignore +2 -0
  2. package/.flowconfig +6 -1
  3. package/CHANGELOG.json +209 -33
  4. package/CHANGELOG.md +96 -20
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +14 -1
  6. package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +2 -0
  7. package/Libraries/Animated/AnimatedEvent.js +23 -4
  8. package/Libraries/Animated/NativeAnimatedHelper.js +2 -2
  9. package/Libraries/Animated/components/AnimatedImage.js +3 -3
  10. package/Libraries/Animated/components/AnimatedScrollView.js +3 -3
  11. package/Libraries/Animated/components/AnimatedText.js +3 -3
  12. package/Libraries/Animated/components/AnimatedView.js +1 -3
  13. package/Libraries/Animated/createAnimatedComponent.js +3 -34
  14. package/Libraries/Components/Button/ButtonWin32.js +2 -2
  15. package/Libraries/Components/Button/ButtonWin32.js.map +1 -1
  16. package/Libraries/Components/Button.js +3 -0
  17. package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +3 -6
  18. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -7
  19. package/Libraries/Components/EnterString.win32.js +3 -3
  20. package/Libraries/Components/EnterString.win32.js.map +1 -1
  21. package/Libraries/Components/Pressable/Pressable.win32.js +384 -0
  22. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +1 -0
  23. package/Libraries/Components/ScrollView/ScrollView.js +17 -16
  24. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +268 -252
  25. package/Libraries/Components/Text/Tests/TextWin32Test.d.ts +0 -1
  26. package/Libraries/Components/Text/TextWin32.Props.d.ts +2 -2
  27. package/Libraries/Components/Text/TextWin32.Props.js.map +1 -1
  28. package/Libraries/Components/Text/TextWin32.js +1 -1
  29. package/Libraries/Components/Text/TextWin32.js.map +1 -1
  30. package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +0 -1
  31. package/Libraries/Components/TextInput/TextInput.win32.js +6 -6
  32. package/Libraries/Components/TextInput/TextInput.win32.js.map +1 -1
  33. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +0 -1
  34. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js +1 -1
  35. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  36. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +2 -2
  37. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js.map +1 -1
  38. package/Libraries/Components/Touchable/TouchableWin32.js +2 -2
  39. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  40. package/Libraries/Components/View/Tests/ViewWin32Test.d.ts +0 -1
  41. package/Libraries/Components/View/View.js +1 -1
  42. package/Libraries/Components/View/View.win32.js +59 -3
  43. package/Libraries/Components/View/ViewAccessibility.js +1 -1
  44. package/Libraries/Components/View/ViewPropTypes.win32.js +546 -0
  45. package/Libraries/Components/View/ViewWin32.Props.d.ts +3 -6
  46. package/Libraries/Components/View/ViewWin32.Props.js.map +1 -1
  47. package/Libraries/Components/View/ViewWin32.js +5 -5
  48. package/Libraries/Components/View/ViewWin32.js.map +1 -1
  49. package/Libraries/Core/ExceptionsManager.js +45 -80
  50. package/Libraries/Core/ExtendedError.js +0 -1
  51. package/Libraries/Core/ReactNativeVersion.js +2 -2
  52. package/Libraries/Core/setUpBatchedBridge.js +1 -1
  53. package/Libraries/Core/setUpGlobals.js +2 -4
  54. package/Libraries/Core/setUpTimers.js +2 -2
  55. package/Libraries/Image/Image.ios.js +6 -0
  56. package/Libraries/Image/Image.win32.js +6 -0
  57. package/Libraries/Image/ImageBackground.js +10 -8
  58. package/Libraries/Image/ImageProps.js +28 -0
  59. package/Libraries/Image/Tests/ImageWin32Test.d.ts +0 -1
  60. package/Libraries/LogBox/Data/LogBoxData.js +18 -19
  61. package/Libraries/LogBox/UI/LogBoxImages/alert-triangle.png +0 -0
  62. package/Libraries/LogBox/UI/LogBoxImages/chevron-left.png +0 -0
  63. package/Libraries/LogBox/UI/LogBoxImages/chevron-right.png +0 -0
  64. package/Libraries/LogBox/UI/LogBoxImages/close.png +0 -0
  65. package/Libraries/LogBox/UI/LogBoxImages/loader.png +0 -0
  66. package/Libraries/NewAppScreen/components/logo.png +0 -0
  67. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +2 -1
  68. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +2 -0
  69. package/Libraries/PersonaCoin/PersonaCoin.js +3 -2
  70. package/Libraries/PersonaCoin/PersonaCoin.js.map +1 -1
  71. package/Libraries/Pressability/HoverState.win32.js +60 -0
  72. package/Libraries/Pressability/Pressability.js +13 -13
  73. package/Libraries/Pressability/Pressability.win32.js +962 -0
  74. package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -1
  75. package/Libraries/ReactNative/AppRegistry.js +4 -2
  76. package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +1569 -875
  77. package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +529 -319
  78. package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +570 -362
  79. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +1592 -891
  80. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +521 -311
  81. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +562 -354
  82. package/Libraries/Share/Share.js +1 -1
  83. package/Libraries/StyleSheet/normalizeColor.js +2 -2
  84. package/Libraries/Text/TextProps.js +1 -7
  85. package/Libraries/TurboModule/TurboModuleRegistry.js +1 -1
  86. package/Libraries/Types/CoreEventTypes.win32.js +191 -0
  87. package/Libraries/Utilities/HMRClient.js +1 -1
  88. package/flow/global.js +45 -0
  89. package/index.js +15 -10
  90. package/index.win32.js +15 -10
  91. package/jest/mockModal.js +31 -0
  92. package/jest/setup.js +5 -3
  93. package/overrides.json +42 -13
  94. package/package.json +20 -18
  95. package/rntypes/BatchedBridge.d.ts +23 -0
  96. package/rntypes/Devtools.d.ts +20 -0
  97. package/rntypes/LaunchScreen.d.ts +9 -0
  98. package/rntypes/globals.d.ts +496 -0
  99. package/rntypes/index.d.ts +9966 -0
  100. package/rntypes/legacy-properties.d.ts +266 -0
  101. package/src/Libraries/Components/Text/TextWin32.Props.ts +2 -2
  102. package/src/Libraries/Components/View/ViewWin32.Props.ts +6 -12
  103. package/src/rntypes/BatchedBridge.d.ts +23 -0
  104. package/src/rntypes/Devtools.d.ts +20 -0
  105. package/src/rntypes/LaunchScreen.d.ts +9 -0
  106. package/src/rntypes/globals.d.ts +496 -0
  107. package/src/rntypes/index.d.ts +9966 -0
  108. package/src/rntypes/legacy-properties.d.ts +266 -0
  109. package/src/typings-index.ts +11 -4
  110. package/typings-index.d.ts +3 -1
  111. package/typings-index.js +7 -5
  112. package/typings-index.js.map +1 -1
  113. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js +0 -87
  114. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js +0 -30
  115. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.win32.js +0 -30
  116. package/Libraries/Components/DatePickerAndroid/DatePickerAndroidTypes.js +0 -30
  117. package/Libraries/Components/StaticContainer.react.js +0 -51
  118. package/Libraries/Components/Touchable/ensurePositiveDelayProps.js +0 -25
  119. package/Libraries/Interaction/InteractionMixin.js +0 -54
  120. package/Libraries/ReactNative/queryLayoutByID.js +0 -58
@@ -15,9 +15,9 @@ const createAnimatedComponent = require('../createAnimatedComponent');
15
15
 
16
16
  import type {AnimatedComponentType} from '../createAnimatedComponent';
17
17
 
18
- module.exports = (createAnimatedComponent((Text: $FlowFixMe), {
19
- collapsable: false,
20
- }): AnimatedComponentType<
18
+ module.exports = (createAnimatedComponent(
19
+ (Text: $FlowFixMe),
20
+ ): AnimatedComponentType<
21
21
  React.ElementConfig<typeof Text>,
22
22
  React.ElementRef<typeof Text>,
23
23
  >);
@@ -15,9 +15,7 @@ const createAnimatedComponent = require('../createAnimatedComponent');
15
15
 
16
16
  import type {AnimatedComponentType} from '../createAnimatedComponent';
17
17
 
18
- module.exports = (createAnimatedComponent(View, {
19
- collapsable: true,
20
- }): AnimatedComponentType<
18
+ module.exports = (createAnimatedComponent(View): AnimatedComponentType<
21
19
  React.ElementConfig<typeof View>,
22
20
  React.ElementRef<typeof View>,
23
21
  >);
@@ -39,13 +39,8 @@ export type AnimatedComponentType<
39
39
  Instance,
40
40
  >;
41
41
 
42
- type AnimatedComponentOptions = {
43
- collapsable?: boolean,
44
- };
45
-
46
42
  function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
47
43
  Component: React.AbstractComponent<Props, Instance>,
48
- options?: AnimatedComponentOptions,
49
44
  ): AnimatedComponentType<Props, Instance> {
50
45
  invariant(
51
46
  typeof Component !== 'function' ||
@@ -210,39 +205,13 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
210
205
  this.props.passthroughAnimatedPropExplicitValues || {};
211
206
  const mergedStyle = {...style, ...passthruStyle};
212
207
 
213
- // On Fabric, we always want to ensure the container Animated View is *not*
214
- // flattened.
215
- // Because we do not get a host component ref immediately and thus cannot
216
- // do a proper Fabric vs non-Fabric detection immediately, we default to assuming
217
- // that Fabric *is* enabled until we know otherwise.
218
- // Thus, in Fabric, this view will never be flattened. In non-Fabric, the view will
219
- // not be flattened during the initial render but may be flattened in the second render
220
- // and onwards.
221
- const forceNativeIdFabric =
222
- (this._component == null &&
223
- (options?.collapsable === false || props.collapsable !== true)) ||
224
- this._isFabric();
225
-
226
- const forceNativeId =
227
- props.collapsable ??
228
- (this._propsAnimated.__isNative ||
229
- forceNativeIdFabric ||
230
- options?.collapsable === false);
231
- // The native driver updates views directly through the UI thread so we
232
- // have to make sure the view doesn't get optimized away because it cannot
233
- // go through the NativeViewHierarchyManager since it operates on the shadow
234
- // thread. TODO: T68258846
235
- const collapsableProps = forceNativeId
236
- ? {
237
- nativeID: props.nativeID ?? 'animatedComponent',
238
- collapsable: false,
239
- }
240
- : {};
208
+ // Force `collapsable` to be false so that native view is not flattened.
209
+ // Flattened views cannot be accurately referenced by a native driver.
241
210
  return (
242
211
  <Component
243
212
  {...props}
244
213
  {...passthruProps}
245
- {...collapsableProps}
214
+ collapsable={false}
246
215
  style={mergedStyle}
247
216
  ref={this._setComponentRef}
248
217
  />
@@ -76,8 +76,8 @@ class ButtonWin32 extends react_1.default.Component {
76
76
  if (this.props.color) {
77
77
  textProps.style = { color: this.props.color };
78
78
  }
79
- return (react_1.default.createElement(ViewWin32_1.ViewWin32, Object.assign({}, viewProps),
80
- react_1.default.createElement(TextWin32_1.TextWin32, Object.assign({}, textProps), this.props.title)));
79
+ return (react_1.default.createElement(ViewWin32_1.ViewWin32, { ...viewProps },
80
+ react_1.default.createElement(TextWin32_1.TextWin32, { ...textProps }, this.props.title)));
81
81
  }
82
82
  }
83
83
  exports.ButtonWin32 = ButtonWin32;
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonWin32.js","sourceRoot":"","sources":["../../../src/Libraries/Components/Button/ButtonWin32.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAEzB,iDAA8C;AAE9C,iDAA8C;AAI9C,IAAW,WAGV;AAHD,WAAW,WAAW;IACpB,2DAAW,CAAA;IACX,qDAAQ,CAAA;AACV,CAAC,EAHU,WAAW,KAAX,WAAW,QAGrB;AAMD;;GAEG;AACH,MAAa,WAAY,SAAQ,eAAK,CAAC,SAA+C;IACpF,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QAmCE,eAAU,GAAG,CAAC,MAAmB,EAAqB,EAAE;YACvE,OAAO;gBACL,kBAAkB,EAAE;oBAClB,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;oBAC7B,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC,QAAQ;iBAC1C;aACF,CAAC;QACJ,CAAC,CAAC;QAEe,cAAS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AAkB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB;YACjD,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAmC;SACtD,CAAC;QAEF,MAAM,SAAS,GAAoB;YACjC,SAAS,EAAE,MAAM;SAClB,CAAC;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACpB,SAAS,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;SAC/C;QAED,OAAO,CACL,8BAAC,qBAAS,oBAAK,SAAS;YACtB,8BAAC,qBAAS,oBAAK,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAa,CAC9C,CACb,CAAC;IACJ,CAAC;CAwCF;AA3ED,kCA2EC","sourcesContent":["import React from 'react'\nimport RN = require('react-native');\nimport { ViewWin32 } from '../View/ViewWin32';\nimport { IViewWin32Props } from '../View/ViewWin32.Props';\nimport { TextWin32 } from '../Text/TextWin32';\nimport { ITextWin32Props } from '../Text/TextWin32.Props';\nimport { IButtonWin32Props } from './ButtonWin32.Props';\n\nconst enum SelectState {\n NotSelected,\n Selected\n}\n\ninterface IButtonWin32State {\n accessibilityState: RN.AccessibilityState;\n}\n\n/**\n * React-native <Button> control with additional Win32-specific functionality.\n */\nexport class ButtonWin32 extends React.Component<IButtonWin32Props, IButtonWin32State> {\n constructor(props: IButtonWin32Props) {\n super(props);\n this.state = this._makeState(SelectState.NotSelected);\n }\n\n public render() {\n const viewProps: IViewWin32Props = {\n accessible: true,\n accessibilityLabel: this.props.accessibilityLabel || this.props.title,\n accessibilityRole: 'button',\n accessibilityState: this.state.accessibilityState,\n focusable: true,\n onFocus: this._onFocus,\n onBlur: this._onBlur,\n onMouseEnter: this.props.onMouseEnter,\n onMouseLeave: this.props.onMouseLeave,\n onTouchStart: this.props.onTouchStart,\n onTouchEnd: this._onTouchEnd,\n testID: this.props.testID,\n style: this.props.style as RN.StyleProp<RN.ViewStyle>,\n };\n\n const textProps: ITextWin32Props = {\n textStyle: 'None',\n };\n if (this.props.color) {\n textProps.style = { color: this.props.color };\n }\n\n return (\n <ViewWin32 {...viewProps}>\n <TextWin32 {...textProps}>{this.props.title}</TextWin32>\n </ViewWin32>\n );\n }\n\n private readonly _makeState = (select: SelectState): IButtonWin32State => {\n return {\n accessibilityState: {\n disabled: this.props.disabled,\n selected: select === SelectState.Selected,\n },\n };\n };\n\n private readonly _setState = (select: SelectState): void => {\n const state = this._makeState(select);\n this.setState(state);\n };\n\n private readonly _onFocus = (): void => {\n this._setState(SelectState.Selected);\n if (this.props.onFocus) {\n this.props.onFocus();\n }\n };\n\n private readonly _onBlur = (): void => {\n this._setState(SelectState.NotSelected);\n if (this.props.onBlur) {\n this.props.onBlur();\n }\n };\n\n private readonly _onTouchEnd = (event: RN.GestureResponderEvent): void => {\n if (!this.props.disabled) {\n if (this.props.onPress) {\n this.props.onPress(event);\n }\n }\n if (this.props.onTouchEnd) {\n this.props.onTouchEnd(event);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"ButtonWin32.js","sourceRoot":"","sources":["../../../src/Libraries/Components/Button/ButtonWin32.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAEzB,iDAA8C;AAE9C,iDAA8C;AAI9C,IAAW,WAGV;AAHD,WAAW,WAAW;IACpB,2DAAW,CAAA;IACX,qDAAQ,CAAA;AACV,CAAC,EAHU,WAAW,KAAX,WAAW,QAGrB;AAMD;;GAEG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AAC,KAAK,CAAC,CAAC;aAC9B;QACH,CAAC,CAAC;QAvEA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACxD,CAAC;IAEM,MAAM;QACX,MAAM,SAAS,GAAoB;YACjC,UAAU,EAAE,IAAI;YAChB,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK;YACrE,iBAAiB,EAAE,QAAQ;YAC3B,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB;YACjD,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAmC;SACtD,CAAC;QAEF,MAAM,SAAS,GAAoB;YACjC,SAAS,EAAE,MAAM;SAClB,CAAC;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACpB,SAAS,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;SAC/C;QAED,OAAO,CACL,8BAAC,qBAAS,OAAK,SAAS;YACtB,8BAAC,qBAAS,OAAK,SAAS,IAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAa,CAC9C,CACb,CAAC;IACJ,CAAC;CAwCF;AA3ED,kCA2EC","sourcesContent":["import React from 'react'\nimport RN = require('react-native');\nimport { ViewWin32 } from '../View/ViewWin32';\nimport { IViewWin32Props } from '../View/ViewWin32.Props';\nimport { TextWin32 } from '../Text/TextWin32';\nimport { ITextWin32Props } from '../Text/TextWin32.Props';\nimport { IButtonWin32Props } from './ButtonWin32.Props';\n\nconst enum SelectState {\n NotSelected,\n Selected\n}\n\ninterface IButtonWin32State {\n accessibilityState: RN.AccessibilityState;\n}\n\n/**\n * React-native <Button> control with additional Win32-specific functionality.\n */\nexport class ButtonWin32 extends React.Component<IButtonWin32Props, IButtonWin32State> {\n constructor(props: IButtonWin32Props) {\n super(props);\n this.state = this._makeState(SelectState.NotSelected);\n }\n\n public render() {\n const viewProps: IViewWin32Props = {\n accessible: true,\n accessibilityLabel: this.props.accessibilityLabel || this.props.title,\n accessibilityRole: 'button',\n accessibilityState: this.state.accessibilityState,\n focusable: true,\n onFocus: this._onFocus,\n onBlur: this._onBlur,\n onMouseEnter: this.props.onMouseEnter,\n onMouseLeave: this.props.onMouseLeave,\n onTouchStart: this.props.onTouchStart,\n onTouchEnd: this._onTouchEnd,\n testID: this.props.testID,\n style: this.props.style as RN.StyleProp<RN.ViewStyle>,\n };\n\n const textProps: ITextWin32Props = {\n textStyle: 'None',\n };\n if (this.props.color) {\n textProps.style = { color: this.props.color };\n }\n\n return (\n <ViewWin32 {...viewProps}>\n <TextWin32 {...textProps}>{this.props.title}</TextWin32>\n </ViewWin32>\n );\n }\n\n private readonly _makeState = (select: SelectState): IButtonWin32State => {\n return {\n accessibilityState: {\n disabled: this.props.disabled,\n selected: select === SelectState.Selected,\n },\n };\n };\n\n private readonly _setState = (select: SelectState): void => {\n const state = this._makeState(select);\n this.setState(state);\n };\n\n private readonly _onFocus = (): void => {\n this._setState(SelectState.Selected);\n if (this.props.onFocus) {\n this.props.onFocus();\n }\n };\n\n private readonly _onBlur = (): void => {\n this._setState(SelectState.NotSelected);\n if (this.props.onBlur) {\n this.props.onBlur();\n }\n };\n\n private readonly _onTouchEnd = (event: RN.GestureResponderEvent): void => {\n if (!this.props.disabled) {\n if (this.props.onPress) {\n this.props.onPress(event);\n }\n }\n if (this.props.onTouchEnd) {\n this.props.onTouchEnd(event);\n }\n };\n}\n"]}
@@ -145,6 +145,7 @@ type ButtonProps = $ReadOnly<{|
145
145
  accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
146
146
  onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
147
147
  accessibilityState?: ?AccessibilityState,
148
+ accessibilityHint?: ?string,
148
149
  |}>;
149
150
 
150
151
  /**
@@ -275,6 +276,7 @@ class Button extends React.Component<ButtonProps> {
275
276
  testID,
276
277
  accessible,
277
278
  accessibilityActions,
279
+ accessibilityHint,
278
280
  onAccessibilityAction,
279
281
  } = this.props;
280
282
  const buttonStyles = [styles.button];
@@ -317,6 +319,7 @@ class Button extends React.Component<ButtonProps> {
317
319
  accessibilityActions={accessibilityActions}
318
320
  onAccessibilityAction={onAccessibilityAction}
319
321
  accessibilityLabel={accessibilityLabel}
322
+ accessibilityHint={accessibilityHint}
320
323
  accessibilityRole="button"
321
324
  accessibilityState={accessibilityState}
322
325
  hasTVPreferredFocus={hasTVPreferredFocus}
@@ -117,10 +117,6 @@ type Props = $ReadOnly<{|
117
117
  * source of truth.
118
118
  */
119
119
  class DatePickerIOS extends React.Component<Props> {
120
- static DefaultProps: {|mode: $TEMPORARY$string<'datetime'>|} = {
121
- mode: 'datetime',
122
- };
123
-
124
120
  _picker: ?React.ElementRef<typeof RCTDatePickerNativeComponent> = null;
125
121
 
126
122
  componentDidUpdate() {
@@ -142,6 +138,7 @@ class DatePickerIOS extends React.Component<Props> {
142
138
 
143
139
  render(): React.Node {
144
140
  const props = this.props;
141
+ const mode = props.mode ?? 'datetime';
145
142
  invariant(
146
143
  props.date || props.initialDate,
147
144
  'A selected date or initial date should be specified.',
@@ -153,7 +150,7 @@ class DatePickerIOS extends React.Component<Props> {
153
150
  ref={picker => {
154
151
  this._picker = picker;
155
152
  }}
156
- style={getHeight(props.pickerStyle, props.mode)}
153
+ style={getHeight(props.pickerStyle, mode)}
157
154
  date={
158
155
  props.date
159
156
  ? props.date.getTime()
@@ -172,7 +169,7 @@ class DatePickerIOS extends React.Component<Props> {
172
169
  minimumDate={
173
170
  props.minimumDate ? props.minimumDate.getTime() : undefined
174
171
  }
175
- mode={props.mode}
172
+ mode={mode}
176
173
  minuteInterval={props.minuteInterval}
177
174
  timeZoneOffsetInMinutes={props.timeZoneOffsetInMinutes}
178
175
  onChange={this._onChange}
@@ -56,7 +56,7 @@ type Props = $ReadOnly<{|
56
56
  * );
57
57
  * ```
58
58
  */
59
- drawerBackgroundColor: ColorValue,
59
+ drawerBackgroundColor?: ?ColorValue,
60
60
 
61
61
  /**
62
62
  * Specifies the side of the screen from which the drawer will slide in.
@@ -161,11 +161,6 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
161
161
 
162
162
  return {Left: 'left', Right: 'right'};
163
163
  }
164
- static defaultProps: {|
165
- drawerBackgroundColor: 'white',
166
- |} = {
167
- drawerBackgroundColor: 'white',
168
- };
169
164
 
170
165
  _nativeRef = React.createRef<
171
166
  React.ElementRef<typeof AndroidDrawerLayoutNativeComponent>,
@@ -175,6 +170,7 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
175
170
 
176
171
  render(): React.Node {
177
172
  const {
173
+ drawerBackgroundColor = 'white',
178
174
  onDrawerStateChanged,
179
175
  renderNavigationView,
180
176
  onDrawerOpen,
@@ -189,7 +185,7 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
189
185
  styles.drawerSubview,
190
186
  {
191
187
  width: this.props.drawerWidth,
192
- backgroundColor: this.props.drawerBackgroundColor,
188
+ backgroundColor: drawerBackgroundColor,
193
189
  },
194
190
  ]}
195
191
  collapsable={false}>
@@ -220,6 +216,7 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
220
216
  <AndroidDrawerLayoutNativeComponent
221
217
  {...props}
222
218
  ref={this._nativeRef}
219
+ drawerBackgroundColor={drawerBackgroundColor}
223
220
  drawerWidth={this.props.drawerWidth}
224
221
  drawerPosition={this.props.drawerPosition}
225
222
  drawerLockMode={this.props.drawerLockMode}
@@ -11,7 +11,7 @@ const react_1 = __importDefault(require("react"));
11
11
  const PropTypes = require("prop-types");
12
12
  class EnterStringNative extends react_1.default.Component {
13
13
  render() {
14
- return react_1.default.createElement(RCTEnterString, Object.assign({}, this.props));
14
+ return react_1.default.createElement(RCTEnterString, { ...this.props });
15
15
  }
16
16
  }
17
17
  // mixins: [NativeMethodsMixin],
@@ -57,14 +57,14 @@ EnterStringNative.DefaultProps = {
57
57
  label: '',
58
58
  onChanged: null,
59
59
  };
60
- const RCTEnterString = react_native_1.requireNativeComponent('RCTEnterString');
60
+ const RCTEnterString = (0, react_native_1.requireNativeComponent)('RCTEnterString');
61
61
  class EnterString extends react_1.default.Component {
62
62
  render() {
63
63
  const args = { ...this.props };
64
64
  if (args.onChanged) {
65
65
  args.onChanged = this._onChangedNative.bind(this);
66
66
  } // TODO how should this work without the cast
67
- return react_1.default.createElement(EnterStringNative, Object.assign({}, args));
67
+ return react_1.default.createElement(EnterStringNative, { ...args });
68
68
  }
69
69
  _onChangedNative(event) {
70
70
  if (this.props.onChanged) {
@@ -1 +1 @@
1
- {"version":3,"file":"EnterString.win32.js","sourceRoot":"","sources":["../../src/Libraries/Components/EnterString.win32.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,YAAY,CAAC;;;;;AAEb,+CAA4E;AAC5E,kDAAyB;AACzB,wCAAyC;AAuBzC,MAAM,iBAAkB,SAAQ,eAAK,CAAC,SAAsC;IAmDnE,MAAM;QACX,OAAO,8BAAC,cAAc,oBAAK,IAAI,CAAC,KAAK,EAAI,CAAC;IAC5C,CAAC;;AApDD,gCAAgC;AAEhC;;;GAGG;AACH;;;;;;;;;;EAUE;AAEH,8CAA8C;AAC/B,2BAAS,GAAQ;IAC7B,mDAAmD;IACnD,qBAAqB;IACrB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC,MAAM;IAEvB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC,IAAI;IAExB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC,MAAM;IAEvB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC,IAAI;CAC1B,CAAC;AAEY,8BAAY,GAA4B;IACpD,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,IAAI;CAChB,CAAC;AAOJ,MAAM,cAAc,GAAG,qCAAsB,CAAC,gBAAgB,CAAC,CAAC;AAEhE,MAAqB,WAAY,SAAQ,eAAK,CAAC,SAAgC;IAQtE,MAAM;QACX,MAAM,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACnD,CAAC,6CAA6C;QAE/C,OAAO,8BAAC,iBAAiB,oBAAM,IAAuC,EAAI,CAAC;IAAE,CAAC;IAExE,gBAAgB,CAAC,KAAsD;QAC7E,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;YACxB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;SAC9C;IACH,CAAC;;AApBH,8BAqBC;AApBe,wBAAY,GAAsB;IAC9C,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,IAAI;CAChB,CAAC","sourcesContent":["/**\n * @providesModule EnterString\n */\n'use strict';\n\nimport { requireNativeComponent, NativeSyntheticEvent } from 'react-native';\nimport React from 'react'\nimport PropTypes = require('prop-types');\n\nexport interface IEnterStringProps /*extends React.ClassAttributes<React.View>*/ {\n // ViewProperties {\n disabled?: boolean;\n value?: string;\n label?: string;\n onChanged?: (newValue: string) => void;\n}\n\ninterface INativeOnChangedEventArgs {\n text: string;\n}\n\n// Same as EnterStringProps, but the event args are objects\ninterface IEnterStringNativeProps /*extends React.ClassAttributes<React.View>*/ {\n // ViewProperties {\n disabled?: boolean;\n value?: string;\n label?: string;\n onChanged?: (event: NativeSyntheticEvent<INativeOnChangedEventArgs>) => void;\n}\n\nclass EnterStringNative extends React.Component<IEnterStringNativeProps, {}> {\n // mixins: [NativeMethodsMixin],\n\n /**\n * `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We\n * make `this` look like an actual native component class.\n */\n /*\n viewConfig: {\n uiViewClassName: 'RCTEnterString',\n validAttributes: {\n ...ReactNativeViewAttributes.RCTView,\n text: true,\n disabled: true,\n label: true,\n },\n },\n */\n\n // TODO figure out how to get a real type here\n public static propTypes: any = {\n // React.ValidationMap<IEnterStringNativeProps> = {\n // ...View.propTypes,\n /**\n * Text to display inside the EnterString\n */\n value: PropTypes.string,\n\n /**\n * If true, disable all interactions for this component.\n */\n disabled: PropTypes.bool,\n\n /**\n * Label\n */\n label: PropTypes.string,\n\n /**\n * Callback when text is changed\n */\n onChanged: PropTypes.func,\n };\n\n public static DefaultProps: IEnterStringNativeProps = {\n disabled: false,\n value: '',\n label: '',\n onChanged: null,\n };\n\n public render() {\n return <RCTEnterString {...this.props} />;\n }\n}\n\nconst RCTEnterString = requireNativeComponent('RCTEnterString');\n\nexport default class EnterString extends React.Component<IEnterStringProps, {}> {\n public static DefaultProps: IEnterStringProps = {\n disabled: false,\n value: '',\n label: '',\n onChanged: null,\n };\n\n public render() {\n const args = { ...this.props };\n if (args.onChanged) {\n args.onChanged = this._onChangedNative.bind(this);\n } // TODO how should this work without the cast\n\n return <EnterStringNative {...(args as any) as IEnterStringNativeProps} />; }\n\n private _onChangedNative(event: NativeSyntheticEvent<INativeOnChangedEventArgs>) {\n if (this.props.onChanged) {\n this.props.onChanged(event.nativeEvent.text);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"EnterString.win32.js","sourceRoot":"","sources":["../../src/Libraries/Components/EnterString.win32.tsx"],"names":[],"mappings":"AAAA;;GAEG;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,CAAC;;AApBH,8BAqBC;AApBe,wBAAY,GAAsB;IAC9C,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,IAAI;CAChB,CAAC","sourcesContent":["/**\n * @providesModule EnterString\n */\n'use strict';\n\nimport { requireNativeComponent, NativeSyntheticEvent } from 'react-native';\nimport React from 'react'\nimport PropTypes = require('prop-types');\n\nexport interface IEnterStringProps /*extends React.ClassAttributes<React.View>*/ {\n // ViewProperties {\n disabled?: boolean;\n value?: string;\n label?: string;\n onChanged?: (newValue: string) => void;\n}\n\ninterface INativeOnChangedEventArgs {\n text: string;\n}\n\n// Same as EnterStringProps, but the event args are objects\ninterface IEnterStringNativeProps /*extends React.ClassAttributes<React.View>*/ {\n // ViewProperties {\n disabled?: boolean;\n value?: string;\n label?: string;\n onChanged?: (event: NativeSyntheticEvent<INativeOnChangedEventArgs>) => void;\n}\n\nclass EnterStringNative extends React.Component<IEnterStringNativeProps, {}> {\n // mixins: [NativeMethodsMixin],\n\n /**\n * `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We\n * make `this` look like an actual native component class.\n */\n /*\n viewConfig: {\n uiViewClassName: 'RCTEnterString',\n validAttributes: {\n ...ReactNativeViewAttributes.RCTView,\n text: true,\n disabled: true,\n label: true,\n },\n },\n */\n\n // TODO figure out how to get a real type here\n public static propTypes: any = {\n // React.ValidationMap<IEnterStringNativeProps> = {\n // ...View.propTypes,\n /**\n * Text to display inside the EnterString\n */\n value: PropTypes.string,\n\n /**\n * If true, disable all interactions for this component.\n */\n disabled: PropTypes.bool,\n\n /**\n * Label\n */\n label: PropTypes.string,\n\n /**\n * Callback when text is changed\n */\n onChanged: PropTypes.func,\n };\n\n public static DefaultProps: IEnterStringNativeProps = {\n disabled: false,\n value: '',\n label: '',\n onChanged: null,\n };\n\n public render() {\n return <RCTEnterString {...this.props} />;\n }\n}\n\nconst RCTEnterString = requireNativeComponent('RCTEnterString');\n\nexport default class EnterString extends React.Component<IEnterStringProps, {}> {\n public static DefaultProps: IEnterStringProps = {\n disabled: false,\n value: '',\n label: '',\n onChanged: null,\n };\n\n public render() {\n const args = { ...this.props };\n if (args.onChanged) {\n args.onChanged = this._onChangedNative.bind(this);\n } // TODO how should this work without the cast\n\n return <EnterStringNative {...(args as any) as IEnterStringNativeProps} />; }\n\n private _onChangedNative(event: NativeSyntheticEvent<INativeOnChangedEventArgs>) {\n if (this.props.onChanged) {\n this.props.onChanged(event.nativeEvent.text);\n }\n }\n}\n"]}
@@ -0,0 +1,384 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+ import * as React from 'react';
12
+ import {useMemo, useState, useRef, useImperativeHandle} from 'react';
13
+ import useAndroidRippleForView, {
14
+ type RippleConfig,
15
+ } from './useAndroidRippleForView';
16
+ import type {
17
+ AccessibilityActionEvent,
18
+ AccessibilityActionInfo,
19
+ AccessibilityRole,
20
+ AccessibilityState,
21
+ AccessibilityValue,
22
+ } from '../View/ViewAccessibility';
23
+ import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
24
+ import usePressability from '../../Pressability/usePressability';
25
+ import {normalizeRect, type RectOrSize} from '../../StyleSheet/Rect';
26
+ import type {
27
+ LayoutEvent,
28
+ MouseEvent,
29
+ PressEvent,
30
+ // [Windows
31
+ BlurEvent,
32
+ FocusEvent,
33
+ KeyEvent, // Windows]
34
+ } from '../../Types/CoreEventTypes';
35
+ import type {HandledKeyboardEvent} from '../../Components/View/ViewPropTypes';
36
+ import View from '../View/View';
37
+ import TextInputState from '../TextInput/TextInputState';
38
+
39
+ type ViewStyleProp = $ElementType<React.ElementConfig<typeof View>, 'style'>;
40
+
41
+ export type StateCallbackType = $ReadOnly<{|
42
+ pressed: boolean,
43
+ |}>;
44
+
45
+ type Props = $ReadOnly<{|
46
+ /**
47
+ * Accessibility.
48
+ */
49
+ accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
50
+ accessibilityElementsHidden?: ?boolean,
51
+ accessibilityHint?: ?Stringish,
52
+ accessibilityIgnoresInvertColors?: ?boolean,
53
+ accessibilityLabel?: ?Stringish,
54
+ accessibilityLiveRegion?: ?('none' | 'polite' | 'assertive'),
55
+ accessibilityRole?: ?AccessibilityRole,
56
+ accessibilityState?: ?AccessibilityState,
57
+ accessibilityValue?: ?AccessibilityValue,
58
+ accessibilityViewIsModal?: ?boolean,
59
+ accessible?: ?boolean,
60
+ focusable?: ?boolean,
61
+ importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
62
+ onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
63
+
64
+ /**
65
+ * Whether a press gesture can be interrupted by a parent gesture such as a
66
+ * scroll event. Defaults to true.
67
+ */
68
+ cancelable?: ?boolean,
69
+
70
+ /**
71
+ * Either children or a render prop that receives a boolean reflecting whether
72
+ * the component is currently pressed.
73
+ */
74
+ children: React.Node | ((state: StateCallbackType) => React.Node),
75
+
76
+ /**
77
+ * Duration to wait after hover in before calling `onHoverIn`.
78
+ */
79
+ delayHoverIn?: ?number,
80
+
81
+ /**
82
+ * Duration to wait after hover out before calling `onHoverOut`.
83
+ */
84
+ delayHoverOut?: ?number,
85
+
86
+ /**
87
+ * Duration (in milliseconds) from `onPressIn` before `onLongPress` is called.
88
+ */
89
+ delayLongPress?: ?number,
90
+
91
+ /**
92
+ * Whether the press behavior is disabled.
93
+ */
94
+ disabled?: ?boolean,
95
+
96
+ /**
97
+ * Additional distance outside of this view in which a press is detected.
98
+ */
99
+ hitSlop?: ?RectOrSize,
100
+
101
+ /**
102
+ * Additional distance outside of this view in which a touch is considered a
103
+ * press before `onPressOut` is triggered.
104
+ */
105
+ pressRetentionOffset?: ?RectOrSize,
106
+
107
+ /**
108
+ * Called when this view's layout changes.
109
+ */
110
+ onLayout?: ?(event: LayoutEvent) => mixed,
111
+
112
+ /**
113
+ * Called when the hover is activated to provide visual feedback.
114
+ */
115
+ onHoverIn?: ?(event: MouseEvent) => mixed,
116
+
117
+ /**
118
+ * Called when the hover is deactivated to undo visual feedback.
119
+ */
120
+ onHoverOut?: ?(event: MouseEvent) => mixed,
121
+
122
+ /**
123
+ * Called when a long-tap gesture is detected.
124
+ */
125
+ onLongPress?: ?(event: PressEvent) => mixed,
126
+
127
+ /**
128
+ * Called when a single tap gesture is detected.
129
+ */
130
+ onPress?: ?(event: PressEvent) => mixed,
131
+
132
+ /**
133
+ * Called when a touch is engaged before `onPress`.
134
+ */
135
+ onPressIn?: ?(event: PressEvent) => mixed,
136
+
137
+ /**
138
+ * Called when a touch is released before `onPress`.
139
+ */
140
+ onPressOut?: ?(event: PressEvent) => mixed,
141
+
142
+ /**
143
+ * Called after the element loses focus.
144
+ */
145
+ onBlur?: ?(event: BlurEvent) => mixed,
146
+
147
+ /**
148
+ * Called after the element is focused.
149
+ */
150
+ onFocus?: ?(event: FocusEvent) => mixed,
151
+
152
+ /*
153
+ * Called after a key down event is detected.
154
+ */
155
+ onKeyDown?: ?(event: KeyEvent) => mixed,
156
+
157
+ /*
158
+ * Called after a key up event is detected.
159
+ */
160
+ onKeyUp?: ?(event: KeyEvent) => mixed,
161
+
162
+ /*
163
+ * List of keys handled only by JS.
164
+ */
165
+ keyDownEvents?: ?$ReadOnlyArray<HandledKeyboardEvent>,
166
+
167
+ /*
168
+ * List of keys to be handled only by JS.
169
+ */
170
+ keyUpEvents?: ?$ReadOnlyArray<HandledKeyboardEvent>,
171
+
172
+ /*
173
+ * Called in the tunneling phase after a key up event is detected.
174
+ */
175
+ onKeyDownCapture?: ?(event: KeyEvent) => void,
176
+
177
+ /*
178
+ * Called in the tunneling phase after a key up event is detected.
179
+ */
180
+ onKeyUpCapture?: ?(event: KeyEvent) => void,
181
+
182
+ /**
183
+ * Either view styles or a function that receives a boolean reflecting whether
184
+ * the component is currently pressed and returns view styles.
185
+ */
186
+ style?: ViewStyleProp | ((state: StateCallbackType) => ViewStyleProp),
187
+
188
+ /**
189
+ * Identifier used to find this view in tests.
190
+ */
191
+ testID?: ?string,
192
+
193
+ /**
194
+ * If true, doesn't play system sound on touch.
195
+ */
196
+ android_disableSound?: ?boolean,
197
+
198
+ /**
199
+ * Enables the Android ripple effect and configures its color.
200
+ */
201
+ android_ripple?: ?RippleConfig,
202
+
203
+ /**
204
+ * Used only for documentation or testing (e.g. snapshot testing).
205
+ */
206
+ testOnly_pressed?: ?boolean,
207
+
208
+ /**
209
+ * Duration to wait after press down before calling `onPressIn`.
210
+ */
211
+ unstable_pressDelay?: ?number,
212
+ |}>;
213
+
214
+ /**
215
+ * Component used to build display components that should respond to whether the
216
+ * component is currently pressed or not.
217
+ */
218
+ function Pressable(props: Props, forwardedRef): React.Node {
219
+ const {
220
+ accessible,
221
+ android_disableSound,
222
+ android_ripple,
223
+ cancelable,
224
+ children,
225
+ delayHoverIn,
226
+ delayHoverOut,
227
+ delayLongPress,
228
+ disabled,
229
+ focusable,
230
+ onHoverIn,
231
+ onHoverOut,
232
+ onLongPress,
233
+ onPress,
234
+ onPressIn,
235
+ onPressOut,
236
+ // [Windows
237
+ onBlur,
238
+ onFocus,
239
+ onKeyDown,
240
+ onKeyUp,
241
+ // Windows]
242
+ pressRetentionOffset,
243
+ style,
244
+ testOnly_pressed,
245
+ unstable_pressDelay,
246
+ ...restProps
247
+ } = props;
248
+
249
+ const viewRef = useRef<React.ElementRef<typeof View> | null>(null);
250
+ useImperativeHandle(forwardedRef, () => viewRef.current);
251
+
252
+ // [Windows
253
+ const _onBlur = (event: BlurEvent) => {
254
+ TextInputState.blurInput(viewRef.current);
255
+ if (props.onBlur) {
256
+ props.onBlur(event);
257
+ }
258
+ };
259
+
260
+ const _onFocus = (event: FocusEvent) => {
261
+ TextInputState.focusInput(viewRef.current);
262
+ if (props.onFocus) {
263
+ props.onFocus(event);
264
+ }
265
+ };
266
+ // Windows]
267
+
268
+ const android_rippleConfig = useAndroidRippleForView(android_ripple, viewRef);
269
+
270
+ const [pressed, setPressed] = usePressState(testOnly_pressed === true);
271
+
272
+ const hitSlop = normalizeRect(props.hitSlop);
273
+
274
+ const accessibilityState =
275
+ disabled != null
276
+ ? {...props.accessibilityState, disabled}
277
+ : props.accessibilityState;
278
+
279
+ const restPropsWithDefaults: React.ElementConfig<typeof View> = {
280
+ ...restProps,
281
+ ...android_rippleConfig?.viewProps,
282
+ accessible: accessible !== false,
283
+ accessibilityState,
284
+ focusable: focusable !== false,
285
+ hitSlop,
286
+ };
287
+
288
+ const config = useMemo(
289
+ () => ({
290
+ cancelable,
291
+ disabled,
292
+ hitSlop,
293
+ pressRectOffset: pressRetentionOffset,
294
+ android_disableSound,
295
+ delayHoverIn,
296
+ delayHoverOut,
297
+ delayLongPress,
298
+ delayPressIn: unstable_pressDelay,
299
+ onHoverIn,
300
+ onHoverOut,
301
+ onLongPress,
302
+ onPress,
303
+ onPressIn(event: PressEvent): void {
304
+ if (android_rippleConfig != null) {
305
+ android_rippleConfig.onPressIn(event);
306
+ }
307
+ setPressed(true);
308
+ if (onPressIn != null) {
309
+ onPressIn(event);
310
+ }
311
+ },
312
+ onPressMove: android_rippleConfig?.onPressMove,
313
+ onPressOut(event: PressEvent): void {
314
+ if (android_rippleConfig != null) {
315
+ android_rippleConfig.onPressOut(event);
316
+ }
317
+ setPressed(false);
318
+ if (onPressOut != null) {
319
+ onPressOut(event);
320
+ }
321
+ },
322
+ // [Windows
323
+ onBlur,
324
+ onFocus,
325
+ onKeyDown,
326
+ onKeyUp,
327
+ // Windows]
328
+ }),
329
+ [
330
+ android_disableSound,
331
+ android_rippleConfig,
332
+ cancelable,
333
+ delayHoverIn,
334
+ delayHoverOut,
335
+ delayLongPress,
336
+ disabled,
337
+ hitSlop,
338
+ onHoverIn,
339
+ onHoverOut,
340
+ onLongPress,
341
+ onPress,
342
+ onPressIn,
343
+ onPressOut,
344
+ // [Windows
345
+ onBlur,
346
+ onFocus,
347
+ onKeyDown,
348
+ onKeyUp,
349
+ // Windows]
350
+ pressRetentionOffset,
351
+ setPressed,
352
+ unstable_pressDelay,
353
+ ],
354
+ );
355
+ const eventHandlers = usePressability(config);
356
+
357
+ return (
358
+ <View
359
+ {...restPropsWithDefaults}
360
+ {...eventHandlers}
361
+ // [Windows
362
+ onBlur={_onBlur}
363
+ onFocus={_onFocus}
364
+ // Windows]
365
+ ref={viewRef}
366
+ style={typeof style === 'function' ? style({pressed}) : style}>
367
+ {typeof children === 'function' ? children({pressed}) : children}
368
+ {__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null}
369
+ </View>
370
+ );
371
+ }
372
+
373
+ function usePressState(forcePressed: boolean): [boolean, (boolean) => void] {
374
+ const [pressed, setPressed] = useState(false);
375
+ return [pressed || forcePressed, setPressed];
376
+ }
377
+
378
+ const MemoedPressable = React.memo(React.forwardRef(Pressable));
379
+ MemoedPressable.displayName = 'Pressable';
380
+
381
+ export default (MemoedPressable: React.AbstractComponent<
382
+ Props,
383
+ React.ElementRef<typeof View>,
384
+ >);
@@ -31,6 +31,7 @@ const AndroidHorizontalScrollViewNativeComponent: HostComponent<Props> = NativeC
31
31
  scrollPerfTag: true,
32
32
  sendMomentumEvents: true,
33
33
  showsHorizontalScrollIndicator: true,
34
+ snapToAlignment: true,
34
35
  snapToEnd: true,
35
36
  snapToInterval: true,
36
37
  snapToStart: true,