@office-iss/react-native-win32 0.82.0 → 0.83.0-preview.0

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 (109) hide show
  1. package/.flowconfig +2 -2
  2. package/CHANGELOG.json +43 -40
  3. package/CHANGELOG.md +15 -20
  4. package/IntegrationTests/ImageCachePolicyTest.js +1 -1
  5. package/Libraries/Animated/components/AnimatedFlatList.js +5 -3
  6. package/Libraries/Animated/components/AnimatedImage.js +4 -3
  7. package/Libraries/Animated/components/AnimatedSectionList.js +2 -2
  8. package/Libraries/Animated/components/AnimatedText.js +7 -3
  9. package/Libraries/Animated/components/AnimatedView.js +3 -2
  10. package/Libraries/Animated/createAnimatedComponent.js +24 -12
  11. package/Libraries/Animated/nodes/AnimatedColor.js +26 -10
  12. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +43 -15
  13. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +43 -15
  14. package/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +2 -2
  15. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +2 -2
  16. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts +2 -2
  17. package/Libraries/Components/RefreshControl/RefreshControl.d.ts +3 -3
  18. package/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +2 -2
  19. package/Libraries/Components/ScrollView/ScrollView.js +1 -0
  20. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -6
  21. package/Libraries/Components/Switch/Switch.d.ts +2 -2
  22. package/Libraries/Components/TextInput/TextInput.d.ts +2 -5
  23. package/Libraries/Components/TextInput/TextInput.js +6 -0
  24. package/Libraries/Components/TextInput/TextInput.win32.js +18 -12
  25. package/Libraries/Components/TextInput/TextInputState.win32.js +2 -2
  26. package/Libraries/Components/Touchable/TouchableBounce.js +7 -7
  27. package/Libraries/Components/Touchable/TouchableWin32.js +9 -6
  28. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  29. package/Libraries/Components/View/ReactNativeStyleAttributes.js +19 -1
  30. package/Libraries/Components/View/View.d.ts +2 -2
  31. package/Libraries/Components/View/View.win32.js +17 -15
  32. package/Libraries/Components/View/ViewNativeComponent.js +13 -1
  33. package/Libraries/Components/View/ViewWin32.d.ts +2 -2
  34. package/Libraries/Components/View/ViewWin32.js +1 -1
  35. package/Libraries/Core/ReactNativeVersion.js +3 -3
  36. package/Libraries/Core/setUpPerformance.js +2 -0
  37. package/Libraries/Debugging/DebuggingOverlay.js +14 -14
  38. package/Libraries/Debugging/DebuggingOverlayRegistry.js +8 -2
  39. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +5 -2
  40. package/Libraries/Image/Image.d.ts +3 -3
  41. package/Libraries/Image/ImageInjection.js +3 -6
  42. package/Libraries/Image/ImageTypes.flow.js +3 -7
  43. package/Libraries/Lists/FlatList.js +8 -8
  44. package/Libraries/Lists/SectionList.d.ts +5 -1
  45. package/Libraries/Lists/ViewabilityHelper.js +1 -1
  46. package/Libraries/Lists/VirtualizedList.js +1 -0
  47. package/Libraries/LogBox/UI/AnsiHighlight.js +4 -1
  48. package/Libraries/NativeComponent/BaseViewConfig.android.js +11 -2
  49. package/Libraries/NativeComponent/NativeComponentRegistry.d.ts +98 -0
  50. package/Libraries/NativeComponent/NativeComponentRegistry.js +2 -0
  51. package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +3 -1
  52. package/Libraries/Network/RCTNetworking.android.js +3 -1
  53. package/Libraries/Network/RCTNetworking.ios.js +3 -0
  54. package/Libraries/Network/RCTNetworking.win32.js +3 -0
  55. package/Libraries/Network/XMLHttpRequest.js +1 -41
  56. package/Libraries/Pressability/Pressability.win32.js +5 -5
  57. package/Libraries/Pressability/usePressability.js +14 -3
  58. package/Libraries/ReactNative/PaperUIManager.win32.js +7 -7
  59. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +20 -82
  60. package/Libraries/ReactNative/getNativeComponentAttributes.js +12 -0
  61. package/Libraries/Renderer/implementations/ReactFabric-dev.js +6759 -4478
  62. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3169 -3119
  63. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4732 -3535
  64. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +6646 -4070
  65. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3136 -2825
  66. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4761 -3312
  67. package/Libraries/Renderer/shims/ReactNative.js +3 -1
  68. package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
  69. package/Libraries/Renderer/shims/ReactNativeTypes.win32.js +2 -1
  70. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
  71. package/Libraries/StyleSheet/StyleSheetTypes.js +44 -0
  72. package/Libraries/StyleSheet/processBackgroundPosition.js +284 -0
  73. package/Libraries/StyleSheet/processBackgroundRepeat.js +105 -0
  74. package/Libraries/StyleSheet/processBackgroundSize.js +104 -0
  75. package/Libraries/Text/Text.d.ts +2 -2
  76. package/Libraries/Text/TextNativeComponent.js +10 -0
  77. package/Libraries/Text/TextNativeComponent.win32.js +10 -0
  78. package/Libraries/TurboModule/TurboModuleRegistry.js +3 -9
  79. package/Libraries/Utilities/DevLoadingView.js +14 -6
  80. package/Libraries/Utilities/FocusManager.win32.js +2 -2
  81. package/Libraries/Utilities/HMRClient.js +13 -5
  82. package/flow/bom.js.flow +1 -0
  83. package/index.js +6 -0
  84. package/index.win32.js +130 -207
  85. package/index.win32.js.flow +488 -0
  86. package/jest/mockComponent.js +6 -6
  87. package/jest/setup.js +15 -10
  88. package/overrides.json +16 -10
  89. package/package.json +39 -26
  90. package/src/private/components/virtualview/VirtualView.js +22 -27
  91. package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +6 -0
  92. package/src/private/featureflags/ReactNativeFeatureFlags.js +100 -19
  93. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +18 -3
  94. package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
  95. package/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +1 -0
  96. package/src/private/webapis/dom/nodes/ReactNativeElement.js +12 -2
  97. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +76 -15
  98. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +1 -0
  99. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  100. package/src/private/webapis/performance/ResourceTiming.js +31 -4
  101. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +4 -1
  102. package/src/private/webapis/performance/specs/NativePerformance.js +3 -0
  103. package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +6 -3
  104. package/src-win/Libraries/Components/View/ViewWin32.d.ts +2 -2
  105. package/src-win/Libraries/Text/Text.d.ts +2 -2
  106. package/src-win/index.win32.js.flow +488 -0
  107. package/types/index.d.ts +1 -0
  108. package/types/public/ReactNativeTypes.d.ts +115 -2
  109. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +0 -152
@@ -107,7 +107,7 @@ const AccessibilityInfo = {
107
107
  reject,
108
108
  );
109
109
  } else {
110
- reject(null);
110
+ reject(new Error('NativeAccessibilityManagerIOS is not available'));
111
111
  }
112
112
  });
113
113
  }
@@ -127,7 +127,11 @@ const AccessibilityInfo = {
127
127
  if (NativeAccessibilityInfoAndroid?.isGrayscaleEnabled != null) {
128
128
  NativeAccessibilityInfoAndroid.isGrayscaleEnabled(resolve);
129
129
  } else {
130
- reject(null);
130
+ reject(
131
+ new Error(
132
+ 'NativeAccessibilityInfoAndroid.isGrayscaleEnabled is not available',
133
+ ),
134
+ );
131
135
  }
132
136
  });
133
137
  } else if (Platform.OS === 'win32') {
@@ -140,7 +144,7 @@ const AccessibilityInfo = {
140
144
  reject,
141
145
  );
142
146
  } else {
143
- reject(null);
147
+ reject(new Error('AccessibilityInfo native module is not available'));
144
148
  }
145
149
  });
146
150
  }
@@ -160,7 +164,11 @@ const AccessibilityInfo = {
160
164
  if (NativeAccessibilityInfoAndroid?.isInvertColorsEnabled != null) {
161
165
  NativeAccessibilityInfoAndroid.isInvertColorsEnabled(resolve);
162
166
  } else {
163
- reject(null);
167
+ reject(
168
+ new Error(
169
+ 'NativeAccessibilityInfoAndroid.isInvertColorsEnabled is not available',
170
+ ),
171
+ );
164
172
  }
165
173
  });
166
174
  } else if (Platform.OS === 'win32') {
@@ -173,7 +181,7 @@ const AccessibilityInfo = {
173
181
  reject,
174
182
  );
175
183
  } else {
176
- reject(null);
184
+ reject(new Error('AccessibilityInfo native module is not available'));
177
185
  }
178
186
  });
179
187
  }
@@ -199,7 +207,7 @@ const AccessibilityInfo = {
199
207
  if (NativeAccessibilityInfoWin32 != null) {
200
208
  NativeAccessibilityInfoWin32.isReduceMotionEnabled(resolve);
201
209
  } else {
202
- reject(null);
210
+ reject(new Error('AccessibilityInfo native module is not available'));
203
211
  }
204
212
  } else {
205
213
  if (NativeAccessibilityManagerIOS != null) {
@@ -208,7 +216,7 @@ const AccessibilityInfo = {
208
216
  reject,
209
217
  );
210
218
  } else {
211
- reject(null);
219
+ reject(new Error('NativeAccessibilityManagerIOS is not available'));
212
220
  }
213
221
  }
214
222
  });
@@ -226,7 +234,11 @@ const AccessibilityInfo = {
226
234
  if (NativeAccessibilityInfo?.isHighTextContrastEnabled != null) {
227
235
  NativeAccessibilityInfo.isHighTextContrastEnabled(resolve);
228
236
  } else {
229
- reject(null);
237
+ reject(
238
+ new Error(
239
+ 'NativeAccessibilityInfoAndroid.isHighTextContrastEnabled is not available',
240
+ ),
241
+ );
230
242
  }
231
243
  } else {
232
244
  return Promise.resolve(false);
@@ -254,7 +266,11 @@ const AccessibilityInfo = {
254
266
  reject,
255
267
  );
256
268
  } else {
257
- reject(null);
269
+ reject(
270
+ new Error(
271
+ 'NativeAccessibilityManagerIOS.getCurrentDarkerSystemColorsState is not available',
272
+ ),
273
+ );
258
274
  }
259
275
  }
260
276
  });
@@ -282,7 +298,11 @@ const AccessibilityInfo = {
282
298
  reject,
283
299
  );
284
300
  } else {
285
- reject(null);
301
+ reject(
302
+ new Error(
303
+ 'NativeAccessibilityManagerIOS.getCurrentPrefersCrossFadeTransitionsState is not available',
304
+ ),
305
+ );
286
306
  }
287
307
  }
288
308
  });
@@ -307,7 +327,7 @@ const AccessibilityInfo = {
307
327
  reject,
308
328
  );
309
329
  } else {
310
- reject(null);
330
+ reject(new Error('NativeAccessibilityManagerIOS is not available'));
311
331
  }
312
332
  });
313
333
  }
@@ -333,7 +353,7 @@ const AccessibilityInfo = {
333
353
  if (NativeAccessibilityInfoWin32 != null) {
334
354
  NativeAccessibilityInfoWin32.isTouchExplorationEnabled(resolve);
335
355
  } else {
336
- reject(null);
356
+ reject(new Error('NativeAccessibilityInfoAndroid is not available'));
337
357
  }
338
358
  } else {
339
359
  if (NativeAccessibilityManagerIOS != null) {
@@ -342,7 +362,7 @@ const AccessibilityInfo = {
342
362
  reject,
343
363
  );
344
364
  } else {
345
- reject(null);
365
+ reject(new Error('NativeAccessibilityManagerIOS is not available'));
346
366
  }
347
367
  }
348
368
  });
@@ -367,10 +387,18 @@ const AccessibilityInfo = {
367
387
  ) {
368
388
  NativeAccessibilityInfo.isAccessibilityServiceEnabled(resolve);
369
389
  } else {
370
- reject(null);
390
+ reject(
391
+ new Error(
392
+ 'NativeAccessibilityInfoAndroid.isAccessibilityServiceEnabled is not available',
393
+ ),
394
+ );
371
395
  }
372
396
  } else {
373
- reject(null);
397
+ reject(
398
+ new Error(
399
+ 'isAccessibilityServiceEnabled is only available on Android',
400
+ ),
401
+ );
374
402
  }
375
403
  });
376
404
  },
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type * as React from 'react';
11
11
  import {Constructor} from '../../../types/private/Utilities';
12
- import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12
+ import {HostInstance} from '../../../types/public/ReactNativeTypes';
13
13
  import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
14
14
  import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
15
15
  import {LayoutChangeEvent} from '../../Types/CoreEventTypes';
@@ -46,7 +46,7 @@ export interface ActivityIndicatorProps extends ViewProps {
46
46
  }
47
47
 
48
48
  declare class ActivityIndicatorComponent extends React.Component<ActivityIndicatorProps> {}
49
- declare const ActivityIndicatorBase: Constructor<NativeMethods> &
49
+ declare const ActivityIndicatorBase: Constructor<HostInstance> &
50
50
  typeof ActivityIndicatorComponent;
51
51
  export class ActivityIndicator extends ActivityIndicatorBase {}
52
52
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type * as React from 'react';
11
11
  import {Constructor} from '../../../types/private/Utilities';
12
- import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12
+ import {HostInstance} from '../../../types/public/ReactNativeTypes';
13
13
  import {ColorValue} from '../../StyleSheet/StyleSheet';
14
14
  import {
15
15
  NativeSyntheticEvent,
@@ -121,7 +121,7 @@ interface DrawerPosition {
121
121
  }
122
122
 
123
123
  declare class DrawerLayoutAndroidComponent extends React.Component<DrawerLayoutAndroidProps> {}
124
- declare const DrawerLayoutAndroidBase: Constructor<NativeMethods> &
124
+ declare const DrawerLayoutAndroidBase: Constructor<HostInstance> &
125
125
  typeof DrawerLayoutAndroidComponent;
126
126
  export class DrawerLayoutAndroid extends DrawerLayoutAndroidBase {
127
127
  /**
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type * as React from 'react';
11
11
  import {Constructor} from '../../../types/private/Utilities';
12
- import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12
+ import {HostInstance} from '../../../types/public/ReactNativeTypes';
13
13
  import {ColorValue} from '../../StyleSheet/StyleSheet';
14
14
  import {ViewProps} from '../View/ViewPropTypes';
15
15
 
@@ -72,7 +72,7 @@ export interface ProgressBarAndroidProps extends ViewProps {
72
72
  * that the app is loading or there is some activity in the app.
73
73
  */
74
74
  declare class ProgressBarAndroidComponent extends React.Component<ProgressBarAndroidProps> {}
75
- declare const ProgressBarAndroidBase: Constructor<NativeMethods> &
75
+ declare const ProgressBarAndroidBase: Constructor<HostInstance> &
76
76
  typeof ProgressBarAndroidComponent;
77
77
  /**
78
78
  * ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type * as React from 'react';
11
11
  import {Constructor} from '../../../types/private/Utilities';
12
- import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12
+ import {HostInstance} from '../../../types/public/ReactNativeTypes';
13
13
  import {ColorValue} from '../../StyleSheet/StyleSheet';
14
14
  import {ViewProps} from '../View/ViewPropTypes';
15
15
 
@@ -49,7 +49,7 @@ export interface RefreshControlPropsAndroid extends ViewProps {
49
49
  /**
50
50
  * Size of the refresh indicator, see RefreshControl.SIZE.
51
51
  */
52
- size?: number | undefined;
52
+ size?: 'default' | 'large' | undefined;
53
53
  }
54
54
 
55
55
  export interface RefreshControlProps
@@ -80,7 +80,7 @@ export interface RefreshControlProps
80
80
  * in the `onRefresh` function otherwise the refresh indicator will stop immediately.
81
81
  */
82
82
  declare class RefreshControlComponent extends React.Component<RefreshControlProps> {}
83
- declare const RefreshControlBase: Constructor<NativeMethods> &
83
+ declare const RefreshControlBase: Constructor<HostInstance> &
84
84
  typeof RefreshControlComponent;
85
85
  export class RefreshControl extends RefreshControlBase {
86
86
  static SIZE: Object; // Undocumented
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type * as React from 'react';
11
11
  import {Constructor} from '../../../types/private/Utilities';
12
- import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12
+ import {HostInstance} from '../../../types/public/ReactNativeTypes';
13
13
  import {ViewProps} from '../View/ViewPropTypes';
14
14
 
15
15
  /**
@@ -23,7 +23,7 @@ import {ViewProps} from '../View/ViewPropTypes';
23
23
  */
24
24
  declare class SafeAreaViewComponent extends React.Component<ViewProps> {}
25
25
 
26
- declare const SafeAreaViewBase: Constructor<NativeMethods> &
26
+ declare const SafeAreaViewBase: Constructor<HostInstance> &
27
27
  typeof SafeAreaViewComponent;
28
28
 
29
29
  /**
@@ -1690,6 +1690,7 @@ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
1690
1690
  return (
1691
1691
  <StickyHeaderComponent
1692
1692
  key={key}
1693
+ /* $FlowFixMe[incompatible-type] */
1693
1694
  ref={ref => this._setStickyHeaderRef(key, ref)}
1694
1695
  nextHeaderLayoutY={this._headerLayoutYs.get(
1695
1696
  this._getKeyForIndex(nextIndex, children),
@@ -44,7 +44,7 @@ interface Instance extends React.ElementRef<typeof Animated.View> {
44
44
  }
45
45
 
46
46
  const ScrollViewStickyHeader: component(
47
- ref: React.RefSetter<Instance>,
47
+ ref?: React.RefSetter<Instance>,
48
48
  ...props: ScrollViewStickyHeaderProps
49
49
  ) = function ScrollViewStickyHeader({
50
50
  ref: forwardedRef,
@@ -282,7 +282,7 @@ const ScrollViewStickyHeader: component(
282
282
  const passthroughAnimatedPropExplicitValues =
283
283
  isFabric && translateY != null
284
284
  ? {
285
- style: {transform: [{translateY: translateY}]},
285
+ style: {transform: [{translateY}]},
286
286
  }
287
287
  : null;
288
288
 
@@ -303,20 +303,20 @@ const ScrollViewStickyHeader: component(
303
303
  passthroughAnimatedPropExplicitValues
304
304
  }>
305
305
  {cloneElement(child, {
306
- style: styles.fill, // We transfer the child style to the wrapper.
307
306
  onLayout: undefined, // we call this manually through our this._onLayout
307
+ style: styles.fill, // We transfer the child style to the wrapper.
308
308
  })}
309
309
  </Animated.View>
310
310
  );
311
311
  };
312
312
 
313
313
  const styles = StyleSheet.create({
314
- header: {
315
- zIndex: 10,
316
- },
317
314
  fill: {
318
315
  flex: 1,
319
316
  },
317
+ header: {
318
+ zIndex: 10,
319
+ },
320
320
  });
321
321
 
322
322
  export default ScrollViewStickyHeader;
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type * as React from 'react';
11
11
  import {Constructor} from '../../../types/private/Utilities';
12
- import {NativeMethods} from '../../../types/public/ReactNativeTypes';
12
+ import {HostInstance} from '../../../types/public/ReactNativeTypes';
13
13
  import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
14
14
  import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
15
15
  import {ViewProps} from '../View/ViewPropTypes';
@@ -114,5 +114,5 @@ export interface SwitchProps extends SwitchPropsIOS {
114
114
  * the supplied `value` prop instead of the expected result of any user actions.
115
115
  */
116
116
  declare class SwitchComponent extends React.Component<SwitchProps> {}
117
- declare const SwitchBase: Constructor<NativeMethods> & typeof SwitchComponent;
117
+ declare const SwitchBase: Constructor<HostInstance> & typeof SwitchComponent;
118
118
  export class Switch extends SwitchBase {}
@@ -10,10 +10,7 @@
10
10
  import type * as React from 'react';
11
11
  import {Constructor} from '../../../types/private/Utilities';
12
12
  import {TimerMixin} from '../../../types/private/TimerMixin';
13
- import {
14
- HostInstance,
15
- NativeMethods,
16
- } from '../../../types/public/ReactNativeTypes';
13
+ import {HostInstance} from '../../../types/public/ReactNativeTypes';
17
14
  import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
18
15
  import {TextStyle} from '../../StyleSheet/StyleSheetTypes';
19
16
  import {
@@ -1029,7 +1026,7 @@ interface TextInputState {
1029
1026
  * @see https://reactnative.dev/docs/textinput#methods
1030
1027
  */
1031
1028
  declare class TextInputComponent extends React.Component<TextInputProps> {}
1032
- declare const TextInputBase: Constructor<NativeMethods> &
1029
+ declare const TextInputBase: Constructor<HostInstance> &
1033
1030
  Constructor<TimerMixin> &
1034
1031
  typeof TextInputComponent;
1035
1032
  export class TextInput extends TextInputBase {
@@ -449,6 +449,12 @@ function InternalTextInput(props: TextInputProps): React.Node {
449
449
  before we can get to the long term breaking change.
450
450
  */
451
451
  if (instance != null) {
452
+ // Register the input immediately when the ref is set so that focus()
453
+ // can be called from ref callbacks
454
+ // Double registering during useLayoutEffect is fine, because the underlying
455
+ // state is a Set.
456
+ TextInputState.registerInput(instance);
457
+
452
458
  // $FlowFixMe[prop-missing] - See the explanation above.
453
459
  // $FlowFixMe[unsafe-object-assign]
454
460
  Object.assign(instance, {
@@ -466,6 +466,12 @@ function InternalTextInput(props: TextInputProps): React.Node {
466
466
  before we can get to the long term breaking change.
467
467
  */
468
468
  if (instance != null) {
469
+ // Register the input immediately when the ref is set so that focus()
470
+ // can be called from ref callbacks
471
+ // Double registering during useLayoutEffect is fine, because the underlying
472
+ // state is a Set.
473
+ TextInputState.registerInput(instance);
474
+
469
475
  // $FlowFixMe[prop-missing] - See the explanation above.
470
476
  // $FlowFixMe[unsafe-object-assign]
471
477
  Object.assign(instance, {
@@ -646,9 +652,9 @@ function InternalTextInput(props: TextInputProps): React.Node {
646
652
  const {onBlur, onFocus, ...eventHandlers} = usePressability(config);
647
653
  const eventPhase = Object.freeze({Capturing: 1, Bubbling: 3});
648
654
  const _keyDown = (event: KeyEvent) => {
649
- if (props.keyDownEvents && event.isPropagationStopped() !== true) {
650
- // $FlowFixMe - keyDownEvents was already checked to not be undefined
651
- for (const el of props.keyDownEvents) {
655
+ const keyDownEvents = props.keyDownEvents;
656
+ if (keyDownEvents != null && event.isPropagationStopped() !== true) {
657
+ for (const el of keyDownEvents) {
652
658
  if (
653
659
  event.nativeEvent.code === el.code &&
654
660
  event.nativeEvent.ctrlKey === Boolean(el.ctrlKey) &&
@@ -665,9 +671,9 @@ function InternalTextInput(props: TextInputProps): React.Node {
665
671
  };
666
672
 
667
673
  const _keyUp = (event: KeyEvent) => {
668
- if (props.keyUpEvents && event.isPropagationStopped() !== true) {
669
- // $FlowFixMe - keyDownEvents was already checked to not be undefined
670
- for (const el of props.keyUpEvents) {
674
+ const keyUpEvents = props.keyUpEvents;
675
+ if (keyUpEvents != null && event.isPropagationStopped() !== true) {
676
+ for (const el of keyUpEvents) {
671
677
  if (
672
678
  event.nativeEvent.code === el.code &&
673
679
  event.nativeEvent.ctrlKey === Boolean(el.ctrlKey) &&
@@ -684,9 +690,9 @@ function InternalTextInput(props: TextInputProps): React.Node {
684
690
  };
685
691
 
686
692
  const _keyDownCapture = (event: KeyEvent) => {
687
- if (props.keyDownEvents && event.isPropagationStopped() !== true) {
688
- // $FlowFixMe - keyDownEvents was already checked to not be undefined
689
- for (const el of props.keyDownEvents) {
693
+ const keyDownEvents = props.keyDownEvents;
694
+ if (keyDownEvents != null && event.isPropagationStopped() !== true) {
695
+ for (const el of keyDownEvents) {
690
696
  if (
691
697
  event.nativeEvent.code === el.code &&
692
698
  event.nativeEvent.ctrlKey === Boolean(el.ctrlKey) &&
@@ -703,9 +709,9 @@ function InternalTextInput(props: TextInputProps): React.Node {
703
709
  };
704
710
 
705
711
  const _keyUpCapture = (event: KeyEvent) => {
706
- if (props.keyUpEvents && event.isPropagationStopped() !== true) {
707
- // $FlowFixMe - keyDownEvents was already checked to not be undefined
708
- for (const el of props.keyUpEvents) {
712
+ const keyUpEvents = props.keyUpEvents;
713
+ if (keyUpEvents != null && event.isPropagationStopped() !== true) {
714
+ for (const el of keyUpEvents) {
709
715
  if (
710
716
  event.nativeEvent.code === el.code &&
711
717
  event.nativeEvent.ctrlKey === Boolean(el.ctrlKey) &&
@@ -161,7 +161,7 @@ function blurTextInput(textField: ?HostInstance) {
161
161
  * noop if the focused text field is same
162
162
  */
163
163
  function setFocusedTextInput(textField: HostInstance) {
164
- if (currentlyFocusedInputRef !== textField && textField !== null) {
164
+ if (currentlyFocusedInputRef !== textField) {
165
165
  currentlyFocusedInputRef = textField;
166
166
  }
167
167
  }
@@ -172,7 +172,7 @@ function setFocusedTextInput(textField: HostInstance) {
172
172
  * noop if the focused text field is not same
173
173
  */
174
174
  function clearFocusedTextInput(textField: HostInstance) {
175
- if (currentlyFocusedInputRef === textField && textField !== null) {
175
+ if (currentlyFocusedInputRef === textField) {
176
176
  currentlyFocusedInputRef = null;
177
177
  }
178
178
  }
@@ -47,15 +47,14 @@ class TouchableBounce extends React.Component<
47
47
 
48
48
  _createPressabilityConfig(): PressabilityConfig {
49
49
  return {
50
+ android_disableSound: this.props.touchSoundDisabled,
50
51
  cancelable: !this.props.rejectResponderTermination,
51
- disabled: this.props.disabled,
52
- hitSlop: this.props.hitSlop,
53
52
  delayLongPress: this.props.delayLongPress,
54
53
  delayPressIn: this.props.delayPressIn,
55
54
  delayPressOut: this.props.delayPressOut,
55
+ disabled: this.props.disabled,
56
+ hitSlop: this.props.hitSlop,
56
57
  minPressDuration: 0,
57
- pressRectOffset: this.props.pressRetentionOffset,
58
- android_disableSound: this.props.touchSoundDisabled,
59
58
  onBlur: event => {
60
59
  if (Platform.isTV) {
61
60
  this._bounceTo(1, 0.4, 0);
@@ -113,6 +112,7 @@ class TouchableBounce extends React.Component<
113
112
  this.props.onPressOut(event);
114
113
  }
115
114
  },
115
+ pressRectOffset: this.props.pressRetentionOffset,
116
116
  };
117
117
  }
118
118
 
@@ -123,10 +123,10 @@ class TouchableBounce extends React.Component<
123
123
  callback?: ?() => void,
124
124
  ) {
125
125
  Animated.spring(this.state.scale, {
126
- toValue,
127
- velocity,
128
126
  bounciness,
127
+ toValue,
129
128
  useNativeDriver: true,
129
+ velocity,
130
130
  }).start(callback);
131
131
  }
132
132
 
@@ -230,6 +230,6 @@ export default (function TouchableBounceWrapper({
230
230
  }) {
231
231
  return <TouchableBounce {...props} hostRef={hostRef} />;
232
232
  } as component(
233
- ref: React.RefSetter<mixed>,
233
+ ref?: React.RefSetter<mixed>,
234
234
  ...props: $ReadOnly<Omit<TouchableBounceProps, 'hostRef'>>
235
235
  ));
@@ -16,9 +16,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.TouchableWin32 = void 0;
17
17
  const react_1 = __importDefault(require("react"));
18
18
  const react_native_1 = require("react-native");
19
- const BoundingDimensions = require('./BoundingDimensions');
20
- const Position = require('./Position');
21
- const { findNodeHandle } = require('../../ReactNative/RendererProxy');
19
+ // @ts-ignore
20
+ const BoundingDimensions_1 = __importDefault(require("./BoundingDimensions"));
21
+ // @ts-ignore
22
+ const Position_1 = __importDefault(require("./Position"));
23
+ // @ts-ignore
24
+ const RendererProxy_1 = require("../../ReactNative/RendererProxy");
22
25
  /**
23
26
  * Extracts a single touch, generally this is the active touch or touch that
24
27
  * has just ended
@@ -174,7 +177,7 @@ class TouchableWin32 extends react_1.default.Component {
174
177
  * On responder being granted, state and local data need to be set
175
178
  */
176
179
  this._touchableHandleResponderGrant = (e) => {
177
- const dispatchID = findNodeHandle(e.currentTarget);
180
+ const dispatchID = (0, RendererProxy_1.findNodeHandle)(e.currentTarget);
178
181
  e.persist();
179
182
  this._pressOutDelayTimeout && clearTimeout(this._pressOutDelayTimeout);
180
183
  this._pressOutDelayTimeout = null;
@@ -284,8 +287,8 @@ class TouchableWin32 extends react_1.default.Component {
284
287
  if (!l && !t && !w && !h && !globalX && !globalY) {
285
288
  return;
286
289
  }
287
- this._positionOnActivate = Position.getPooled(globalX, globalY);
288
- this._dimensionsOnActivate = BoundingDimensions.getPooled(w, h);
290
+ this._positionOnActivate = Position_1.default.getPooled(globalX, globalY);
291
+ this._dimensionsOnActivate = BoundingDimensions_1.default.getPooled(w, h);
289
292
  };
290
293
  this._handleDelay = (e) => {
291
294
  this._touchableDelayTimeout = null;