diff --git a/src/ReText.tsx b/src/ReText.tsx index a5d2139..58b5fda 100644 --- a/src/ReText.tsx +++ b/src/ReText.tsx @@ -1,5 +1,5 @@ import React from "react"; -import type { TextProps as RNTextProps } from "react-native"; +import type { TextInputProps, TextProps as RNTextProps } from "react-native"; import { StyleSheet, TextInput } from "react-native"; import Animated, { useAnimatedProps } from "react-native-reanimated"; @@ -10,7 +10,7 @@ const styles = StyleSheet.create({ }); Animated.addWhitelistedNativeProps({ text: true }); -interface TextProps { +interface TextProps extends Omit { text: Animated.SharedValue; style?: Animated.AnimateProps["style"]; } @@ -18,7 +18,7 @@ interface TextProps { const AnimatedTextInput = Animated.createAnimatedComponent(TextInput); const ReText = (props: TextProps) => { - const { text, style } = { style: {}, ...props }; + const { style, text, ...rest } = props; const animatedProps = useAnimatedProps(() => { return { text: text.value, @@ -31,7 +31,8 @@ const ReText = (props: TextProps) => { underlineColorAndroid="transparent" editable={false} value={text.value} - style={[styles.baseStyle, style]} + style={[styles.baseStyle, style || undefined]} + {...rest} {...{ animatedProps }} /> );