Align useAnimatedValue with OSS types (#49643)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Iwo Plaza
2025-02-28 06:33:21 -08:00
committed by Facebook GitHub Bot
parent 0289e4061e
commit 5fc2484440
4 changed files with 6 additions and 4 deletions
@@ -24,6 +24,8 @@ export {default as Node} from './nodes/AnimatedNode';
export {default as Value} from './nodes/AnimatedValue';
export {default as ValueXY} from './nodes/AnimatedValueXY';
export type {AnimatedValueConfig as AnimatedConfig} from './nodes/AnimatedValue';
export const add = AnimatedImplementation.add;
export const attachNativeEvent = AnimatedImplementation.attachNativeEvent;
export const createAnimatedComponent =
@@ -8,14 +8,12 @@
* @format
*/
import type {AnimatedValueConfig} from './nodes/AnimatedValue';
import Animated from './Animated';
import {useRef} from 'react';
export default function useAnimatedValue(
initialValue: number,
config?: ?AnimatedValueConfig,
config?: ?Animated.AnimatedConfig,
): Animated.Value {
const ref = useRef<null | Animated.Value>(null);
if (ref.current == null) {
@@ -172,6 +172,7 @@ export { default as Interpolation } from \\"./nodes/AnimatedInterpolation\\";
export { default as Node } from \\"./nodes/AnimatedNode\\";
export { default as Value } from \\"./nodes/AnimatedValue\\";
export { default as ValueXY } from \\"./nodes/AnimatedValueXY\\";
export type { AnimatedValueConfig as AnimatedConfig } from \\"./nodes/AnimatedValue\\";
declare export const add: $FlowFixMe;
declare export const attachNativeEvent: $FlowFixMe;
declare export const createAnimatedComponent: $FlowFixMe;
@@ -1006,7 +1007,7 @@ exports[`public API should not change unintentionally Libraries/Animated/useAnim
exports[`public API should not change unintentionally Libraries/Animated/useAnimatedValue.js 1`] = `
"declare export default function useAnimatedValue(
initialValue: number,
config?: ?AnimatedValueConfig
config?: ?Animated.AnimatedConfig
): Animated.Value;
"
`;
+1
View File
@@ -29,6 +29,7 @@ const ENTRY_POINTS = [
'packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js',
'packages/react-native/Libraries/Alert/Alert.js',
'packages/react-native/Libraries/Animated/Animated.js',
'packages/react-native/Libraries/Animated/useAnimatedValue.js',
'packages/react-native/Libraries/AppState/AppState.js',
'packages/react-native/Libraries/BatchedBridge/NativeModules.js',
'packages/react-native/Libraries/Blob/Blob.js',