File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import React from "react" ;
2- import type { TextProps as RNTextProps } from "react-native" ;
2+ import type { TextInputProps , TextProps as RNTextProps } from "react-native" ;
33import { StyleSheet , TextInput } from "react-native" ;
44import Animated , { useAnimatedProps } from "react-native-reanimated" ;
55
@@ -10,15 +10,15 @@ const styles = StyleSheet.create({
1010} ) ;
1111Animated . addWhitelistedNativeProps ( { text : true } ) ;
1212
13- interface TextProps {
13+ interface TextProps extends Omit < TextInputProps , "value" | "style" > {
1414 text : Animated . SharedValue < string > ;
1515 style ?: Animated . AnimateProps < RNTextProps > [ "style" ] ;
1616}
1717
1818const AnimatedTextInput = Animated . createAnimatedComponent ( TextInput ) ;
1919
2020const ReText = ( props : TextProps ) => {
21- const { text , style } = { style : { } , ...props } ;
21+ const { style , text , ...rest } = props ;
2222 const animatedProps = useAnimatedProps ( ( ) => {
2323 return {
2424 text : text . value ,
@@ -31,7 +31,8 @@ const ReText = (props: TextProps) => {
3131 underlineColorAndroid = "transparent"
3232 editable = { false }
3333 value = { text . value }
34- style = { [ styles . baseStyle , style ] }
34+ style = { [ styles . baseStyle , style || undefined ] }
35+ { ...rest }
3536 { ...{ animatedProps } }
3637 />
3738 ) ;
You can’t perform that action at this time.
0 commit comments