用户点击输入后键盘保持关闭状态

时间:2020-03-27 05:13:03

标签: android ios react-native

问题=> https://drive.google.com/open?id=1KwBWMVsj-0PFzt9cLfLuZ9cTvkqjIob8

这是我的代码

export default function TextInp(props) {
  const [ansVal, setAnsVal] = useState(props.data.ans);

  const answer = (ans) => {
    setAnsVal(ans);
    props.answer(ans);
  };

  return (
    <View style={styles.view}>
      <TextInput
        placeholder={props.placeholder}
        style={props.free ? styles.freeContainer : styles.container}
        onChangeText={(text)=>answer(text)}
        defaultValue={ansVal}
      />
    </View>
  );
}

PS。 TextInput位于ScrollView内部。我不确定这是否是问题的原因。

0 个答案:

没有答案