【发布时间】:2018-05-05 22:06:39
【问题描述】:
我有一个问题,我在 KeyboardAwareScrollView 中有一个 TextInput 和一个 按钮。我希望用户输入一些文本,然后按 TouchableOpacity 制作的 按钮。这会将用户刚刚输入的文本向前发送。
问题是输入文本后,第一次尝试 TextInput 只是失去焦点。只有在下一次按下尝试时才会真正按下 按钮n。如何让按钮在第一次按下时做出反应?
我正在使用这个包https://github.com/APSL/react-native-keyboard-aware-scroll-view
我的代码如下:
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
export default class App extends Component<{}> {
render() {
return (
<KeyboardAwareScrollView>
<TextInput
style={{ width: 100, height: 50, backgroundColor: 'blue' }}
/>
<TouchableOpacity
style={{ backgroundColor: 'red', width: 50, height: 50 }}
/>
</KeyboardAwareScrollView>
);
}
}
【问题讨论】:
标签: javascript android ios reactjs react-native