【发布时间】:2022-01-19 16:12:12
【问题描述】:
我正在开发一个 react-native 应用程序,在该应用程序中我遇到了 TextInput 问题。
每当我按下键盘上的一个键时,键盘就会关闭。
我尝试过使用不同的文本输入组件,例如材料文本输入和“react-native-elements”输入。但是同样的问题也存在。
stackexchange 上有类似的问题,但他们都试图在 TextInput 中解决这个问题。但是,问题不在于 TextInput,而在于 TextInput 的实现。
我已将代码简化为:
import React, {useState} from 'react';
import { Text, View, StyleSheet, TextInput } from 'react-native';
const App = () => {
const [additionalComments, setAdditionalComments] = useState("");
const StarFeedback = () => {
return (
<TextInput
placeholder="Additional Comments"
onChangeText={text => setAdditionalComments(text)}
value={additionalComments}
/>
)
}
return (
<View>
<StarFeedback/>
</View>
);
};
export default App;
const styles = StyleSheet.create({
});
【问题讨论】:
-
检查这个stackoverflow.com/questions/59891992/…>
标签: react-native keypress textinput