@office-iss/react-native-win32 0.0.0-canary.287 → 0.0.0-canary.289

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 +6 -2
  2. package/CHANGELOG.json +63 -1
  3. package/CHANGELOG.md +24 -4
  4. package/Libraries/Alert/Alert.d.ts +4 -1
  5. package/Libraries/Alert/Alert.js +3 -0
  6. package/Libraries/{Modal/ModalInjection.js → Alert/RCTAlertManager.js.flow} +7 -4
  7. package/Libraries/Animated/Animated.js +8 -37
  8. package/Libraries/Animated/Animated.js.flow +15 -0
  9. package/Libraries/Animated/AnimatedExports.js +47 -0
  10. package/Libraries/Animated/AnimatedExports.js.flow +48 -0
  11. package/Libraries/Animated/Easing.js +13 -15
  12. package/Libraries/Animated/createAnimatedComponent.js +24 -12
  13. package/Libraries/Animated/nodes/AnimatedNode.js +2 -1
  14. package/Libraries/Animated/nodes/AnimatedProps.js +18 -1
  15. package/Libraries/Animated/nodes/AnimatedValue.js +6 -2
  16. package/Libraries/Animated/useAnimatedValue.js +1 -3
  17. package/Libraries/Blob/URL.js +23 -10
  18. package/Libraries/Blob/URLSearchParams.js.flow +23 -0
  19. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  20. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  21. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js.flow +20 -0
  22. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -8
  23. package/Libraries/Components/Button.js +2 -2
  24. package/Libraries/Components/Button.win32.js +2 -2
  25. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +14 -100
  26. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +64 -4
  27. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +138 -0
  28. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
  29. package/Libraries/Components/LayoutConformance/LayoutConformance.js +6 -4
  30. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
  31. package/Libraries/Components/Pressable/Pressable.js +18 -63
  32. package/Libraries/Components/Pressable/Pressable.win32.js +19 -65
  33. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  34. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +4 -46
  35. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +10 -4
  36. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +54 -0
  37. package/Libraries/Components/RefreshControl/RefreshControl.js +10 -7
  38. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -1
  39. package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -1
  40. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -1
  41. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +2 -4
  42. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +2 -4
  43. package/Libraries/Components/ScrollView/ScrollView.js +43 -59
  44. package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
  45. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -4
  46. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -7
  47. package/Libraries/Components/StatusBar/StatusBar.js +33 -22
  48. package/Libraries/Components/Switch/Switch.js +70 -41
  49. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -4
  50. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +2 -4
  51. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +2 -4
  52. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  53. package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
  54. package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
  55. package/Libraries/Components/TextInput/TextInput.d.ts +6 -0
  56. package/Libraries/Components/TextInput/TextInput.flow.js +45 -14
  57. package/Libraries/Components/TextInput/TextInput.js +121 -136
  58. package/Libraries/Components/TextInput/TextInput.win32.js +122 -137
  59. package/Libraries/Components/TextInput/TextInputState.js +2 -18
  60. package/Libraries/Components/TextInput/TextInputState.win32.js +2 -18
  61. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +1 -1
  62. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
  63. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  64. package/Libraries/Components/Touchable/Touchable.js +7 -7
  65. package/Libraries/Components/Touchable/Touchable.win32.js +7 -7
  66. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  67. package/Libraries/Components/Touchable/TouchableHighlight.js +35 -14
  68. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +95 -47
  69. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +248 -43
  70. package/Libraries/Components/Touchable/TouchableOpacity.js +52 -10
  71. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +112 -59
  72. package/Libraries/Components/View/View.js +1 -1
  73. package/Libraries/Components/View/View.win32.js +1 -1
  74. package/Libraries/Components/View/ViewNativeComponent.js +2 -4
  75. package/Libraries/Components/View/ViewPropTypes.js +15 -12
  76. package/Libraries/Components/View/ViewPropTypes.win32.js +74 -71
  77. package/Libraries/Core/ReactNativeVersion.js +2 -2
  78. package/Libraries/Core/setUpReactDevTools.js +2 -0
  79. package/Libraries/Debugging/DebuggingOverlayRegistry.js +10 -7
  80. package/Libraries/Image/Image.android.js +1 -1
  81. package/Libraries/Image/Image.js.flow +27 -0
  82. package/Libraries/Image/ImageBackground.js +1 -1
  83. package/Libraries/Image/ImageProps.js +97 -30
  84. package/Libraries/Image/ImageTypes.flow.js +16 -6
  85. package/Libraries/Image/ImageViewNativeComponent.js +3 -5
  86. package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
  87. package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
  88. package/Libraries/Image/TextInlineImageNativeComponent.js +2 -4
  89. package/Libraries/Interaction/InteractionManager.js +9 -1
  90. package/Libraries/Interaction/PanResponder.js +11 -11
  91. package/Libraries/Interaction/TaskQueue.js +3 -2
  92. package/Libraries/Lists/FlatList.js +8 -7
  93. package/Libraries/LogBox/LogBox.js +1 -1
  94. package/Libraries/Modal/Modal.js +30 -4
  95. package/Libraries/NativeComponent/BaseViewConfig.js.flow +14 -0
  96. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  97. package/Libraries/Network/RCTNetworking.js.flow +44 -0
  98. package/Libraries/Network/XMLHttpRequest_new.js +3 -0
  99. package/Libraries/Network/XMLHttpRequest_old.js +3 -0
  100. package/Libraries/Pressability/HoverState.js +1 -0
  101. package/Libraries/Pressability/HoverState.win32.js +1 -0
  102. package/Libraries/Pressability/Pressability.js +2 -2
  103. package/Libraries/Pressability/Pressability.win32.js +3 -3
  104. package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
  105. package/Libraries/ReactNative/AppRegistry.js +2 -322
  106. package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
  107. package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
  108. package/Libraries/ReactNative/FabricUIManager.js +5 -3
  109. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +7 -5
  110. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
  111. package/Libraries/ReactNative/RendererImplementation.js +3 -5
  112. package/Libraries/ReactNative/requireNativeComponent.js +1 -1
  113. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +12 -0
  114. package/Libraries/Renderer/shims/ReactNativeTypes.js +39 -91
  115. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +22 -0
  116. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
  117. package/Libraries/StyleSheet/StyleSheet.js +5 -197
  118. package/Libraries/StyleSheet/StyleSheet.js.flow +166 -0
  119. package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
  120. package/Libraries/StyleSheet/StyleSheetExports.js.flow +110 -0
  121. package/Libraries/StyleSheet/StyleSheetTypes.js +42 -18
  122. package/Libraries/Text/Text.d.ts +1 -1
  123. package/Libraries/Text/Text.js +3 -1
  124. package/Libraries/Text/Text.win32.js +3 -1
  125. package/Libraries/Text/TextNativeComponent.js +1 -1
  126. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  127. package/Libraries/Text/TextProps.js +124 -84
  128. package/Libraries/Text/TextProps.win32.js +124 -84
  129. package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
  130. package/Libraries/Types/CodegenTypesNamespace.js +14 -0
  131. package/Libraries/Types/CoreEventTypes.js +1 -1
  132. package/Libraries/Types/CoreEventTypes.win32.js +1 -1
  133. package/Libraries/Types/ReactDevToolsTypes.js +4 -8
  134. package/Libraries/Utilities/BackHandler.js.flow +25 -0
  135. package/Libraries/Utilities/DevSettings.js +14 -0
  136. package/Libraries/Utilities/Dimensions.js +5 -0
  137. package/Libraries/Utilities/Dimensions.win32.js +5 -0
  138. package/{flow/Position.js → Libraries/Utilities/Platform.js.flow} +3 -6
  139. package/Libraries/Utilities/PlatformTypes.js +97 -7
  140. package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
  141. package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
  142. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  143. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +2 -4
  144. package/Libraries/vendor/emitter/EventEmitter.js +6 -2
  145. package/flow/global.js +1 -0
  146. package/flow/jest.js +4 -2
  147. package/index.js +47 -43
  148. package/index.win32.js +63 -59
  149. package/overrides.json +27 -35
  150. package/package.json +18 -18
  151. package/src/private/animated/NativeAnimatedHelper.js +18 -7
  152. package/src/private/animated/NativeAnimatedHelper.win32.js +18 -7
  153. package/src/private/animated/createAnimatedPropsHook.js +34 -15
  154. package/src/private/components/HScrollViewNativeComponents.js +1 -1
  155. package/src/private/components/VScrollViewNativeComponents.js +1 -1
  156. package/src/private/featureflags/ReactNativeFeatureFlags.js +24 -36
  157. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
  158. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -4
  159. package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -4
  160. package/src/private/setup/setUpDOM.js +36 -1
  161. package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
  162. package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +1 -1
  163. package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
  164. package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +1 -1
  165. package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +1 -1
  166. package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +1 -1
  167. package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
  168. package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
  169. package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
  170. package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +1 -1
  171. package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
  172. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
  173. package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
  174. package/src/private/types/HostComponent.js +16 -0
  175. package/src/private/types/HostInstance.js +50 -0
  176. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +1 -0
  177. package/src/private/webapis/dom/nodes/ReactNativeElement.js +40 -32
  178. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +1 -1
  179. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
  180. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -19
  181. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
  182. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +4 -4
  183. package/src/private/webapis/mutationobserver/MutationObserver.js +9 -9
  184. package/src/private/webapis/performance/PerformanceObserver.js +6 -6
  185. package/src/types/globals.d.ts +628 -0
  186. package/src/types/third_party/event-target-shim.d.ts +392 -0
  187. package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
  188. package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
  189. package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
  190. package/src-win/Libraries/Text/Text.d.ts +1 -1
  191. package/types/index.d.ts +5 -52
  192. package/types/modules/globals.d.ts +0 -599
package/.flowconfig CHANGED
@@ -28,7 +28,7 @@
28
28
  <PROJECT_ROOT>/Libraries/Network/RCTNetworking.js
29
29
  <PROJECT_ROOT>/Libraries/Pressability/Pressability.js
30
30
  <PROJECT_ROOT>/Libraries/Pressability/HoverState.js
31
- <PROJECT_ROOT>/Libraries/StyleSheet/StyleSheet.js
31
+ <PROJECT_ROOT>/Libraries/StyleSheet/PlatformColorValueTypes.js
32
32
  <PROJECT_ROOT>/Libraries/Text/TextProps.js
33
33
  <PROJECT_ROOT>/Libraries/Types/CoreEventTypes.js
34
34
  <PROJECT_ROOT>/Libraries/Utilities/DeviceInfo.js
@@ -104,6 +104,8 @@
104
104
  interface.js
105
105
  flow/
106
106
  ../../../node_modules/.flow/flow-typed/
107
+ ../../../node_modules/react-native/src/types
108
+ src/types/
107
109
 
108
110
  [options]
109
111
  enums=true
@@ -133,6 +135,8 @@ module.name_mapper='^@office-iss/react-native-win32/\(.*\)$' -> '<PROJECT_ROOT>\
133
135
  module.name_mapper='^@react-native/dev-middleware$' -> '<PROJECT_ROOT>/\1'
134
136
  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\|xml\)$' -> '<PROJECT_ROOT>/Libraries/Image/RelativeImageStub'
135
137
 
138
+ react.runtime=automatic
139
+
136
140
  suppress_type=$FlowIssue
137
141
  suppress_type=$FlowFixMe
138
142
  suppress_type=$FlowFixMeProps
@@ -164,4 +168,4 @@ untyped-import
164
168
  untyped-type-import
165
169
 
166
170
  [version]
167
- ^0.261.2
171
+ ^0.265.2
package/CHANGELOG.json CHANGED
@@ -2,7 +2,69 @@
2
2
  "name": "@office-iss/react-native-win32",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 28 May 2025 05:23:19 GMT",
5
+ "date": "Thu, 19 Jun 2025 17:15:20 GMT",
6
+ "version": "0.0.0-canary.289",
7
+ "tag": "@office-iss/react-native-win32_v0.0.0-canary.289",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "hmalothu@microsoft.com",
12
+ "package": "@office-iss/react-native-win32",
13
+ "commit": "56637fc1b13f290eab37a10c098e7be87adf909e",
14
+ "comment": "Integrate RN Nightly Build 0.80.0-nightly-20250317-fc7385c1e"
15
+ },
16
+ {
17
+ "author": "30809111+acoates-ms@users.noreply.github.com",
18
+ "package": "@office-iss/react-native-win32",
19
+ "commit": "06a52c2ca0ccdf323f2ead1eb8dcdbbd0f6b189d",
20
+ "comment": "Update to @types/react 19"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Fri, 30 May 2025 05:24:59 GMT",
27
+ "version": "0.0.0-canary.288",
28
+ "tag": "@office-iss/react-native-win32_v0.0.0-canary.288",
29
+ "comments": {
30
+ "none": [
31
+ {
32
+ "author": "74712637+iamAbhi-916@users.noreply.github.com",
33
+ "package": "@office-iss/react-native-win32",
34
+ "commit": "02e7363a430b16c3e7437462be2e9c1558ab3ca6",
35
+ "comment": "integration nightly 0.79.0-nightly-20250303-cee63397b , overrides solved"
36
+ }
37
+ ],
38
+ "prerelease": [
39
+ {
40
+ "author": "beachball",
41
+ "package": "@office-iss/react-native-win32",
42
+ "comment": "Bump @rnw-scripts/eslint-config to v1.2.36",
43
+ "commit": "not available"
44
+ },
45
+ {
46
+ "author": "beachball",
47
+ "package": "@office-iss/react-native-win32",
48
+ "comment": "Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.40",
49
+ "commit": "not available"
50
+ },
51
+ {
52
+ "author": "beachball",
53
+ "package": "@office-iss/react-native-win32",
54
+ "comment": "Bump @rnw-scripts/just-task to v2.3.53",
55
+ "commit": "not available"
56
+ },
57
+ {
58
+ "author": "beachball",
59
+ "package": "@office-iss/react-native-win32",
60
+ "comment": "Bump react-native-platform-override to v1.9.55",
61
+ "commit": "not available"
62
+ }
63
+ ]
64
+ }
65
+ },
66
+ {
67
+ "date": "Wed, 28 May 2025 05:24:00 GMT",
6
68
  "version": "0.0.0-canary.287",
7
69
  "tag": "@office-iss/react-native-win32_v0.0.0-canary.287",
8
70
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,17 +1,37 @@
1
1
  # Change Log - @office-iss/react-native-win32
2
2
 
3
- <!-- This log was last generated on Wed, 28 May 2025 05:23:19 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Thu, 19 Jun 2025 17:15:20 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.0.0-canary.287
7
+ ## 0.0.0-canary.289
8
8
 
9
- Wed, 28 May 2025 05:23:19 GMT
9
+ Thu, 19 Jun 2025 17:15:20 GMT
10
10
 
11
11
  ### Changes
12
12
 
13
- - Removed unused `react-shallow-renderer` dependency (4123478+tido64@users.noreply.github.com)
13
+ - Integrate RN Nightly Build 0.80.0-nightly-20250317-fc7385c1e (hmalothu@microsoft.com)
14
+ - Update to @types/react 19 (30809111+acoates-ms@users.noreply.github.com)
14
15
 
16
+ ## 0.0.0-canary.288
17
+
18
+ Fri, 30 May 2025 05:24:59 GMT
19
+
20
+ ### Changes
21
+
22
+ - Bump @rnw-scripts/eslint-config to v1.2.36
23
+ - Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.40
24
+ - Bump @rnw-scripts/just-task to v2.3.53
25
+ - Bump react-native-platform-override to v1.9.55
26
+
27
+ ## 0.0.0-canary.287
28
+
29
+ Wed, 28 May 2025 05:24:00 GMT
30
+
31
+ ### Changes
32
+
33
+ - Removed unused `react-shallow-renderer` dependency (4123478+tido64@users.noreply.github.com)
34
+
15
35
  ## 0.0.0-canary.286
16
36
 
17
37
  Thu, 22 May 2025 05:24:49 GMT
@@ -12,7 +12,10 @@
12
12
  */
13
13
  export interface AlertButton {
14
14
  text?: string | undefined;
15
- onPress?: ((value?: string) => void) | undefined;
15
+ onPress?:
16
+ | ((value?: string) => void)
17
+ | ((value?: {login: string; password: string}) => void)
18
+ | undefined;
16
19
  isPreferred?: boolean | undefined;
17
20
  style?: 'default' | 'cancel' | 'destructive' | undefined;
18
21
  }
@@ -119,12 +119,15 @@ class Alert {
119
119
  if (action === constants.buttonClicked) {
120
120
  if (buttonKey === constants.buttonNeutral) {
121
121
  // $FlowFixMe[incompatible-type]
122
+ // $FlowFixMe[incompatible-use]
122
123
  buttonNeutral.onPress && buttonNeutral.onPress();
123
124
  } else if (buttonKey === constants.buttonNegative) {
124
125
  // $FlowFixMe[incompatible-type]
126
+ // $FlowFixMe[incompatible-use]
125
127
  buttonNegative.onPress && buttonNegative.onPress();
126
128
  } else if (buttonKey === constants.buttonPositive) {
127
129
  // $FlowFixMe[incompatible-type]
130
+ // $FlowFixMe[incompatible-use]
128
131
  buttonPositive.onPress && buttonPositive.onPress();
129
132
  }
130
133
  } else if (action === constants.dismissed) {
@@ -4,12 +4,15 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow strict-local
8
7
  * @format
8
+ * @flow strict-local
9
9
  */
10
10
 
11
- import typeof Modal from './Modal';
11
+ import type {Args} from './NativeAlertManager';
12
12
 
13
- export default {
14
- unstable_Modal: (null: ?Modal),
13
+ declare export default {
14
+ alertWithArgs(
15
+ args: Args,
16
+ callback: (id: number, value: string) => void,
17
+ ): void,
15
18
  };
@@ -4,45 +4,16 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict-local
8
8
  * @format
9
+ * @oncall react_native
9
10
  */
10
11
 
11
- export type {CompositeAnimation, Numeric} from './AnimatedImplementation';
12
+ import typeof * as AnimatedExports from './AnimatedExports';
12
13
 
13
- import typeof AnimatedFlatList from './components/AnimatedFlatList';
14
- import typeof AnimatedImage from './components/AnimatedImage';
15
- import typeof AnimatedScrollView from './components/AnimatedScrollView';
16
- import typeof AnimatedSectionList from './components/AnimatedSectionList';
17
- import typeof AnimatedText from './components/AnimatedText';
18
- import typeof AnimatedView from './components/AnimatedView';
14
+ // The AnimatedExports module is typed as multiple exports to allow
15
+ // for an implicit namespace, but underneath is's a single default export.
16
+ const Animated: AnimatedExports = (require('./AnimatedExports') as $FlowFixMe)
17
+ .default;
19
18
 
20
- import Platform from '../Utilities/Platform';
21
- import AnimatedImplementation from './AnimatedImplementation';
22
- import AnimatedMock from './AnimatedMock';
23
-
24
- const Animated: typeof AnimatedImplementation = Platform.isDisableAnimations
25
- ? AnimatedMock
26
- : AnimatedImplementation;
27
-
28
- export default {
29
- get FlatList(): AnimatedFlatList {
30
- return require('./components/AnimatedFlatList').default;
31
- },
32
- get Image(): AnimatedImage {
33
- return require('./components/AnimatedImage').default;
34
- },
35
- get ScrollView(): AnimatedScrollView {
36
- return require('./components/AnimatedScrollView').default;
37
- },
38
- get SectionList(): AnimatedSectionList {
39
- return require('./components/AnimatedSectionList').default;
40
- },
41
- get Text(): AnimatedText {
42
- return require('./components/AnimatedText').default;
43
- },
44
- get View(): AnimatedView {
45
- return require('./components/AnimatedView').default;
46
- },
47
- ...Animated,
48
- };
19
+ export default Animated;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ import * as Animated from './AnimatedExports';
13
+
14
+ export type {CompositeAnimation, Numeric} from './AnimatedImplementation';
15
+ export default Animated;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ import typeof AnimatedFlatList from './components/AnimatedFlatList';
13
+ import typeof AnimatedImage from './components/AnimatedImage';
14
+ import typeof AnimatedScrollView from './components/AnimatedScrollView';
15
+ import typeof AnimatedSectionList from './components/AnimatedSectionList';
16
+ import typeof AnimatedText from './components/AnimatedText';
17
+ import typeof AnimatedView from './components/AnimatedView';
18
+
19
+ import Platform from '../Utilities/Platform';
20
+ import AnimatedImplementation from './AnimatedImplementation';
21
+ import AnimatedMock from './AnimatedMock';
22
+
23
+ const Animated: typeof AnimatedImplementation = Platform.isDisableAnimations
24
+ ? AnimatedMock
25
+ : AnimatedImplementation;
26
+
27
+ export default {
28
+ get FlatList(): AnimatedFlatList {
29
+ return require('./components/AnimatedFlatList').default;
30
+ },
31
+ get Image(): AnimatedImage {
32
+ return require('./components/AnimatedImage').default;
33
+ },
34
+ get ScrollView(): AnimatedScrollView {
35
+ return require('./components/AnimatedScrollView').default;
36
+ },
37
+ get SectionList(): AnimatedSectionList {
38
+ return require('./components/AnimatedSectionList').default;
39
+ },
40
+ get Text(): AnimatedText {
41
+ return require('./components/AnimatedText').default;
42
+ },
43
+ get View(): AnimatedView {
44
+ return require('./components/AnimatedView').default;
45
+ },
46
+ ...Animated,
47
+ };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ import AnimatedImplementation from './AnimatedImplementation';
13
+
14
+ export {default as FlatList} from './components/AnimatedFlatList';
15
+ export {default as Image} from './components/AnimatedImage';
16
+ export {default as ScrollView} from './components/AnimatedScrollView';
17
+ export {default as SectionList} from './components/AnimatedSectionList';
18
+ export {default as Text} from './components/AnimatedText';
19
+ export {default as View} from './components/AnimatedView';
20
+ export {default as Color} from './nodes/AnimatedColor';
21
+ export {AnimatedEvent as Event} from './AnimatedEvent';
22
+ export {default as Interpolation} from './nodes/AnimatedInterpolation';
23
+ export {default as Node} from './nodes/AnimatedNode';
24
+ export {default as Value} from './nodes/AnimatedValue';
25
+ export {default as ValueXY} from './nodes/AnimatedValueXY';
26
+
27
+ export type {AnimatedValueConfig as AnimatedConfig} from './nodes/AnimatedValue';
28
+
29
+ export const add = AnimatedImplementation.add;
30
+ export const attachNativeEvent = AnimatedImplementation.attachNativeEvent;
31
+ export const createAnimatedComponent =
32
+ AnimatedImplementation.createAnimatedComponent;
33
+ export const decay = AnimatedImplementation.decay;
34
+ export const delay = AnimatedImplementation.delay;
35
+ export const diffClamp = AnimatedImplementation.diffClamp;
36
+ export const divide = AnimatedImplementation.divide;
37
+ export const event = AnimatedImplementation.event;
38
+ export const forkEvent = AnimatedImplementation.forkEvent;
39
+ export const loop = AnimatedImplementation.loop;
40
+ export const modulo = AnimatedImplementation.modulo;
41
+ export const multiply = AnimatedImplementation.multiply;
42
+ export const parallel = AnimatedImplementation.parallel;
43
+ export const sequence = AnimatedImplementation.sequence;
44
+ export const spring = AnimatedImplementation.spring;
45
+ export const stagger = AnimatedImplementation.stagger;
46
+ export const subtract = AnimatedImplementation.subtract;
47
+ export const timing = AnimatedImplementation.timing;
48
+ export const unforkEvent = AnimatedImplementation.unforkEvent;
@@ -12,6 +12,8 @@
12
12
 
13
13
  let ease;
14
14
 
15
+ export type EasingFunction = (t: number) => number;
16
+
15
17
  /**
16
18
  * The `Easing` module implements common easing functions. This module is used
17
19
  * by [Animate.timing()](docs/animate.html#timing) to convey physically
@@ -57,7 +59,7 @@ let ease;
57
59
  * - [`inOut`](docs/easing.html#inout) makes any easing function symmetrical
58
60
  * - [`out`](docs/easing.html#out) runs an easing function backwards
59
61
  */
60
- const Easing = {
62
+ const EasingStatic = {
61
63
  /**
62
64
  * A stepping function, returns 1 for any positive value of `n`.
63
65
  */
@@ -90,7 +92,7 @@ const Easing = {
90
92
  */
91
93
  ease(t: number): number {
92
94
  if (!ease) {
93
- ease = Easing.bezier(0.42, 0, 1, 1);
95
+ ease = EasingStatic.bezier(0.42, 0, 1, 1);
94
96
  }
95
97
  return ease(t);
96
98
  },
@@ -121,7 +123,7 @@ const Easing = {
121
123
  * n = 4: http://easings.net/#easeInQuart
122
124
  * n = 5: http://easings.net/#easeInQuint
123
125
  */
124
- poly(n: number): (t: number) => number {
126
+ poly(n: number): EasingFunction {
125
127
  return (t: number) => Math.pow(t, n);
126
128
  },
127
129
 
@@ -162,7 +164,7 @@ const Easing = {
162
164
  *
163
165
  * http://easings.net/#easeInElastic
164
166
  */
165
- elastic(bounciness: number = 1): (t: number) => number {
167
+ elastic(bounciness: number = 1): EasingFunction {
166
168
  const p = bounciness * Math.PI;
167
169
  return t => 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p);
168
170
  },
@@ -173,7 +175,7 @@ const Easing = {
173
175
  *
174
176
  * https://easings.net/#easeInBack
175
177
  */
176
- back(s: number = 1.70158): (t: number) => number {
178
+ back(s: number = 1.70158): EasingFunction {
177
179
  return t => t * t * ((s + 1) * t - s);
178
180
  },
179
181
 
@@ -208,12 +210,7 @@ const Easing = {
208
210
  * A useful tool to visualize cubic bezier curves can be found at
209
211
  * http://cubic-bezier.com/
210
212
  */
211
- bezier(
212
- x1: number,
213
- y1: number,
214
- x2: number,
215
- y2: number,
216
- ): (t: number) => number {
213
+ bezier(x1: number, y1: number, x2: number, y2: number): EasingFunction {
217
214
  const _bezier = require('./bezier').default;
218
215
  return _bezier(x1, y1, x2, y2);
219
216
  },
@@ -221,14 +218,14 @@ const Easing = {
221
218
  /**
222
219
  * Runs an easing function forwards.
223
220
  */
224
- in(easing: (t: number) => number): (t: number) => number {
221
+ in(easing: EasingFunction): EasingFunction {
225
222
  return easing;
226
223
  },
227
224
 
228
225
  /**
229
226
  * Runs an easing function backwards.
230
227
  */
231
- out(easing: (t: number) => number): (t: number) => number {
228
+ out(easing: EasingFunction): EasingFunction {
232
229
  return t => 1 - easing(1 - t);
233
230
  },
234
231
 
@@ -237,7 +234,7 @@ const Easing = {
237
234
  * forwards for half of the duration, then backwards for the rest of the
238
235
  * duration.
239
236
  */
240
- inOut(easing: (t: number) => number): (t: number) => number {
237
+ inOut(easing: EasingFunction): EasingFunction {
241
238
  return t => {
242
239
  if (t < 0.5) {
243
240
  return easing(t * 2) / 2;
@@ -247,4 +244,5 @@ const Easing = {
247
244
  },
248
245
  };
249
246
 
250
- export default Easing;
247
+ export type Easing = typeof EasingStatic;
248
+ export default EasingStatic;
@@ -36,7 +36,7 @@ export type StrictAnimatedProps<Props: {...}> = $ReadOnly<{
36
36
  }>;
37
37
 
38
38
  export type AnimatedComponentType<Props: {...}, +Instance = mixed> = component(
39
- ref: React.RefSetter<Instance>,
39
+ ref?: React.RefSetter<Instance>,
40
40
  ...AnimatedProps<Props>
41
41
  );
42
42
 
@@ -45,29 +45,41 @@ export type StrictAnimatedComponentType<
45
45
  +Instance = mixed,
46
46
  > = component(ref: React.RefSetter<Instance>, ...StrictAnimatedProps<Props>);
47
47
 
48
- export default function createAnimatedComponent<TProps: {...}, TInstance>(
49
- Component: component(ref: React.RefSetter<TInstance>, ...TProps),
50
- ): AnimatedComponentType<TProps, TInstance> {
48
+ export default function createAnimatedComponent<
49
+ TInstance: React.ComponentType<any>,
50
+ >(
51
+ Component: TInstance,
52
+ ): AnimatedComponentType<
53
+ $ReadOnly<React.ElementProps<TInstance>>,
54
+ React.ElementRef<TInstance>,
55
+ > {
51
56
  return unstable_createAnimatedComponentWithAllowlist(Component, null);
52
57
  }
53
58
 
54
59
  export function unstable_createAnimatedComponentWithAllowlist<
55
60
  TProps: {...},
56
- TInstance,
61
+ TInstance: React.ComponentType<TProps>,
57
62
  >(
58
- Component: component(ref: React.RefSetter<TInstance>, ...TProps),
63
+ Component: TInstance,
59
64
  allowlist: ?AnimatedPropsAllowlist,
60
- ): StrictAnimatedComponentType<TProps, TInstance> {
65
+ ): StrictAnimatedComponentType<TProps, React.ElementRef<TInstance>> {
61
66
  const useAnimatedProps = createAnimatedPropsHook(allowlist);
62
67
 
63
- const AnimatedComponent = React.forwardRef<
68
+ const AnimatedComponent: StrictAnimatedComponentType<
69
+ TProps,
70
+ React.ElementRef<TInstance>,
71
+ > = React.forwardRef<
64
72
  StrictAnimatedProps<TProps>,
65
- TInstance,
73
+ React.ElementRef<TInstance>,
66
74
  >((props, forwardedRef) => {
67
- const [reducedProps, callbackRef] = useAnimatedProps<TProps, TInstance>(
68
- props,
75
+ const [reducedProps, callbackRef] = useAnimatedProps<
76
+ TProps,
77
+ React.ElementRef<TInstance>,
78
+ >(props);
79
+ const ref = useMergeRefs<React.ElementRef<TInstance>>(
80
+ callbackRef,
81
+ forwardedRef,
69
82
  );
70
- const ref = useMergeRefs<TInstance>(callbackRef, forwardedRef);
71
83
 
72
84
  // Some components require explicit passthrough values for animation
73
85
  // to work properly. For example, if an animated component is
@@ -28,7 +28,7 @@ let _assertNativeAnimatedModule: ?() => void = () => {
28
28
  };
29
29
 
30
30
  export default class AnimatedNode {
31
- #listeners: Map<string, ValueListenerCallback> = new Map();
31
+ #listeners: Map<string, ValueListenerCallback>;
32
32
 
33
33
  _platformConfig: ?PlatformConfig = undefined;
34
34
 
@@ -38,6 +38,7 @@ export default class AnimatedNode {
38
38
  ...
39
39
  }>,
40
40
  ) {
41
+ this.#listeners = new Map();
41
42
  if (__DEV__) {
42
43
  this.__debugID = config?.debugID;
43
44
  }
@@ -75,7 +75,7 @@ function createAnimatedProps(
75
75
  }
76
76
 
77
77
  export default class AnimatedProps extends AnimatedNode {
78
- #animatedView: any = null;
78
+ #animatedView: any;
79
79
  #callback: () => void;
80
80
  #nodeKeys: $ReadOnlyArray<string>;
81
81
  #nodes: $ReadOnlyArray<AnimatedNode>;
@@ -89,6 +89,7 @@ export default class AnimatedProps extends AnimatedNode {
89
89
  ) {
90
90
  super(config);
91
91
  const [nodeKeys, nodes, props] = createAnimatedProps(inputProps, allowlist);
92
+ this.#animatedView = null;
92
93
  this.#nodeKeys = nodeKeys;
93
94
  this.#nodes = nodes;
94
95
  this.#props = props;
@@ -140,6 +141,22 @@ export default class AnimatedProps extends AnimatedNode {
140
141
  return props;
141
142
  }
142
143
 
144
+ __getNativeAnimatedEventTuples(): $ReadOnlyArray<[string, AnimatedEvent]> {
145
+ const tuples = [];
146
+
147
+ const keys = Object.keys(this.#props);
148
+ for (let ii = 0, length = keys.length; ii < length; ii++) {
149
+ const key = keys[ii];
150
+ const value = this.#props[key];
151
+
152
+ if (value instanceof AnimatedEvent && value.__isNative) {
153
+ tuples.push([key, value]);
154
+ }
155
+ }
156
+
157
+ return tuples;
158
+ }
159
+
143
160
  __getAnimatedValue(): Object {
144
161
  const props: {[string]: mixed} = {};
145
162
 
@@ -85,8 +85,8 @@ function _executeAsAnimatedBatch(id: string, operation: () => void) {
85
85
  * See https://reactnative.dev/docs/animatedvalue
86
86
  */
87
87
  export default class AnimatedValue extends AnimatedWithChildren {
88
- #listenerCount: number = 0;
89
- #updateSubscription: ?EventSubscription = null;
88
+ #listenerCount: number;
89
+ #updateSubscription: ?EventSubscription;
90
90
 
91
91
  _value: number;
92
92
  _startingValue: number;
@@ -99,6 +99,10 @@ export default class AnimatedValue extends AnimatedWithChildren {
99
99
  if (typeof value !== 'number') {
100
100
  throw new Error('AnimatedValue: Attempting to set value to undefined');
101
101
  }
102
+
103
+ this.#listenerCount = 0;
104
+ this.#updateSubscription = null;
105
+
102
106
  this._startingValue = this._value = value;
103
107
  this._offset = 0;
104
108
  this._animation = null;
@@ -8,14 +8,12 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {AnimatedValueConfig} from './nodes/AnimatedValue';
12
-
13
11
  import Animated from './Animated';
14
12
  import {useRef} from 'react';
15
13
 
16
14
  export default function useAnimatedValue(
17
15
  initialValue: number,
18
- config?: ?AnimatedValueConfig,
16
+ config?: ?Animated.AnimatedConfig,
19
17
  ): Animated.Value {
20
18
  const ref = useRef<null | Animated.Value>(null);
21
19
  if (ref.current == null) {