动画TextInput在每个字符后关闭键盘

时间:2019-12-20 01:11:39

标签: react-native react-animated

我正在为dx设置动画以便与TextInput一起移动,但是当我应用React Native translateY时,animated响应一次只键入一个字符。我的意思是,一旦输入了字符,键盘就会关闭。

我正在发生三个动画,而其他动画工作正常:

TextInput

动画的 const [textInputAnimation] = useState(new Animated.Value(0)) useEffect(() => { Animated.parallel([ Animated.timing(animation, { toValue: 1, duration: 800, useNativeDriver: true, }), Animated.timing(textInputAnimation, { toValue: 1, duration: 400, delay: 700, useNativeDriver: true, }), Animated.timing(logoAnimation, { toValue: 1, duration: 400, delay: 900, useNativeDriver: true, }) ]).start() }, []) const translateYInterpolate = textInputAnimation.interpolate({ inputRange: [0, 1], outputRange: [-50, 0] }) const animatedOpacity = textInputAnimation.interpolate({ inputRange: [0, 1], outputRange: [0, 1] }) const animatedTranslateStyle = { transform: [ { translateY: translateYInterpolate } ], opacity: animatedOpacity, } const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);

TextInput

0 个答案:

没有答案
相关问题