我想更改Animated.View宽度,但出现此错误。我不想使用NativeDriver。我添加了“ useNativeDriver:false”,但是一切都一样。我该怎么办?
const show = () => {
console.log("show");
Animated.timing(mode, {
toValue: 1,
duration: 500,
useNativeDriver:false,
}).start();
};
const hide = () => {
Keyboard.dismiss();
Animated.timing(mode, {
toValue: 0,
duration: 500,
useNativeDriver:false,
}).start();
};
const inputSize = mode.interpolate({
inputRange:[0, 1],
outputRange:["100%", "80%"]
});
<Animated.View style={[styles.searchContainer, {width:inputSize}]}>
<EvilIcons name="search" size={wp("8%")} color="rgba(0,0,0,.6)"/>
<TextInput
placeholder={`${i18n.t("search")}`}
onChangeText={(text)=>setValue(text)}
value={value}
returnKeyType="go"
style={styles.input}
onFocus={()=> show()}
/>
</Animated.View>