UNPKG

react-native-reanimated

Version:

More powerful alternative to Animated library for React Native.

32 lines • 1.34 kB
import type { ComponentRef, ReactNode } from 'react'; import type { TextProps } from 'react-native'; import { Text } from 'react-native'; import type { SharedValueDisableContravariance } from '../commonTypes'; import { type AnimatedComponentType } from '../createAnimatedComponent'; type AnimatedTextComplement = ComponentRef<typeof Text> & { getNode(): ComponentRef<typeof Text>; }; type AnimatedTextChild = ReactNode | SharedValueDisableContravariance<string | number | null | undefined>; /** * Animated version of the React Native `Text`. Its children can be shared * values, and the text follows them on the UI thread without re-rendering. * * Pass the shared value itself as a child. Don't read its `value` during * render: it is a side effect that blocks the JS thread until the value is * fetched from the UI thread, and the text becomes a static snapshot that never * updates. * * ```tsx * // Antipattern * <Animated.Text>{sv.value}</Animated.Text>; * * // Correct * <Animated.Text>{sv}</Animated.Text>; * ``` */ export declare const AnimatedText: AnimatedComponentType<Readonly<Omit<TextProps, "children">>, ComponentRef<typeof Text>, { children?: AnimatedTextChild | AnimatedTextChild[]; }>; export type AnimatedText = typeof AnimatedText & AnimatedTextComplement; export {}; //# sourceMappingURL=Text.d.ts.map