@office-iss/react-native-win32 0.69.0 → 0.70.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 (157) hide show
  1. package/.eslintrc.js +0 -1
  2. package/.flowconfig +5 -1
  3. package/CHANGELOG.json +241 -31
  4. package/CHANGELOG.md +97 -18
  5. package/IntegrationTests/AsyncStorageTest.js +20 -4
  6. package/IntegrationTests/BUCK +2 -2
  7. package/IntegrationTests/LayoutEventsTest.js +4 -1
  8. package/IntegrationTests/{launchWebSocketServer.command → launchWebSocketServer.sh} +3 -9
  9. package/Libraries/Alert/Alert.js +18 -4
  10. package/Libraries/Alert/Alert.win32.js +2 -0
  11. package/Libraries/Alert/NativeAlertManager.js +1 -0
  12. package/Libraries/Animated/Animated.js +2 -2
  13. package/Libraries/Animated/AnimatedEvent.js +7 -4
  14. package/Libraries/Animated/AnimatedImplementation.js +17 -3
  15. package/Libraries/Animated/AnimatedMock.js +7 -2
  16. package/Libraries/Animated/NativeAnimatedHelper.js +220 -95
  17. package/Libraries/Animated/NativeAnimatedModule.js +3 -0
  18. package/Libraries/Animated/NativeAnimatedTurboModule.js +3 -0
  19. package/Libraries/Animated/animations/SpringAnimation.js +3 -3
  20. package/Libraries/Animated/animations/TimingAnimation.js +3 -3
  21. package/Libraries/Animated/createAnimatedComponent.js +8 -1
  22. package/Libraries/Animated/nodes/AnimatedAddition.js +3 -1
  23. package/Libraries/Animated/nodes/AnimatedColor.js +50 -29
  24. package/Libraries/Animated/nodes/AnimatedDiffClamp.js +3 -1
  25. package/Libraries/Animated/nodes/AnimatedDivision.js +3 -1
  26. package/Libraries/Animated/nodes/AnimatedInterpolation.js +22 -21
  27. package/Libraries/Animated/nodes/AnimatedModulo.js +3 -1
  28. package/Libraries/Animated/nodes/AnimatedMultiplication.js +3 -2
  29. package/Libraries/Animated/nodes/AnimatedProps.js +20 -12
  30. package/Libraries/Animated/nodes/AnimatedStyle.js +19 -16
  31. package/Libraries/Animated/nodes/AnimatedSubtraction.js +3 -1
  32. package/Libraries/Animated/nodes/AnimatedTransform.js +5 -5
  33. package/Libraries/Animated/nodes/AnimatedValue.js +14 -5
  34. package/Libraries/Animated/nodes/AnimatedValueXY.js +28 -1
  35. package/Libraries/Animated/useAnimatedProps.js +1 -0
  36. package/Libraries/AppState/AppState.js +0 -32
  37. package/Libraries/BatchedBridge/MessageQueue.js +21 -15
  38. package/Libraries/BatchedBridge/NativeModules.js +3 -4
  39. package/Libraries/Blob/FileReader.js +0 -6
  40. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +0 -20
  41. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +0 -20
  42. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
  43. package/Libraries/Components/Keyboard/Keyboard.js +0 -11
  44. package/Libraries/Components/Pressable/Pressable.js +2 -0
  45. package/Libraries/Components/Pressable/Pressable.win32.js +2 -0
  46. package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +1 -3
  47. package/Libraries/Components/SafeAreaView/SafeAreaView.js +3 -30
  48. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +4 -32
  49. package/Libraries/Components/ScrollView/ScrollView.js +13 -11
  50. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -3
  51. package/Libraries/Components/StatusBar/StatusBar.js +10 -7
  52. package/Libraries/Components/TextInput/InputAccessoryView.js +14 -13
  53. package/Libraries/Components/TextInput/TextInput.js +12 -2
  54. package/Libraries/Components/Touchable/PooledClass.js +16 -4
  55. package/Libraries/Components/Touchable/Touchable.js +50 -1
  56. package/Libraries/Components/Touchable/Touchable.win32.js +972 -0
  57. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -2
  58. package/Libraries/Components/View/ReactNativeStyleAttributes.js +0 -7
  59. package/Libraries/Components/View/ViewPropTypes.js +3 -8
  60. package/Libraries/Components/View/ViewPropTypes.win32.js +3 -8
  61. package/Libraries/Components/View/ViewWin32.Props.d.ts +1 -1
  62. package/Libraries/Components/View/ViewWin32.Props.js.map +1 -1
  63. package/Libraries/Core/ExceptionsManager.js +2 -0
  64. package/Libraries/Core/ReactNativeVersion.js +1 -1
  65. package/Libraries/Core/Timers/JSTimers.js +2 -2
  66. package/Libraries/Core/polyfillPromise.js +0 -32
  67. package/Libraries/Core/setUpBatchedBridge.js +5 -1
  68. package/Libraries/Core/setUpPerformance.js +1 -1
  69. package/Libraries/EventEmitter/NativeEventEmitter.js +0 -13
  70. package/Libraries/Image/AssetSourceResolver.js +2 -2
  71. package/Libraries/Image/Image.android.js +5 -3
  72. package/Libraries/Image/Image.ios.js +6 -3
  73. package/Libraries/Image/Image.win32.js +6 -3
  74. package/Libraries/Image/ImageSource.js +7 -5
  75. package/Libraries/Inspector/ElementBox.js +2 -2
  76. package/Libraries/Inspector/NetworkOverlay.js +13 -8
  77. package/Libraries/Interaction/PanResponder.js +16 -14
  78. package/Libraries/Linking/Linking.js +0 -11
  79. package/Libraries/Lists/FlatList.js +3 -2
  80. package/Libraries/Lists/SectionList.js +2 -0
  81. package/Libraries/Lists/ViewabilityHelper.js +7 -3
  82. package/Libraries/Lists/VirtualizeUtils.js +33 -20
  83. package/Libraries/Lists/VirtualizedList.js +93 -47
  84. package/Libraries/Lists/VirtualizedListContext.js +1 -0
  85. package/Libraries/Lists/VirtualizedSectionList.js +14 -9
  86. package/Libraries/Lists/__tests__/VirtualizeUtils-test.js +19 -18
  87. package/Libraries/Lists/__tests__/VirtualizedList-test.js +10 -6
  88. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  89. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  90. package/Libraries/LogBox/LogBox.js +3 -1
  91. package/Libraries/LogBox/UI/AnsiHighlight.js +2 -0
  92. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +3 -0
  93. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +0 -3
  94. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +8 -3
  95. package/Libraries/NativeComponent/BaseViewConfig.android.js +9 -18
  96. package/Libraries/NativeComponent/BaseViewConfig.ios.js +26 -12
  97. package/Libraries/NativeComponent/BaseViewConfig.win32.js +26 -12
  98. package/Libraries/Network/XMLHttpRequest.js +9 -11
  99. package/Libraries/Performance/PureComponentDebug.js +1 -0
  100. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +9 -1
  101. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +16 -0
  102. package/Libraries/Pressability/Pressability.js +26 -16
  103. package/Libraries/Pressability/Pressability.win32.js +26 -16
  104. package/Libraries/Promise.js +0 -1
  105. package/Libraries/ReactNative/AppRegistry.js +16 -13
  106. package/Libraries/ReactNative/BridgelessUIManager.js +2 -0
  107. package/Libraries/ReactNative/PaperUIManager.js +9 -9
  108. package/Libraries/ReactNative/PaperUIManager.win32.js +7 -8
  109. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +12 -0
  110. package/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js +68 -0
  111. package/Libraries/ReactNative/getNativeComponentAttributes.js +6 -7
  112. package/Libraries/ReactNative/renderApplication.js +1 -1
  113. package/Libraries/Renderer/implementations/ReactFabric-dev.js +4443 -3615
  114. package/Libraries/Renderer/implementations/ReactFabric-prod.js +1496 -1170
  115. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1694 -1356
  116. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +4439 -3588
  117. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1583 -1249
  118. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1719 -1372
  119. package/Libraries/Storage/AsyncStorage.js +7 -1
  120. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +8 -0
  121. package/Libraries/StyleSheet/flattenStyle.js +1 -1
  122. package/Libraries/StyleSheet/processTransform.js +2 -0
  123. package/Libraries/StyleSheet/splitLayoutProps.js +2 -0
  124. package/Libraries/Text/Text.js +15 -7
  125. package/Libraries/Types/CoreEventTypes.js +137 -11
  126. package/Libraries/Types/CoreEventTypes.win32.js +147 -22
  127. package/Libraries/Utilities/Dimensions.js +0 -13
  128. package/Libraries/Utilities/Dimensions.win32.js +0 -9
  129. package/Libraries/Utilities/HMRClient.js +3 -3
  130. package/Libraries/Utilities/Platform.ios.js +0 -7
  131. package/Libraries/Utilities/ReactNativeTestTools.js +3 -1
  132. package/Libraries/Utilities/codegenNativeCommands.js +11 -2
  133. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
  134. package/Libraries/Utilities/stringifySafe.js +3 -1
  135. package/Libraries/Utilities/truncate.js +1 -1
  136. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +2 -2
  137. package/Libraries/Vibration/Vibration.js +1 -1
  138. package/Libraries/WebSocket/WebSocket.js +1 -0
  139. package/Libraries/vendor/emitter/EventEmitter.js +105 -12
  140. package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +73 -117
  141. package/flow/JSITimerInternalType.js +30 -0
  142. package/jest/assetFileTransformer.js +3 -2
  143. package/jest/setup.js +4 -0
  144. package/jest.config.js +0 -1
  145. package/overrides.json +23 -16
  146. package/package.json +21 -22
  147. package/rntypes/index.d.ts +0 -1
  148. package/src/Libraries/Components/View/ViewWin32.Props.ts +2 -1
  149. package/src/rntypes/index.d.ts +0 -1
  150. package/Libraries/vendor/emitter/EventSubscription.js +0 -19
  151. package/Libraries/vendor/emitter/_EmitterSubscription.js +0 -62
  152. package/Libraries/vendor/emitter/_EventEmitter.js +0 -184
  153. package/Libraries/vendor/emitter/_EventSubscription.js +0 -45
  154. package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +0 -108
  155. package/jest/preprocessor.js +0 -40
  156. package/jest/preprocessor_DO_NOT_USE.js +0 -122
  157. package/src/Libraries/Lists/__tests__/__snapshots__/VirtualizeUtils-test.js.snap +0 -3
@@ -20,6 +20,10 @@ import type Animation, {EndCallback} from '../animations/Animation';
20
20
  import type {InterpolationConfigType} from './AnimatedInterpolation';
21
21
  import type AnimatedTracking from './AnimatedTracking';
22
22
 
23
+ export type AnimatedValueConfig = $ReadOnly<{
24
+ useNativeDriver: boolean,
25
+ }>;
26
+
23
27
  const NativeAnimatedAPI = NativeAnimatedHelper.API;
24
28
 
25
29
  /**
@@ -87,7 +91,7 @@ class AnimatedValue extends AnimatedWithChildren {
87
91
  _animation: ?Animation;
88
92
  _tracking: ?AnimatedTracking;
89
93
 
90
- constructor(value: number) {
94
+ constructor(value: number, config?: ?AnimatedValueConfig) {
91
95
  super();
92
96
  if (typeof value !== 'number') {
93
97
  throw new Error('AnimatedValue: Attempting to set value to undefined');
@@ -95,6 +99,9 @@ class AnimatedValue extends AnimatedWithChildren {
95
99
  this._startingValue = this._value = value;
96
100
  this._offset = 0;
97
101
  this._animation = null;
102
+ if (config && config.useNativeDriver) {
103
+ this.__makeNative();
104
+ }
98
105
  }
99
106
 
100
107
  __detach() {
@@ -127,9 +134,9 @@ class AnimatedValue extends AnimatedWithChildren {
127
134
  !this.__isNative /* don't perform a flush for natively driven values */,
128
135
  );
129
136
  if (this.__isNative) {
130
- _executeAsAnimatedBatch(this.__getNativeTag().toString(), () => {
131
- NativeAnimatedAPI.setAnimatedNodeValue(this.__getNativeTag(), value);
132
- });
137
+ _executeAsAnimatedBatch(this.__getNativeTag().toString(), () =>
138
+ NativeAnimatedAPI.setAnimatedNodeValue(this.__getNativeTag(), value),
139
+ );
133
140
  }
134
141
  }
135
142
 
@@ -219,7 +226,9 @@ class AnimatedValue extends AnimatedWithChildren {
219
226
  * Interpolates the value before updating the property, e.g. mapping 0-1 to
220
227
  * 0-10.
221
228
  */
222
- interpolate(config: InterpolationConfigType): AnimatedInterpolation {
229
+ interpolate<OutputT: number | string>(
230
+ config: InterpolationConfigType<OutputT>,
231
+ ): AnimatedInterpolation<OutputT> {
223
232
  return new AnimatedInterpolation(this, config);
224
233
  }
225
234
 
@@ -10,11 +10,16 @@
10
10
 
11
11
  'use strict';
12
12
 
13
+ import type {PlatformConfig} from '../AnimatedPlatformConfig';
14
+
13
15
  const AnimatedValue = require('./AnimatedValue');
14
16
  const AnimatedWithChildren = require('./AnimatedWithChildren');
15
17
 
16
18
  const invariant = require('invariant');
17
19
 
20
+ export type AnimatedValueXYConfig = $ReadOnly<{
21
+ useNativeDriver: boolean,
22
+ }>;
18
23
  type ValueXYListenerCallback = (value: {
19
24
  x: number,
20
25
  y: number,
@@ -47,6 +52,7 @@ class AnimatedValueXY extends AnimatedWithChildren {
47
52
  +y: number | AnimatedValue,
48
53
  ...
49
54
  },
55
+ config?: ?AnimatedValueXYConfig,
50
56
  ) {
51
57
  super();
52
58
  const value: any = valueIn || {x: 0, y: 0}; // @flowfixme: shouldn't need `: any`
@@ -63,6 +69,9 @@ class AnimatedValueXY extends AnimatedWithChildren {
63
69
  this.y = value.y;
64
70
  }
65
71
  this._listeners = {};
72
+ if (config && config.useNativeDriver) {
73
+ this.__makeNative();
74
+ }
66
75
  }
67
76
 
68
77
  /**
@@ -168,7 +177,7 @@ class AnimatedValueXY extends AnimatedWithChildren {
168
177
  */
169
178
  addListener(callback: ValueXYListenerCallback): string {
170
179
  const id = String(_uniqueId++);
171
- const jointCallback = ({value: number}) => {
180
+ const jointCallback = ({value: number}: any) => {
172
181
  callback(this.__getValue());
173
182
  };
174
183
  this._listeners[id] = {
@@ -221,6 +230,24 @@ class AnimatedValueXY extends AnimatedWithChildren {
221
230
  getTranslateTransform(): Array<{[key: string]: AnimatedValue, ...}> {
222
231
  return [{translateX: this.x}, {translateY: this.y}];
223
232
  }
233
+
234
+ __attach(): void {
235
+ this.x.__addChild(this);
236
+ this.y.__addChild(this);
237
+ super.__attach();
238
+ }
239
+
240
+ __detach(): void {
241
+ this.x.__removeChild(this);
242
+ this.y.__removeChild(this);
243
+ super.__detach();
244
+ }
245
+
246
+ __makeNative(platformConfig: ?PlatformConfig) {
247
+ this.x.__makeNative(platformConfig);
248
+ this.y.__makeNative(platformConfig);
249
+ super.__makeNative(platformConfig);
250
+ }
224
251
  }
225
252
 
226
253
  module.exports = AnimatedValueXY;
@@ -82,6 +82,7 @@ export default function useAnimatedProps<TProps: {...}, TInstance>(
82
82
  scheduleUpdate();
83
83
  } else if (!node.__isNative) {
84
84
  // $FlowIgnore[not-a-function] - Assume it's still a function.
85
+ // $FlowFixMe[incompatible-use]
85
86
  instance.setNativeProps(node.__getAnimatedValue());
86
87
  } else {
87
88
  throw new Error(
@@ -127,38 +127,6 @@ class AppState {
127
127
  }
128
128
  throw new Error('Trying to subscribe to unknown event: ' + type);
129
129
  }
130
-
131
- /**
132
- * @deprecated Use `remove` on the EventSubscription from `addEventListener`.
133
- */
134
- removeEventListener<K: $Keys<AppStateEventDefinitions>>(
135
- type: K,
136
- listener: (...$ElementType<AppStateEventDefinitions, K>) => mixed,
137
- ): void {
138
- const emitter = this._emitter;
139
- if (emitter == null) {
140
- throw new Error('Cannot use AppState when `isAvailable` is false.');
141
- }
142
- // NOTE: This will report a deprecation notice via `console.error`.
143
- switch (type) {
144
- case 'change':
145
- // $FlowIssue[invalid-tuple-arity] Flow cannot refine handler based on the event type
146
- // $FlowIssue[incompatible-call]
147
- emitter.removeListener('appStateDidChange', listener);
148
- return;
149
- case 'memoryWarning':
150
- // $FlowIssue[invalid-tuple-arity] Flow cannot refine handler based on the event type
151
- emitter.removeListener('memoryWarning', listener);
152
- return;
153
- case 'blur':
154
- case 'focus':
155
- // $FlowIssue[invalid-tuple-arity] Flow cannot refine handler based on the event type
156
- // $FlowIssue[incompatible-call]
157
- emitter.removeListener('appStateFocusChange', listener);
158
- return;
159
- }
160
- throw new Error('Trying to unsubscribe from unknown event: ' + type);
161
- }
162
130
  }
163
131
 
164
132
  module.exports = (new AppState(): AppState);
@@ -10,13 +10,12 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const ErrorUtils = require('../vendor/core/ErrorUtils');
14
13
  const Systrace = require('../Performance/Systrace');
15
-
16
14
  const deepFreezeAndThrowOnMutationInDev = require('../Utilities/deepFreezeAndThrowOnMutationInDev');
17
- const invariant = require('invariant');
18
15
  const stringifySafe = require('../Utilities/stringifySafe').default;
19
16
  const warnOnce = require('../Utilities/warnOnce');
17
+ const ErrorUtils = require('../vendor/core/ErrorUtils');
18
+ const invariant = require('invariant');
20
19
 
21
20
  export type SpyData = {
22
21
  type: number,
@@ -199,7 +198,7 @@ class MessageQueue {
199
198
  delete this._debugInfo[this._callID - DEBUG_INFO_LIMIT];
200
199
  }
201
200
  if (this._successCallbacks.size > 500) {
202
- const info = {};
201
+ const info: {[number]: {method: string, module: string}} = {};
203
202
  this._successCallbacks.forEach((_, callID) => {
204
203
  const debug = this._debugInfo[callID];
205
204
  const module = debug && this._remoteModuleTable[debug[0]];
@@ -253,7 +252,7 @@ class MessageQueue {
253
252
  // folly-convertible. As a special case, if a prop value is a
254
253
  // function it is permitted here, and special-cased in the
255
254
  // conversion.
256
- const isValidArgument = val => {
255
+ const isValidArgument = (val: mixed) => {
257
256
  switch (typeof val) {
258
257
  case 'undefined':
259
258
  case 'boolean':
@@ -287,7 +286,7 @@ class MessageQueue {
287
286
  // Replacement allows normally non-JSON-convertible values to be
288
287
  // seen. There is ambiguity with string values, but in context,
289
288
  // it should at least be a strong hint.
290
- const replacer = (key, val) => {
289
+ const replacer = (key: string, val: $FlowFixMe) => {
291
290
  const t = typeof val;
292
291
  if (t === 'function') {
293
292
  return '<<Function ' + val.name + '>>';
@@ -405,15 +404,22 @@ class MessageQueue {
405
404
  this.__spy({type: TO_JS, module, method, args});
406
405
  }
407
406
  const moduleMethods = this.getCallableModule(module);
408
- invariant(
409
- !!moduleMethods,
410
- `Module ${module} is not a registered callable module (calling ${method}). A frequent cause of the error is that the application entry file path is incorrect.
411
- This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.`,
412
- );
413
- invariant(
414
- !!moduleMethods[method],
415
- `Method ${method} does not exist on module ${module}`,
416
- );
407
+ if (!moduleMethods) {
408
+ const callableModuleNames = Object.keys(this._lazyCallableModules);
409
+ const n = callableModuleNames.length;
410
+ const callableModuleNameList = callableModuleNames.join(', ');
411
+ invariant(
412
+ false,
413
+ `Failed to call into JavaScript module method ${module}.${method}(). Module has not been registered as callable. Registered callable JavaScript modules (n = ${n}): ${callableModuleNameList}.
414
+ A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.`,
415
+ );
416
+ }
417
+ if (!moduleMethods[method]) {
418
+ invariant(
419
+ false,
420
+ `Failed to call into JavaScript module method ${module}.${method}(). Module exists, but the method is undefined.`,
421
+ );
422
+ }
417
423
  moduleMethods[method].apply(moduleMethods, args);
418
424
  Systrace.endEvent();
419
425
  }
@@ -10,12 +10,11 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const BatchedBridge = require('./BatchedBridge');
13
+ import type {ExtendedError} from '../Core/ExtendedError';
14
14
 
15
+ const BatchedBridge = require('./BatchedBridge');
15
16
  const invariant = require('invariant');
16
17
 
17
- import type {ExtendedError} from '../Core/ExtendedError';
18
-
19
18
  export type ModuleConfig = [
20
19
  string /* name */,
21
20
  ?{...} /* constants */,
@@ -51,7 +50,7 @@ function genModule(
51
50
  return {name: moduleName};
52
51
  }
53
52
 
54
- const module = {};
53
+ const module: {[string]: mixed} = {};
55
54
  methods &&
56
55
  methods.forEach((methodName, methodID) => {
57
56
  const isPromise =
@@ -46,7 +46,6 @@ class FileReader extends (EventTarget(...READER_EVENTS): any) {
46
46
  _error: ?Error;
47
47
  _result: ?ReaderResult;
48
48
  _aborted: boolean = false;
49
- _subscriptions: Array<any> = [];
50
49
 
51
50
  constructor() {
52
51
  super();
@@ -59,11 +58,6 @@ class FileReader extends (EventTarget(...READER_EVENTS): any) {
59
58
  this._result = null;
60
59
  }
61
60
 
62
- _clearSubscriptions(): void {
63
- this._subscriptions.forEach(sub => sub.remove());
64
- this._subscriptions = [];
65
- }
66
-
67
61
  _setReadyState(newState: ReadyState) {
68
62
  this._readyState = newState;
69
63
  this.dispatchEvent({type: 'readystatechange'});
@@ -12,7 +12,6 @@ import RCTDeviceEventEmitter from '../../EventEmitter/RCTDeviceEventEmitter';
12
12
  import {sendAccessibilityEvent} from '../../Renderer/shims/ReactNative';
13
13
  import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
14
14
  import Platform from '../../Utilities/Platform';
15
- import type EventEmitter from '../../vendor/emitter/EventEmitter';
16
15
  import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
17
16
  import NativeAccessibilityInfoAndroid from './NativeAccessibilityInfo';
18
17
  import NativeAccessibilityManagerIOS from './NativeAccessibilityManager';
@@ -365,25 +364,6 @@ const AccessibilityInfo = {
365
364
  }
366
365
  },
367
366
 
368
- /**
369
- * @deprecated Use `remove` on the EventSubscription from `addEventListener`.
370
- */
371
- removeEventListener<K: $Keys<AccessibilityEventDefinitions>>(
372
- eventName: K,
373
- handler: (...$ElementType<AccessibilityEventDefinitions, K>) => void,
374
- ): void {
375
- // NOTE: This will report a deprecation notice via `console.error`.
376
- const deviceEventName = EventNames.get(eventName);
377
- if (deviceEventName != null) {
378
- // $FlowIgnore[incompatible-cast]
379
- (RCTDeviceEventEmitter: EventEmitter<$FlowFixMe>).removeListener(
380
- 'deviceEventName',
381
- // $FlowFixMe[invalid-tuple-arity]
382
- handler,
383
- );
384
- }
385
- },
386
-
387
367
  /**
388
368
  * Get the recommended timeout for changes to the UI needed by this user.
389
369
  *
@@ -12,7 +12,6 @@ import RCTDeviceEventEmitter from '../../EventEmitter/RCTDeviceEventEmitter';
12
12
  import {sendAccessibilityEvent} from '../../Renderer/shims/ReactNative';
13
13
  import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
14
14
  import Platform from '../../Utilities/Platform';
15
- import type EventEmitter from '../../vendor/emitter/EventEmitter';
16
15
  import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
17
16
  import NativeAccessibilityInfo from './NativeAccessibilityInfo';
18
17
  import NativeAccessibilityManagerIOS from './NativeAccessibilityManager';
@@ -371,25 +370,6 @@ const AccessibilityInfo = {
371
370
  }
372
371
  },
373
372
 
374
- /**
375
- * @deprecated Use `remove` on the EventSubscription from `addEventListener`.
376
- */
377
- removeEventListener<K: $Keys<AccessibilityEventDefinitions>>(
378
- eventName: K,
379
- handler: (...$ElementType<AccessibilityEventDefinitions, K>) => void,
380
- ): void {
381
- // NOTE: This will report a deprecation notice via `console.error`.
382
- const deviceEventName = EventNames.get(eventName);
383
- if (deviceEventName != null) {
384
- // $FlowIgnore[incompatible-cast]
385
- (RCTDeviceEventEmitter: EventEmitter<$FlowFixMe>).removeListener(
386
- 'deviceEventName',
387
- // $FlowFixMe[invalid-tuple-arity]
388
- handler,
389
- );
390
- }
391
- },
392
-
393
373
  /**
394
374
  * Get the recommended timeout for changes to the UI needed by this user.
395
375
  *
@@ -232,6 +232,8 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
232
232
  );
233
233
  }
234
234
 
235
+ /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
236
+ * LTI update could not be added via codemod */
235
237
  _onDrawerSlide = event => {
236
238
  if (this.props.onDrawerSlide) {
237
239
  this.props.onDrawerSlide(event);
@@ -253,6 +255,8 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
253
255
  }
254
256
  };
255
257
 
258
+ /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
259
+ * LTI update could not be added via codemod */
256
260
  _onDrawerStateChanged = event => {
257
261
  if (this.props.onDrawerStateChanged) {
258
262
  this.props.onDrawerStateChanged(
@@ -141,17 +141,6 @@ class Keyboard {
141
141
  return this._emitter.addListener(eventType, listener);
142
142
  }
143
143
 
144
- /**
145
- * @deprecated Use `remove` on the EventSubscription from `addListener`.
146
- */
147
- removeListener<K: $Keys<KeyboardEventDefinitions>>(
148
- eventType: K,
149
- listener: (...$ElementType<KeyboardEventDefinitions, K>) => mixed,
150
- ): void {
151
- // NOTE: This will report a deprecation notice via `console.error`.
152
- this._emitter.removeListener(eventType, listener);
153
- }
154
-
155
144
  /**
156
145
  * Removes all listeners for a specific event type.
157
146
  *
@@ -170,6 +170,8 @@ type Props = $ReadOnly<{|
170
170
  * Component used to build display components that should respond to whether the
171
171
  * component is currently pressed or not.
172
172
  */
173
+ /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
174
+ * LTI update could not be added via codemod */
173
175
  function Pressable(props: Props, forwardedRef): React.Node {
174
176
  const {
175
177
  accessible,
@@ -216,6 +216,8 @@ type Props = $ReadOnly<{|
216
216
  * Component used to build display components that should respond to whether the
217
217
  * component is currently pressed or not.
218
218
  */
219
+ /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
220
+ * LTI update could not be added via codemod */
219
221
  function Pressable(props: Props, forwardedRef): React.Node {
220
222
  const {
221
223
  accessible,
@@ -9,7 +9,6 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../View/ViewPropTypes';
12
- import type {WithDefault} from '../../Types/CodegenTypes';
13
12
 
14
13
  import codegenNativeComponent from '../../Utilities/codegenNativeComponent';
15
14
  import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
@@ -17,8 +16,7 @@ import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
17
16
  type NativeProps = $ReadOnly<{|
18
17
  ...ViewProps,
19
18
 
20
- // Props
21
- emulateUnlessSupported?: WithDefault<boolean, false>,
19
+ // No props
22
20
  |}>;
23
21
 
24
22
  export default (codegenNativeComponent<NativeProps>('SafeAreaView', {
@@ -12,18 +12,9 @@ import Platform from '../../Utilities/Platform';
12
12
  import * as React from 'react';
13
13
  import View from '../View/View';
14
14
 
15
- import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
16
15
  import type {ViewProps} from '../View/ViewPropTypes';
17
16
 
18
- type Props = $ReadOnly<{|
19
- ...ViewProps,
20
- emulateUnlessSupported?: boolean,
21
- |}>;
22
-
23
- let exported: React.AbstractComponent<
24
- Props,
25
- React.ElementRef<HostComponent<mixed>>,
26
- >;
17
+ let exported: React.AbstractComponent<ViewProps, React.ElementRef<typeof View>>;
27
18
 
28
19
  /**
29
20
  * Renders nested content and automatically applies paddings reflect the portion
@@ -35,27 +26,9 @@ let exported: React.AbstractComponent<
35
26
  * sensor housing area on iPhone X).
36
27
  */
37
28
  if (Platform.OS === 'android') {
38
- exported = React.forwardRef<Props, React.ElementRef<HostComponent<mixed>>>(
39
- function SafeAreaView(props, forwardedRef) {
40
- const {emulateUnlessSupported, ...localProps} = props;
41
- return <View {...localProps} ref={forwardedRef} />;
42
- },
43
- );
29
+ exported = View;
44
30
  } else {
45
- const RCTSafeAreaViewNativeComponent =
46
- require('./RCTSafeAreaViewNativeComponent').default;
47
-
48
- exported = React.forwardRef<Props, React.ElementRef<HostComponent<mixed>>>(
49
- function SafeAreaView(props, forwardedRef) {
50
- return (
51
- <RCTSafeAreaViewNativeComponent
52
- emulateUnlessSupported={true}
53
- {...props}
54
- ref={forwardedRef}
55
- />
56
- );
57
- },
58
- );
31
+ exported = require('./RCTSafeAreaViewNativeComponent').default;
59
32
  }
60
33
 
61
34
  export default exported;
@@ -12,18 +12,9 @@ import Platform from '../../Utilities/Platform';
12
12
  import * as React from 'react';
13
13
  import View from '../View/View';
14
14
 
15
- import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
16
15
  import type {ViewProps} from '../View/ViewPropTypes';
17
16
 
18
- type Props = $ReadOnly<{|
19
- ...ViewProps,
20
- emulateUnlessSupported?: boolean,
21
- |}>;
22
-
23
- let exported: React.AbstractComponent<
24
- Props,
25
- React.ElementRef<HostComponent<mixed>>,
26
- >;
17
+ let exported: React.AbstractComponent<ViewProps, React.ElementRef<typeof View>>;
27
18
 
28
19
  /**
29
20
  * Renders nested content and automatically applies paddings reflect the portion
@@ -34,30 +25,11 @@ let exported: React.AbstractComponent<
34
25
  * limitation of the screen, such as rounded corners or camera notches (aka
35
26
  * sensor housing area on iPhone X).
36
27
  */
37
- // [Win32 - Added win32 to if
28
+
38
29
  if (Platform.OS === 'android' || Platform.OS === 'win32') {
39
- // Win32]
40
- exported = React.forwardRef<Props, React.ElementRef<HostComponent<mixed>>>(
41
- function SafeAreaView(props, forwardedRef) {
42
- const {emulateUnlessSupported, ...localProps} = props;
43
- return <View {...localProps} ref={forwardedRef} />;
44
- },
45
- );
30
+ exported = View;
46
31
  } else {
47
- const RCTSafeAreaViewNativeComponent =
48
- require('./RCTSafeAreaViewNativeComponent').default;
49
-
50
- exported = React.forwardRef<Props, React.ElementRef<HostComponent<mixed>>>(
51
- function SafeAreaView(props, forwardedRef) {
52
- return (
53
- <RCTSafeAreaViewNativeComponent
54
- emulateUnlessSupported={true}
55
- {...props}
56
- ref={forwardedRef}
57
- />
58
- );
59
- },
60
- );
32
+ exported = require('./RCTSafeAreaViewNativeComponent').default;
61
33
  }
62
34
 
63
35
  export default exported;
@@ -173,8 +173,8 @@ type IOSProps = $ReadOnly<{|
173
173
  */
174
174
  automaticallyAdjustContentInsets?: ?boolean,
175
175
  /**
176
- * Controls whether the ScrollView should automatically adjust it's contentInset
177
- * and scrollViewInsets when the Keyboard changes it's size. The default value is false.
176
+ * Controls whether the ScrollView should automatically adjust its `contentInset`
177
+ * and `scrollViewInsets` when the Keyboard changes its size. The default value is false.
178
178
  * @platform ios
179
179
  */
180
180
  automaticallyAdjustKeyboardInsets?: ?boolean,
@@ -190,12 +190,6 @@ type IOSProps = $ReadOnly<{|
190
190
  * @platform ios
191
191
  */
192
192
  contentInset?: ?EdgeInsetsProp,
193
- /**
194
- * Used to manually set the starting scroll offset.
195
- * The default value is `{x: 0, y: 0}`.
196
- * @platform ios
197
- */
198
- contentOffset?: ?PointProp,
199
193
  /**
200
194
  * When true, the scroll view bounces when it reaches the end of the
201
195
  * content if the content is larger then the scroll view along the axis of
@@ -457,6 +451,11 @@ export type Props = $ReadOnly<{|
457
451
  * ```
458
452
  */
459
453
  contentContainerStyle?: ?ViewStyleProp,
454
+ /**
455
+ * Used to manually set the starting scroll offset.
456
+ * The default value is `{x: 0, y: 0}`.
457
+ */
458
+ contentOffset?: ?PointProp,
460
459
  /**
461
460
  * When true, the scroll view stops on the next index (in relation to scroll
462
461
  * position at release) regardless of how fast the gesture is. This can be
@@ -1108,7 +1107,7 @@ class ScrollView extends React.Component<Props, State> {
1108
1107
  }
1109
1108
  };
1110
1109
 
1111
- _getKeyForIndex(index, childArray) {
1110
+ _getKeyForIndex(index: $FlowFixMe, childArray: $FlowFixMe) {
1112
1111
  const child = childArray[index];
1113
1112
  return child && child.key;
1114
1113
  }
@@ -1141,7 +1140,7 @@ class ScrollView extends React.Component<Props, State> {
1141
1140
  }
1142
1141
  }
1143
1142
 
1144
- _onStickyHeaderLayout(index, event, key) {
1143
+ _onStickyHeaderLayout(index: $FlowFixMe, event: $FlowFixMe, key: $FlowFixMe) {
1145
1144
  const {stickyHeaderIndices} = this.props;
1146
1145
  if (!stickyHeaderIndices) {
1147
1146
  return;
@@ -1519,6 +1518,7 @@ class ScrollView extends React.Component<Props, State> {
1519
1518
  keyboardNeverPersistTaps &&
1520
1519
  this._keyboardIsDismissible() &&
1521
1520
  e.target != null &&
1521
+ // $FlowFixMe[incompatible-call]
1522
1522
  !TextInputState.isTextInput(e.target)
1523
1523
  ) {
1524
1524
  return true;
@@ -1822,7 +1822,9 @@ const styles = StyleSheet.create({
1822
1822
  },
1823
1823
  });
1824
1824
 
1825
- function Wrapper(props, ref) {
1825
+ /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
1826
+ * LTI update could not be added via codemod */
1827
+ function Wrapper(props, ref: (mixed => mixed) | {current: mixed, ...}) {
1826
1828
  return <ScrollView {...props} scrollViewRef={ref} />;
1827
1829
  }
1828
1830
  Wrapper.displayName = 'ScrollView';
@@ -90,7 +90,7 @@ class ScrollViewStickyHeader extends React.Component<Props, State> {
90
90
  }
91
91
 
92
92
  updateTranslateListener(
93
- translateY: AnimatedImplementation.Interpolation,
93
+ translateY: AnimatedNode,
94
94
  isFabric: boolean,
95
95
  offset: AnimatedDiffClamp | null,
96
96
  ) {
@@ -177,6 +177,8 @@ class ScrollViewStickyHeader extends React.Component<Props, State> {
177
177
  }
178
178
  };
179
179
 
180
+ /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
181
+ * LTI update could not be added via codemod */
180
182
  _setComponentRef = ref => {
181
183
  this._ref = ref;
182
184
  };
@@ -274,11 +276,11 @@ class ScrollViewStickyHeader extends React.Component<Props, State> {
274
276
  .interpolate({
275
277
  extrapolateLeft: 'clamp',
276
278
  inputRange: [layoutY, layoutY + 1],
277
- outputRange: ([0, 1]: Array<number>),
279
+ outputRange: [0, 1],
278
280
  })
279
281
  .interpolate({
280
282
  inputRange: [0, 1],
281
- outputRange: ([0, -1]: Array<number>),
283
+ outputRange: [0, -1],
282
284
  }),
283
285
  -this.state.layoutHeight,
284
286
  0,
@@ -112,14 +112,17 @@ function mergePropsStack(
112
112
  propsStack: Array<Object>,
113
113
  defaultValues: Object,
114
114
  ): Object {
115
- return propsStack.reduce((prev, cur) => {
116
- for (const prop in cur) {
117
- if (cur[prop] != null) {
118
- prev[prop] = cur[prop];
115
+ return propsStack.reduce(
116
+ (prev, cur) => {
117
+ for (const prop in cur) {
118
+ if (cur[prop] != null) {
119
+ prev[prop] = cur[prop];
120
+ }
119
121
  }
120
- }
121
- return prev;
122
- }, Object.assign({}, defaultValues));
122
+ return prev;
123
+ },
124
+ {...defaultValues},
125
+ );
123
126
  }
124
127
 
125
128
  /**