相关疑难解决方法(0)

在本地反应中隐藏键盘

如果我点击文本输入,我希望能够点击其他地方以便再次解除键盘(尽管不是返回键).我在所阅读的所有教程和博客文章中都没有找到关于这方面的最细微信息.

这个基本示例对我来说仍然不适用于模拟器中的react-native 0.4.2.无法在我的iPhone上试用它.

<View style={styles.container}>
    <Text style={styles.welcome}>
      Welcome to React Native!
    </Text>
    <Text style={styles.instructions}>
      To get started, edit index.ios.js
    </Text>
    <Text style={styles.instructions}>
      Press Cmd+R to reload,{'\n'}
      Cmd+D or shake for dev menu
    </Text>
    <TextInput
      style={{height: 40, borderColor: 'gray', borderWidth: 1}}
      onEndEditing={this.clearFocus}
    />
  </View>
Run Code Online (Sandbox Code Playgroud)

reactjs react-native

375
推荐指数
26
解决办法
14万
查看次数

在其外部轻敲时模糊TextInput

我遇到使用TextInput预期行为的问题是,当我点击它时,它会聚焦并显示键盘,当我点击它(除了输入之外的任何地方)时,TextInput应该模糊,键盘将消失.目前这不会发生,无论我点击哪里,文本输入都会保持聚焦.这是预期的行为,如果是这样,通常如何处理?

<Image source={require('../assets/background.jpg')} style={{width: undefined; height: undefined; flex: 1;}}>
  <View>
    <TextInput placeholder="Email" style={{ width: 200; height: 40; }} />
  </View>
</Image>
Run Code Online (Sandbox Code Playgroud)

javascript react-native

4
推荐指数
1
解决办法
4049
查看次数

标签 统计

react-native ×2

javascript ×1

reactjs ×1