react-native-windows 0.0.0-canary.577 → 0.0.0-canary.579

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 (192) hide show
  1. package/.flowconfig +2 -5
  2. package/Libraries/Animated/Animated.js +12 -10
  3. package/Libraries/Animated/AnimatedEvent.js +8 -12
  4. package/Libraries/Animated/AnimatedImplementation.js +18 -18
  5. package/Libraries/Animated/AnimatedMock.js +8 -8
  6. package/Libraries/Animated/AnimatedWeb.js +2 -2
  7. package/Libraries/Animated/Easing.js +2 -2
  8. package/Libraries/Animated/NativeAnimatedHelper.js +1 -1
  9. package/Libraries/Animated/SpringConfig.js +2 -7
  10. package/Libraries/Animated/animations/Animation.js +2 -4
  11. package/Libraries/Animated/animations/DecayAnimation.js +4 -6
  12. package/Libraries/Animated/animations/SpringAnimation.js +6 -8
  13. package/Libraries/Animated/animations/TimingAnimation.js +5 -7
  14. package/Libraries/Animated/bezier.js +2 -2
  15. package/Libraries/Animated/components/AnimatedFlatList.js +3 -3
  16. package/Libraries/Animated/components/AnimatedImage.js +3 -3
  17. package/Libraries/Animated/components/AnimatedScrollView.js +107 -12
  18. package/Libraries/Animated/components/AnimatedSectionList.js +2 -2
  19. package/Libraries/Animated/components/AnimatedText.js +3 -3
  20. package/Libraries/Animated/components/AnimatedView.js +3 -3
  21. package/Libraries/Animated/createAnimatedComponent.js +8 -8
  22. package/Libraries/Animated/nodes/AnimatedAddition.js +4 -6
  23. package/Libraries/Animated/nodes/AnimatedDiffClamp.js +3 -5
  24. package/Libraries/Animated/nodes/AnimatedDivision.js +5 -7
  25. package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -7
  26. package/Libraries/Animated/nodes/AnimatedModulo.js +3 -5
  27. package/Libraries/Animated/nodes/AnimatedMultiplication.js +4 -6
  28. package/Libraries/Animated/nodes/AnimatedNode.js +5 -6
  29. package/Libraries/Animated/nodes/AnimatedProps.js +9 -10
  30. package/Libraries/Animated/nodes/AnimatedStyle.js +6 -8
  31. package/Libraries/Animated/nodes/AnimatedSubtraction.js +4 -6
  32. package/Libraries/Animated/nodes/AnimatedTracking.js +6 -10
  33. package/Libraries/Animated/nodes/AnimatedTransform.js +4 -6
  34. package/Libraries/Animated/nodes/AnimatedValue.js +5 -7
  35. package/Libraries/Animated/nodes/AnimatedValueXY.js +4 -6
  36. package/Libraries/Animated/nodes/AnimatedWithChildren.js +3 -5
  37. package/Libraries/BatchedBridge/NativeModules.js +1 -0
  38. package/Libraries/Components/TextInput/TextInput.flow.js +1051 -0
  39. package/Libraries/Components/TextInput/TextInput.js +2 -8
  40. package/Libraries/Components/TextInput/TextInput.windows.js +2 -8
  41. package/Libraries/Components/View/ReactNativeStyleAttributes.js +2 -1
  42. package/Libraries/Core/ReactNativeVersion.js +1 -1
  43. package/Libraries/Core/setUpReactDevTools.js +4 -1
  44. package/Libraries/Image/Image.android.js +12 -12
  45. package/Libraries/Image/ImageViewNativeComponent.js +3 -1
  46. package/Libraries/Image/TextInlineImageNativeComponent.js +1 -1
  47. package/Libraries/Image/resolveAssetSource.js +2 -0
  48. package/Libraries/Inspector/DevtoolsOverlay.js +19 -9
  49. package/Libraries/Inspector/Inspector.js +8 -2
  50. package/Libraries/Lists/ChildListCollection.js +72 -0
  51. package/Libraries/Lists/VirtualizedList.js +39 -385
  52. package/Libraries/Lists/VirtualizedListCellRenderer.js +261 -0
  53. package/Libraries/Lists/VirtualizedListContext.js +3 -45
  54. package/Libraries/Lists/VirtualizedListProps.js +0 -6
  55. package/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js +67 -420
  56. package/Libraries/Pressability/Pressability.js +1 -0
  57. package/Libraries/Pressability/Pressability.windows.js +1 -0
  58. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +6 -0
  59. package/Libraries/ReactNative/getCachedComponentWithDebugName.js +1 -0
  60. package/Libraries/Renderer/shims/ReactNativeTypes.js +21 -21
  61. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +7 -7
  62. package/Libraries/StyleSheet/StyleSheetTypes.js +29 -27
  63. package/Libraries/StyleSheet/private/_TransformStyle.js +25 -23
  64. package/Libraries/StyleSheet/processFontVariant.js +30 -0
  65. package/Libraries/StyleSheet/processTransform.js +117 -1
  66. package/Libraries/Text/Text.js +8 -1
  67. package/Libraries/Text/Text.windows.js +8 -1
  68. package/Libraries/Utilities/differ/deepDiffer.js +1 -0
  69. package/Libraries/__tests__/ViewWindows-test.js +16 -0
  70. package/Microsoft.ReactNative/INativeUIManager.h +0 -1
  71. package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +2 -2
  72. package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +1 -18
  73. package/Microsoft.ReactNative/Views/ShadowNodeRegistry.cpp +0 -12
  74. package/Microsoft.ReactNative/Views/ShadowNodeRegistry.h +0 -2
  75. package/Microsoft.ReactNative/XamlUIService.cpp +7 -7
  76. package/Microsoft.ReactNative.Managed/packages.lock.json +3 -3
  77. package/PropertySheets/Generated/PackageVersion.g.props +1 -1
  78. package/PropertySheets/JSEngine.props +1 -1
  79. package/index.js +7 -3
  80. package/index.windows.js +7 -3
  81. package/jest/renderer.js +2 -2
  82. package/jest/setup.js +5 -5
  83. package/package.json +12 -14
  84. package/rntypes/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +79 -0
  85. package/rntypes/Libraries/Alert/Alert.d.ts +90 -0
  86. package/rntypes/Libraries/Animated/Animated.d.ts +587 -0
  87. package/rntypes/Libraries/Animated/Easing.d.ts +37 -0
  88. package/rntypes/Libraries/AppState/AppState.d.ts +58 -0
  89. package/rntypes/Libraries/BatchedBridge/NativeModules.d.ts +25 -0
  90. package/rntypes/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +128 -0
  91. package/rntypes/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +86 -0
  92. package/rntypes/Libraries/Components/Button.d.ts +42 -0
  93. package/rntypes/Libraries/Components/Clipboard/Clipboard.d.ts +28 -0
  94. package/rntypes/Libraries/Components/DatePicker/DatePickerIOS.d.ts +92 -0
  95. package/rntypes/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +141 -0
  96. package/rntypes/Libraries/Components/Keyboard/Keyboard.d.ts +109 -0
  97. package/rntypes/Libraries/Components/Keyboard/KeyboardAvoidingView.d.ts +45 -0
  98. package/rntypes/Libraries/Components/Pressable/Pressable.d.ts +167 -0
  99. package/rntypes/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts +83 -0
  100. package/rntypes/Libraries/Components/ProgressViewIOS/ProgressViewIOS.d.ts +62 -0
  101. package/rntypes/Libraries/Components/RefreshControl/RefreshControl.d.ts +87 -0
  102. package/rntypes/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +24 -0
  103. package/rntypes/Libraries/Components/ScrollView/ScrollView.d.ts +910 -0
  104. package/rntypes/Libraries/Components/Slider/Slider.d.ts +132 -0
  105. package/rntypes/Libraries/Components/StatusBar/StatusBar.d.ts +138 -0
  106. package/rntypes/Libraries/Components/Switch/Switch.d.ts +111 -0
  107. package/rntypes/Libraries/Components/TextInput/InputAccessoryView.d.ts +34 -0
  108. package/rntypes/Libraries/Components/TextInput/TextInput.d.ts +834 -0
  109. package/rntypes/Libraries/Components/ToastAndroid/ToastAndroid.d.ts +47 -0
  110. package/rntypes/Libraries/Components/Touchable/Touchable.d.ts +90 -0
  111. package/rntypes/Libraries/Components/Touchable/TouchableHighlight.d.ts +67 -0
  112. package/rntypes/Libraries/Components/Touchable/TouchableNativeFeedback.d.ts +114 -0
  113. package/rntypes/Libraries/Components/Touchable/TouchableOpacity.d.ts +108 -0
  114. package/rntypes/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +141 -0
  115. package/rntypes/Libraries/Components/View/View.d.ts +29 -0
  116. package/rntypes/Libraries/Components/View/ViewAccessibility.d.ts +281 -0
  117. package/rntypes/Libraries/Components/View/ViewPropTypes.d.ts +245 -0
  118. package/rntypes/Libraries/EventEmitter/NativeEventEmitter.d.ts +70 -0
  119. package/rntypes/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts +30 -0
  120. package/rntypes/Libraries/EventEmitter/RCTNativeAppEventEmitter.d.ts +32 -0
  121. package/rntypes/Libraries/Image/Image.d.ts +313 -0
  122. package/rntypes/Libraries/Image/ImagePickerIOS.d.ts +48 -0
  123. package/rntypes/Libraries/Image/ImageResizeMode.d.ts +49 -0
  124. package/rntypes/Libraries/Image/ImageSource.d.ts +76 -0
  125. package/rntypes/Libraries/Interaction/InteractionManager.d.ts +74 -0
  126. package/rntypes/Libraries/Interaction/PanResponder.d.ts +202 -0
  127. package/rntypes/Libraries/LayoutAnimation/LayoutAnimation.d.ts +84 -0
  128. package/rntypes/Libraries/Linking/Linking.d.ts +61 -0
  129. package/rntypes/Libraries/Lists/FlatList.d.ts +292 -0
  130. package/rntypes/Libraries/Lists/SectionList.d.ts +300 -0
  131. package/rntypes/Libraries/Lists/VirtualizedList.d.ts +317 -0
  132. package/rntypes/Libraries/LogBox/LogBox.d.ts +28 -0
  133. package/rntypes/Libraries/Modal/Modal.d.ts +104 -0
  134. package/rntypes/Libraries/Performance/Systrace.d.ts +76 -0
  135. package/rntypes/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +115 -0
  136. package/rntypes/Libraries/PushNotificationIOS/PushNotificationIOS.d.ts +275 -0
  137. package/rntypes/Libraries/ReactNative/AppRegistry.d.ts +68 -0
  138. package/rntypes/Libraries/ReactNative/I18nManager.d.ts +25 -0
  139. package/rntypes/Libraries/ReactNative/RendererProxy.d.ts +20 -0
  140. package/rntypes/Libraries/ReactNative/UIManager.d.ts +157 -0
  141. package/rntypes/Libraries/ReactNative/requireNativeComponent.d.ts +23 -0
  142. package/rntypes/Libraries/Renderer/implementations/ReactNativeRenderer.d.ts +149 -0
  143. package/rntypes/Libraries/Renderer/shims/ReactNativeTypes.d.ts +141 -0
  144. package/rntypes/Libraries/Settings/Settings.d.ts +18 -0
  145. package/rntypes/Libraries/Share/Share.d.ts +79 -0
  146. package/rntypes/Libraries/Storage/AsyncStorage.d.ts +120 -0
  147. package/rntypes/Libraries/StyleSheet/PlatformColorValueTypes.d.ts +18 -0
  148. package/rntypes/Libraries/StyleSheet/PlatformColorValueTypesIOS.d.ts +25 -0
  149. package/rntypes/Libraries/StyleSheet/StyleSheet.d.ts +156 -0
  150. package/rntypes/Libraries/StyleSheet/StyleSheetTypes.d.ts +328 -0
  151. package/rntypes/Libraries/StyleSheet/processColor.d.ts +16 -0
  152. package/rntypes/Libraries/Text/Text.d.ts +187 -0
  153. package/rntypes/Libraries/TurboModule/RCTExport.d.ts +12 -0
  154. package/rntypes/Libraries/TurboModule/TurboModuleRegistry.d.ts +15 -0
  155. package/rntypes/Libraries/Types/CoreEventTypes.d.ts +263 -0
  156. package/rntypes/Libraries/Utilities/Appearance.d.ts +43 -0
  157. package/rntypes/Libraries/Utilities/BackHandler.d.ts +38 -0
  158. package/rntypes/Libraries/Utilities/DevSettings.d.ts +32 -0
  159. package/rntypes/Libraries/Utilities/Dimensions.d.ts +79 -0
  160. package/rntypes/Libraries/Utilities/PixelRatio.d.ts +64 -0
  161. package/rntypes/Libraries/Utilities/Platform.d.ts +102 -0
  162. package/rntypes/Libraries/Vibration/Vibration.d.ts +43 -0
  163. package/rntypes/Libraries/YellowBox/YellowBoxDeprecated.d.ts +19 -0
  164. package/rntypes/Libraries/vendor/core/ErrorUtils.d.ts +15 -0
  165. package/rntypes/Libraries/vendor/emitter/EventEmitter.d.ts +164 -0
  166. package/rntypes/types/BatchedBridge.d.ts +32 -0
  167. package/rntypes/types/Codegen.d.ts +74 -0
  168. package/rntypes/types/Devtools.d.ts +31 -0
  169. package/rntypes/types/LaunchScreen.d.ts +18 -0
  170. package/rntypes/types/Utilities.d.ts +29 -0
  171. package/rntypes/types/globals.d.ts +577 -0
  172. package/rntypes/types/index.d.ts +211 -0
  173. package/rntypes/types/legacy-properties.d.ts +245 -0
  174. package/typings-index.d.ts +1 -1
  175. package/typings-index.js +1 -1
  176. package/typings-index.js.map +1 -1
  177. package/Libraries/Lists/VirtualizedList.windows.js +0 -9
  178. package/Libraries/Lists/VirtualizedListProps.windows.js +0 -288
  179. package/Libraries/Lists/__tests__/CellRenderMask-test.js +0 -188
  180. package/Libraries/Lists/__tests__/FillRateHelper-test.js +0 -120
  181. package/Libraries/Lists/__tests__/FlatList-test.js +0 -186
  182. package/Libraries/Lists/__tests__/SectionList-test.js +0 -109
  183. package/Libraries/Lists/__tests__/ViewabilityHelper-test.js +0 -444
  184. package/Libraries/Lists/__tests__/VirtualizeUtils-test.js +0 -108
  185. package/Libraries/Lists/__tests__/VirtualizedList-test.js +0 -2098
  186. package/Libraries/Lists/__tests__/VirtualizedSectionList-test.js +0 -269
  187. package/rntypes/BatchedBridge.d.ts +0 -23
  188. package/rntypes/Devtools.d.ts +0 -20
  189. package/rntypes/LaunchScreen.d.ts +0 -9
  190. package/rntypes/globals.d.ts +0 -497
  191. package/rntypes/index.d.ts +0 -9754
  192. package/rntypes/legacy-properties.d.ts +0 -238
package/.flowconfig CHANGED
@@ -31,7 +31,6 @@
31
31
  <PROJECT_ROOT>/Libraries/NewAppScreen/components/ReloadInstructions.js
32
32
  <PROJECT_ROOT>/Libraries/Pressability/Pressability.js
33
33
  <PROJECT_ROOT>/Libraries/Types/CoreEventTypes.js
34
- <PROJECT_ROOT>/Libraries/Lists/VirtualizedListProps.js
35
34
 
36
35
  ; Ignore react-native files in node_modules since they are copied into project root
37
36
  .*/node_modules/react-native/.*
@@ -52,7 +51,7 @@
52
51
  <PROJECT_ROOT>/template/.*
53
52
 
54
53
  ; Ignore the Dangerfile
55
- <PROJECT_ROOT>/bots/dangerfile.js
54
+ <PROJECT_ROOT>/packages/react-native-bots/dangerfile.js
56
55
 
57
56
  ; Ignore "BUCK" generated dirs
58
57
  <PROJECT_ROOT>/\.buckd/
@@ -68,7 +67,6 @@
68
67
  [include]
69
68
  ; Need to include hoisted modules
70
69
  ../node_modules/
71
- ../packages/@react-native-windows/virtualized-list/
72
70
 
73
71
  [libs]
74
72
  interface.js
@@ -90,7 +88,6 @@ munge_underscores=true
90
88
 
91
89
  module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/index.windows.js'
92
90
  module.name_mapper='^react-native-windows$' -> '<PROJECT_ROOT>/index.windows.js'
93
- module.name_mapper='^@react-native-windows/virtualized-list$' -> '<PROJECT_ROOT>/../packages/@react-native-windows/virtualized-list/src/VirtualizedList.js'
94
91
  module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/\1'
95
92
  module.name_mapper='^react-native-windows/\(.*\)$' -> '<PROJECT_ROOT>/\1'
96
93
  module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/Libraries/Image/RelativeImageStub'
@@ -123,4 +120,4 @@ untyped-import
123
120
  untyped-type-import
124
121
 
125
122
  [version]
126
- ^0.186.0
123
+ ^0.187.1
@@ -8,6 +8,8 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ export type {CompositeAnimation, Numeric} from './AnimatedImplementation';
12
+
11
13
  import Platform from '../Utilities/Platform';
12
14
  import typeof AnimatedFlatList from './components/AnimatedFlatList';
13
15
  import typeof AnimatedImage from './components/AnimatedImage';
@@ -16,31 +18,31 @@ import typeof AnimatedSectionList from './components/AnimatedSectionList';
16
18
  import typeof AnimatedText from './components/AnimatedText';
17
19
  import typeof AnimatedView from './components/AnimatedView';
18
20
 
19
- import * as AnimatedMock from './AnimatedMock';
20
- import * as AnimatedImplementation from './AnimatedImplementation';
21
+ import AnimatedMock from './AnimatedMock';
22
+ import AnimatedImplementation from './AnimatedImplementation';
21
23
 
22
24
  const Animated = ((Platform.isTesting
23
25
  ? AnimatedMock
24
- : AnimatedImplementation): typeof AnimatedMock);
26
+ : AnimatedImplementation): typeof AnimatedImplementation);
25
27
 
26
- module.exports = {
28
+ export default {
27
29
  get FlatList(): AnimatedFlatList {
28
- return require('./components/AnimatedFlatList');
30
+ return require('./components/AnimatedFlatList').default;
29
31
  },
30
32
  get Image(): AnimatedImage {
31
- return require('./components/AnimatedImage');
33
+ return require('./components/AnimatedImage').default;
32
34
  },
33
35
  get ScrollView(): AnimatedScrollView {
34
- return require('./components/AnimatedScrollView');
36
+ return require('./components/AnimatedScrollView').default;
35
37
  },
36
38
  get SectionList(): AnimatedSectionList {
37
- return require('./components/AnimatedSectionList');
39
+ return require('./components/AnimatedSectionList').default;
38
40
  },
39
41
  get Text(): AnimatedText {
40
- return require('./components/AnimatedText');
42
+ return require('./components/AnimatedText').default;
41
43
  },
42
44
  get View(): AnimatedView {
43
- return require('./components/AnimatedView');
45
+ return require('./components/AnimatedView').default;
44
46
  },
45
47
  ...Animated,
46
48
  };
@@ -10,14 +10,12 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const AnimatedValue = require('./nodes/AnimatedValue');
14
- const AnimatedValueXY = require('./nodes/AnimatedValueXY');
15
- const NativeAnimatedHelper = require('./NativeAnimatedHelper');
16
- const {findNodeHandle} = require('../ReactNative/RendererProxy');
13
+ import AnimatedValue from './nodes/AnimatedValue';
14
+ import AnimatedValueXY from './nodes/AnimatedValueXY';
15
+ import NativeAnimatedHelper from './NativeAnimatedHelper';
16
+ import {findNodeHandle} from '../ReactNative/RendererProxy';
17
17
 
18
- const invariant = require('invariant');
19
-
20
- const {shouldUseNativeDriver} = require('./NativeAnimatedHelper');
18
+ import invariant from 'invariant';
21
19
 
22
20
  import type {PlatformConfig} from './AnimatedPlatformConfig';
23
21
 
@@ -31,7 +29,7 @@ export type EventConfig = {
31
29
  platformConfig?: PlatformConfig,
32
30
  };
33
31
 
34
- function attachNativeEvent(
32
+ export function attachNativeEvent(
35
33
  viewRef: any,
36
34
  eventName: string,
37
35
  argMapping: $ReadOnlyArray<?Mapping>,
@@ -146,7 +144,7 @@ function validateMapping(argMapping: $ReadOnlyArray<?Mapping>, args: any) {
146
144
  });
147
145
  }
148
146
 
149
- class AnimatedEvent {
147
+ export class AnimatedEvent {
150
148
  _argMapping: $ReadOnlyArray<?Mapping>;
151
149
  _listeners: Array<Function> = [];
152
150
  _attachedEvent: ?{detach: () => void, ...};
@@ -165,7 +163,7 @@ class AnimatedEvent {
165
163
  this.__addListener(config.listener);
166
164
  }
167
165
  this._attachedEvent = null;
168
- this.__isNative = shouldUseNativeDriver(config);
166
+ this.__isNative = NativeAnimatedHelper.shouldUseNativeDriver(config);
169
167
  this.__platformConfig = config.platformConfig;
170
168
  }
171
169
 
@@ -257,5 +255,3 @@ class AnimatedEvent {
257
255
  this._listeners.forEach(listener => listener(...args));
258
256
  };
259
257
  }
260
-
261
- module.exports = {AnimatedEvent, attachNativeEvent};
@@ -10,23 +10,23 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const {AnimatedEvent, attachNativeEvent} = require('./AnimatedEvent');
14
- const AnimatedAddition = require('./nodes/AnimatedAddition');
15
- const AnimatedDiffClamp = require('./nodes/AnimatedDiffClamp');
16
- const AnimatedDivision = require('./nodes/AnimatedDivision');
17
- const AnimatedInterpolation = require('./nodes/AnimatedInterpolation');
18
- const AnimatedModulo = require('./nodes/AnimatedModulo');
19
- const AnimatedMultiplication = require('./nodes/AnimatedMultiplication');
20
- const AnimatedNode = require('./nodes/AnimatedNode');
21
- const AnimatedSubtraction = require('./nodes/AnimatedSubtraction');
22
- const AnimatedTracking = require('./nodes/AnimatedTracking');
23
- const AnimatedValue = require('./nodes/AnimatedValue');
24
- const AnimatedValueXY = require('./nodes/AnimatedValueXY');
25
- const DecayAnimation = require('./animations/DecayAnimation');
26
- const SpringAnimation = require('./animations/SpringAnimation');
27
- const TimingAnimation = require('./animations/TimingAnimation');
28
-
29
- const createAnimatedComponent = require('./createAnimatedComponent');
13
+ import {AnimatedEvent, attachNativeEvent} from './AnimatedEvent';
14
+ import AnimatedAddition from './nodes/AnimatedAddition';
15
+ import AnimatedDiffClamp from './nodes/AnimatedDiffClamp';
16
+ import AnimatedDivision from './nodes/AnimatedDivision';
17
+ import AnimatedInterpolation from './nodes/AnimatedInterpolation';
18
+ import AnimatedModulo from './nodes/AnimatedModulo';
19
+ import AnimatedMultiplication from './nodes/AnimatedMultiplication';
20
+ import AnimatedNode from './nodes/AnimatedNode';
21
+ import AnimatedSubtraction from './nodes/AnimatedSubtraction';
22
+ import AnimatedTracking from './nodes/AnimatedTracking';
23
+ import AnimatedValue from './nodes/AnimatedValue';
24
+ import AnimatedValueXY from './nodes/AnimatedValueXY';
25
+ import DecayAnimation from './animations/DecayAnimation';
26
+ import SpringAnimation from './animations/SpringAnimation';
27
+ import TimingAnimation from './animations/TimingAnimation';
28
+
29
+ import createAnimatedComponent from './createAnimatedComponent';
30
30
 
31
31
  import type {
32
32
  AnimationConfig,
@@ -575,7 +575,7 @@ export type {AnimatedNumeric as Numeric};
575
575
  *
576
576
  * See https://reactnative.dev/docs/animated
577
577
  */
578
- module.exports = {
578
+ export default {
579
579
  /**
580
580
  * Standard value class for driving animations. Typically initialized with
581
581
  * `new Animated.Value(0);`
@@ -12,14 +12,14 @@
12
12
 
13
13
  import type {EndResult} from './animations/Animation';
14
14
 
15
- const {AnimatedEvent, attachNativeEvent} = require('./AnimatedEvent');
16
- const AnimatedImplementation = require('./AnimatedImplementation');
17
- const AnimatedInterpolation = require('./nodes/AnimatedInterpolation');
18
- const AnimatedNode = require('./nodes/AnimatedNode');
19
- const AnimatedValue = require('./nodes/AnimatedValue');
20
- const AnimatedValueXY = require('./nodes/AnimatedValueXY');
15
+ import {AnimatedEvent, attachNativeEvent} from './AnimatedEvent';
16
+ import AnimatedImplementation from './AnimatedImplementation';
17
+ import AnimatedInterpolation from './nodes/AnimatedInterpolation';
18
+ import AnimatedNode from './nodes/AnimatedNode';
19
+ import AnimatedValue from './nodes/AnimatedValue';
20
+ import AnimatedValueXY from './nodes/AnimatedValueXY';
21
21
 
22
- const createAnimatedComponent = require('./createAnimatedComponent');
22
+ import createAnimatedComponent from './createAnimatedComponent';
23
23
 
24
24
  import type {EndCallback} from './animations/Animation';
25
25
  import type {TimingAnimationConfig} from './animations/TimingAnimation';
@@ -168,7 +168,7 @@ const loop = function (
168
168
 
169
169
  export type {AnimatedNumeric as Numeric};
170
170
 
171
- module.exports = {
171
+ export default {
172
172
  Value: AnimatedValue,
173
173
  ValueXY: AnimatedValueXY,
174
174
  Color: AnimatedColor,
@@ -10,9 +10,9 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const AnimatedImplementation = require('./AnimatedImplementation');
13
+ import AnimatedImplementation from './AnimatedImplementation';
14
14
 
15
- module.exports = {
15
+ export default {
16
16
  ...AnimatedImplementation,
17
17
  /* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
18
18
  * types. Plain intrinsic components can't be typed like this */
@@ -214,7 +214,7 @@ const Easing = {
214
214
  x2: number,
215
215
  y2: number,
216
216
  ): (t: number) => number {
217
- const _bezier = require('./bezier');
217
+ const _bezier = require('./bezier').default;
218
218
  return _bezier(x1, y1, x2, y2);
219
219
  },
220
220
 
@@ -247,4 +247,4 @@ const Easing = {
247
247
  },
248
248
  };
249
249
 
250
- module.exports = Easing;
250
+ export default Easing;
@@ -550,7 +550,7 @@ function transformDataType(value: number | string): number | string {
550
550
  }
551
551
  }
552
552
 
553
- module.exports = {
553
+ export default {
554
554
  API,
555
555
  isSupportedColorStyleProp,
556
556
  isSupportedStyleProp,
@@ -24,7 +24,7 @@ function dampingFromOrigamiValue(oValue: number) {
24
24
  return (oValue - 8) * 3 + 25;
25
25
  }
26
26
 
27
- function fromOrigamiTensionAndFriction(
27
+ export function fromOrigamiTensionAndFriction(
28
28
  tension: number,
29
29
  friction: number,
30
30
  ): SpringConfigType {
@@ -34,7 +34,7 @@ function fromOrigamiTensionAndFriction(
34
34
  };
35
35
  }
36
36
 
37
- function fromBouncinessAndSpeed(
37
+ export function fromBouncinessAndSpeed(
38
38
  bounciness: number,
39
39
  speed: number,
40
40
  ): SpringConfigType {
@@ -96,8 +96,3 @@ function fromBouncinessAndSpeed(
96
96
  damping: dampingFromOrigamiValue(bouncyFriction),
97
97
  };
98
98
  }
99
-
100
- module.exports = {
101
- fromOrigamiTensionAndFriction,
102
- fromBouncinessAndSpeed,
103
- };
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const NativeAnimatedHelper = require('../NativeAnimatedHelper');
13
+ import NativeAnimatedHelper from '../NativeAnimatedHelper';
14
14
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
15
15
  import type AnimatedValue from '../nodes/AnimatedValue';
16
16
 
@@ -30,7 +30,7 @@ let startNativeAnimationNextId = 1;
30
30
  // Important note: start() and stop() will only be called at most once.
31
31
  // Once an animation has been stopped or finished its course, it will
32
32
  // not be reused.
33
- class Animation {
33
+ export default class Animation {
34
34
  __active: boolean;
35
35
  __isInteraction: boolean;
36
36
  __nativeId: number;
@@ -85,5 +85,3 @@ class Animation {
85
85
  }
86
86
  }
87
87
  }
88
-
89
- module.exports = Animation;
@@ -10,9 +10,9 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const Animation = require('./Animation');
13
+ import Animation from './Animation';
14
14
 
15
- const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
15
+ import NativeAnimatedHelper from '../NativeAnimatedHelper';
16
16
 
17
17
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
18
18
  import type AnimatedValue from '../nodes/AnimatedValue';
@@ -36,7 +36,7 @@ export type DecayAnimationConfigSingle = {
36
36
  deceleration?: number,
37
37
  };
38
38
 
39
- class DecayAnimation extends Animation {
39
+ export default class DecayAnimation extends Animation {
40
40
  _startTime: number;
41
41
  _lastValue: number;
42
42
  _fromValue: number;
@@ -51,7 +51,7 @@ class DecayAnimation extends Animation {
51
51
  super();
52
52
  this._deceleration = config.deceleration ?? 0.998;
53
53
  this._velocity = config.velocity;
54
- this._useNativeDriver = shouldUseNativeDriver(config);
54
+ this._useNativeDriver = NativeAnimatedHelper.shouldUseNativeDriver(config);
55
55
  this._platformConfig = config.platformConfig;
56
56
  this.__isInteraction = config.isInteraction ?? !this._useNativeDriver;
57
57
  this.__iterations = config.iterations ?? 1;
@@ -123,5 +123,3 @@ class DecayAnimation extends Animation {
123
123
  this.__debouncedOnEnd({finished: false});
124
124
  }
125
125
  }
126
-
127
- module.exports = DecayAnimation;
@@ -14,12 +14,12 @@ import type AnimatedValue from '../nodes/AnimatedValue';
14
14
  import type AnimatedValueXY from '../nodes/AnimatedValueXY';
15
15
  import type AnimatedInterpolation from '../nodes/AnimatedInterpolation';
16
16
 
17
- const Animation = require('./Animation');
18
- const SpringConfig = require('../SpringConfig');
17
+ import Animation from './Animation';
18
+ import * as SpringConfig from '../SpringConfig';
19
19
 
20
- const invariant = require('invariant');
20
+ import invariant from 'invariant';
21
21
 
22
- const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
22
+ import NativeAnimatedHelper from '../NativeAnimatedHelper';
23
23
 
24
24
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
25
25
  import type {AnimationConfig, EndCallback} from './Animation';
@@ -83,7 +83,7 @@ export type SpringAnimationConfigSingle = {
83
83
  delay?: number,
84
84
  };
85
85
 
86
- class SpringAnimation extends Animation {
86
+ export default class SpringAnimation extends Animation {
87
87
  _overshootClamping: boolean;
88
88
  _restDisplacementThreshold: number;
89
89
  _restSpeedThreshold: number;
@@ -116,7 +116,7 @@ class SpringAnimation extends Animation {
116
116
  this._lastVelocity = config.velocity ?? 0;
117
117
  this._toValue = config.toValue;
118
118
  this._delay = config.delay ?? 0;
119
- this._useNativeDriver = shouldUseNativeDriver(config);
119
+ this._useNativeDriver = NativeAnimatedHelper.shouldUseNativeDriver(config);
120
120
  this._platformConfig = config.platformConfig;
121
121
  this.__isInteraction = config.isInteraction ?? !this._useNativeDriver;
122
122
  this.__iterations = config.iterations ?? 1;
@@ -372,5 +372,3 @@ class SpringAnimation extends Animation {
372
372
  this.__debouncedOnEnd({finished: false});
373
373
  }
374
374
  }
375
-
376
- module.exports = SpringAnimation;
@@ -14,9 +14,9 @@ import type AnimatedValue from '../nodes/AnimatedValue';
14
14
  import type AnimatedValueXY from '../nodes/AnimatedValueXY';
15
15
  import type AnimatedInterpolation from '../nodes/AnimatedInterpolation';
16
16
 
17
- const Animation = require('./Animation');
17
+ import Animation from './Animation';
18
18
 
19
- const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
19
+ import NativeAnimatedHelper from '../NativeAnimatedHelper';
20
20
 
21
21
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
22
22
  import type {AnimationConfig, EndCallback} from './Animation';
@@ -54,13 +54,13 @@ export type TimingAnimationConfigSingle = $ReadOnly<{
54
54
  let _easeInOut;
55
55
  function easeInOut() {
56
56
  if (!_easeInOut) {
57
- const Easing = require('../Easing');
57
+ const Easing = require('../Easing').default;
58
58
  _easeInOut = Easing.inOut(Easing.ease);
59
59
  }
60
60
  return _easeInOut;
61
61
  }
62
62
 
63
- class TimingAnimation extends Animation {
63
+ export default class TimingAnimation extends Animation {
64
64
  _startTime: number;
65
65
  _fromValue: number;
66
66
  _toValue: number;
@@ -80,7 +80,7 @@ class TimingAnimation extends Animation {
80
80
  this._duration = config.duration ?? 500;
81
81
  this._delay = config.delay ?? 0;
82
82
  this.__iterations = config.iterations ?? 1;
83
- this._useNativeDriver = shouldUseNativeDriver(config);
83
+ this._useNativeDriver = NativeAnimatedHelper.shouldUseNativeDriver(config);
84
84
  this._platformConfig = config.platformConfig;
85
85
  this.__isInteraction = config.isInteraction ?? !this._useNativeDriver;
86
86
  }
@@ -173,5 +173,3 @@ class TimingAnimation extends Animation {
173
173
  this.__debouncedOnEnd({finished: false});
174
174
  }
175
175
  }
176
-
177
- module.exports = TimingAnimation;
@@ -92,7 +92,7 @@ function newtonRaphsonIterate(
92
92
  return aGuessT;
93
93
  }
94
94
 
95
- module.exports = function bezier(
95
+ export default function bezier(
96
96
  mX1: number,
97
97
  mY1: number,
98
98
  mX2: number,
@@ -161,4 +161,4 @@ module.exports = function bezier(
161
161
  }
162
162
  return calcBezier(getTForX(x), mY1, mY2);
163
163
  };
164
- };
164
+ }
@@ -10,8 +10,8 @@
10
10
 
11
11
  import * as React from 'react';
12
12
 
13
- const FlatList = require('../../Lists/FlatList');
14
- const createAnimatedComponent = require('../createAnimatedComponent');
13
+ import FlatList from '../../Lists/FlatList';
14
+ import createAnimatedComponent from '../createAnimatedComponent';
15
15
 
16
16
  import type {AnimatedComponentType} from '../createAnimatedComponent';
17
17
 
@@ -22,7 +22,7 @@ const FlatListWithEventThrottle = React.forwardRef((props, ref) => (
22
22
  <FlatList scrollEventThrottle={0.0001} {...props} ref={ref} />
23
23
  ));
24
24
 
25
- module.exports = (createAnimatedComponent(
25
+ export default (createAnimatedComponent(
26
26
  FlatListWithEventThrottle,
27
27
  ): AnimatedComponentType<
28
28
  React.ElementConfig<typeof FlatList>,
@@ -10,12 +10,12 @@
10
10
 
11
11
  import * as React from 'react';
12
12
 
13
- const Image = require('../../Image/Image');
14
- const createAnimatedComponent = require('../createAnimatedComponent');
13
+ import Image from '../../Image/Image';
14
+ import createAnimatedComponent from '../createAnimatedComponent';
15
15
 
16
16
  import type {AnimatedComponentType} from '../createAnimatedComponent';
17
17
 
18
- module.exports = (createAnimatedComponent(
18
+ export default (createAnimatedComponent(
19
19
  (Image: $FlowFixMe),
20
20
  ): AnimatedComponentType<
21
21
  React.ElementConfig<typeof Image>,
@@ -9,22 +9,117 @@
9
9
  */
10
10
 
11
11
  import * as React from 'react';
12
+ import {useMemo} from 'react';
12
13
 
13
- const ScrollView = require('../../Components/ScrollView/ScrollView');
14
- const createAnimatedComponent = require('../createAnimatedComponent');
14
+ import RefreshControl from '../../Components/RefreshControl/RefreshControl';
15
+ import ScrollView from '../../Components/ScrollView/ScrollView';
16
+ import StyleSheet from '../../StyleSheet/StyleSheet';
17
+ import flattenStyle from '../../StyleSheet/flattenStyle';
18
+ import splitLayoutProps from '../../StyleSheet/splitLayoutProps';
19
+ import Platform from '../../Utilities/Platform';
20
+ import useMergeRefs from '../../Utilities/useMergeRefs';
21
+ import createAnimatedComponent from '../createAnimatedComponent';
22
+ import useAnimatedProps from '../useAnimatedProps';
15
23
 
16
24
  import type {AnimatedComponentType} from '../createAnimatedComponent';
17
25
 
26
+ type Props = React.ElementConfig<typeof ScrollView>;
27
+ type Instance = React.ElementRef<typeof ScrollView>;
28
+
18
29
  /**
19
30
  * @see https://github.com/facebook/react-native/commit/b8c8562
20
31
  */
21
- const ScrollViewWithEventThrottle = React.forwardRef((props, ref) => (
22
- <ScrollView scrollEventThrottle={0.0001} {...props} ref={ref} />
23
- ));
24
-
25
- module.exports = (createAnimatedComponent(
26
- ScrollViewWithEventThrottle,
27
- ): AnimatedComponentType<
28
- React.ElementConfig<typeof ScrollView>,
29
- React.ElementRef<typeof ScrollView>,
30
- >);
32
+ const AnimatedScrollView: AnimatedComponentType<Props, Instance> =
33
+ React.forwardRef((props, forwardedRef) => {
34
+ // (Android only) When a ScrollView has a RefreshControl and
35
+ // any `style` property set with an Animated.Value, the CSS
36
+ // gets incorrectly applied twice. This is because ScrollView
37
+ // swaps the parent/child relationship of itself and the
38
+ // RefreshControl component (see ScrollView.js for more details).
39
+ if (
40
+ Platform.OS === 'android' &&
41
+ props.refreshControl != null &&
42
+ props.style != null
43
+ ) {
44
+ return (
45
+ <AnimatedScrollViewWithInvertedRefreshControl
46
+ scrollEventThrottle={0.0001}
47
+ {...props}
48
+ ref={forwardedRef}
49
+ refreshControl={props.refreshControl}
50
+ />
51
+ );
52
+ } else {
53
+ return (
54
+ <AnimatedScrollViewWithoutInvertedRefreshControl
55
+ scrollEventThrottle={0.0001}
56
+ {...props}
57
+ ref={forwardedRef}
58
+ />
59
+ );
60
+ }
61
+ });
62
+
63
+ const AnimatedScrollViewWithInvertedRefreshControl = React.forwardRef(
64
+ (
65
+ props: {
66
+ ...React.ElementConfig<typeof ScrollView>,
67
+ // $FlowFixMe[unclear-type] Same Flow type as `refreshControl` in ScrollView
68
+ refreshControl: React.Element<any>,
69
+ },
70
+ forwardedRef,
71
+ ) => {
72
+ // Split `props` into the animate-able props for the parent (RefreshControl)
73
+ // and child (ScrollView).
74
+ const {intermediatePropsForRefreshControl, intermediatePropsForScrollView} =
75
+ useMemo(() => {
76
+ const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
77
+ return {
78
+ intermediatePropsForRefreshControl: {style: outer},
79
+ intermediatePropsForScrollView: {...props, style: inner},
80
+ };
81
+ }, [props]);
82
+
83
+ // Handle animated props on `refreshControl`.
84
+ const [refreshControlAnimatedProps, refreshControlRef] = useAnimatedProps(
85
+ intermediatePropsForRefreshControl,
86
+ );
87
+ // NOTE: Assumes that refreshControl.ref` and `refreshControl.style` can be
88
+ // safely clobbered.
89
+ const refreshControl: React.Element<typeof RefreshControl> =
90
+ React.cloneElement(props.refreshControl, {
91
+ ...refreshControlAnimatedProps,
92
+ ref: refreshControlRef,
93
+ });
94
+
95
+ // Handle animated props on `NativeDirectionalScrollView`.
96
+ const [scrollViewAnimatedProps, scrollViewRef] = useAnimatedProps<
97
+ Props,
98
+ Instance,
99
+ >(intermediatePropsForScrollView);
100
+ const ref = useMergeRefs<Instance | null>(scrollViewRef, forwardedRef);
101
+
102
+ return (
103
+ // $FlowFixMe[incompatible-use] Investigate useAnimatedProps return value
104
+ <ScrollView
105
+ {...scrollViewAnimatedProps}
106
+ ref={ref}
107
+ refreshControl={refreshControl}
108
+ // Because `refreshControl` is a clone of `props.refreshControl` with
109
+ // `refreshControlAnimatedProps` added, we need to pass ScrollView.js
110
+ // the combined styles since it also splits the outer/inner styles for
111
+ // its parent/child, respectively. Without this, the refreshControl
112
+ // styles would be ignored.
113
+ style={StyleSheet.compose(
114
+ scrollViewAnimatedProps.style,
115
+ refreshControlAnimatedProps.style,
116
+ )}
117
+ />
118
+ );
119
+ },
120
+ );
121
+
122
+ const AnimatedScrollViewWithoutInvertedRefreshControl =
123
+ createAnimatedComponent(ScrollView);
124
+
125
+ export default AnimatedScrollView;
@@ -11,7 +11,7 @@
11
11
  import * as React from 'react';
12
12
 
13
13
  import SectionList from '../../Lists/SectionList';
14
- const createAnimatedComponent = require('../createAnimatedComponent');
14
+ import createAnimatedComponent from '../createAnimatedComponent';
15
15
 
16
16
  import type {AnimatedComponentType} from '../createAnimatedComponent';
17
17
 
@@ -22,7 +22,7 @@ const SectionListWithEventThrottle = React.forwardRef((props, ref) => (
22
22
  <SectionList scrollEventThrottle={0.0001} {...props} ref={ref} />
23
23
  ));
24
24
 
25
- module.exports = (createAnimatedComponent(
25
+ export default (createAnimatedComponent(
26
26
  SectionListWithEventThrottle,
27
27
  ): AnimatedComponentType<
28
28
  React.ElementConfig<typeof SectionList>,
@@ -10,12 +10,12 @@
10
10
 
11
11
  import * as React from 'react';
12
12
 
13
- const Text = require('../../Text/Text');
14
- const createAnimatedComponent = require('../createAnimatedComponent');
13
+ import Text from '../../Text/Text';
14
+ import createAnimatedComponent from '../createAnimatedComponent';
15
15
 
16
16
  import type {AnimatedComponentType} from '../createAnimatedComponent';
17
17
 
18
- module.exports = (createAnimatedComponent(
18
+ export default (createAnimatedComponent(
19
19
  (Text: $FlowFixMe),
20
20
  ): AnimatedComponentType<
21
21
  React.ElementConfig<typeof Text>,