Skip to content

Commit 5fc2484

Browse files
iwoplazafacebook-github-bot
authored andcommitted
Align useAnimatedValue with OSS types (facebook#49643)
Summary: Pull Request resolved: facebook#49643 ## Motivation Modernising the RN codebase to allow for modern Flow tooling to process it. ## This diff Aligns `useAnimatedValue.js` with its manual .d.ts types. Changelog: [Internal] Reviewed By: huntie Differential Revision: D70096210 fbshipit-source-id: c3cd517eccf1cb68400772ddde6e5891861c927d
1 parent 0289e40 commit 5fc2484

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

packages/react-native/Libraries/Animated/AnimatedExports.js.flow

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export {default as Node} from './nodes/AnimatedNode';
2424
export {default as Value} from './nodes/AnimatedValue';
2525
export {default as ValueXY} from './nodes/AnimatedValueXY';
2626

27+
export type {AnimatedValueConfig as AnimatedConfig} from './nodes/AnimatedValue';
28+
2729
export const add = AnimatedImplementation.add;
2830
export const attachNativeEvent = AnimatedImplementation.attachNativeEvent;
2931
export const createAnimatedComponent =

packages/react-native/Libraries/Animated/useAnimatedValue.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
* @format
99
*/
1010

11-
import type {AnimatedValueConfig} from './nodes/AnimatedValue';
12-
1311
import Animated from './Animated';
1412
import {useRef} from 'react';
1513

1614
export default function useAnimatedValue(
1715
initialValue: number,
18-
config?: ?AnimatedValueConfig,
16+
config?: ?Animated.AnimatedConfig,
1917
): Animated.Value {
2018
const ref = useRef<null | Animated.Value>(null);
2119
if (ref.current == null) {

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export { default as Interpolation } from \\"./nodes/AnimatedInterpolation\\";
172172
export { default as Node } from \\"./nodes/AnimatedNode\\";
173173
export { default as Value } from \\"./nodes/AnimatedValue\\";
174174
export { default as ValueXY } from \\"./nodes/AnimatedValueXY\\";
175+
export type { AnimatedValueConfig as AnimatedConfig } from \\"./nodes/AnimatedValue\\";
175176
declare export const add: $FlowFixMe;
176177
declare export const attachNativeEvent: $FlowFixMe;
177178
declare export const createAnimatedComponent: $FlowFixMe;
@@ -1006,7 +1007,7 @@ exports[`public API should not change unintentionally Libraries/Animated/useAnim
10061007
exports[`public API should not change unintentionally Libraries/Animated/useAnimatedValue.js 1`] = `
10071008
"declare export default function useAnimatedValue(
10081009
initialValue: number,
1009-
config?: ?AnimatedValueConfig
1010+
config?: ?Animated.AnimatedConfig
10101011
): Animated.Value;
10111012
"
10121013
`;

scripts/build/build-types/buildTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const ENTRY_POINTS = [
2929
'packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js',
3030
'packages/react-native/Libraries/Alert/Alert.js',
3131
'packages/react-native/Libraries/Animated/Animated.js',
32+
'packages/react-native/Libraries/Animated/useAnimatedValue.js',
3233
'packages/react-native/Libraries/AppState/AppState.js',
3334
'packages/react-native/Libraries/BatchedBridge/NativeModules.js',
3435
'packages/react-native/Libraries/Blob/Blob.js',

0 commit comments

Comments
 (0)