react-native Keyboard.dismiss() 在 iOS 上自动填充后不起作用



我正在使用expo开发一个反应原生应用程序。

在我的登录屏幕上,我有两个文本输入(带有文本内容类型用户名和密码(。 我确实有多个地方调用Keyboard.dismiss()(从包装可触摸,从其他按钮等(,这对于大多数用例都很好用。

我的问题是,在我成功在iOS上使用密码自动填充(通过指纹(后,键盘首先隐藏并自动重新显示(触发所有常见的键盘事件(,这看起来很奇怪,但可以接受,但之后键盘不再对任何Keyboard.dismiss()调用做出反应,直到我专注于另一个TextInput。

"使用强密码"键盘覆盖层似乎也存在类似的问题。

这是我的版本:

"expo": "^34.0.1",
"react": "16.8.3",
"react-dom": "^16.8.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",

在 iOS 13.2.3 上的世博会客户端中运行

提前感谢您的任何帮助。

编辑:

我将问题简化为最基本的版本。关闭按钮工作正常,直到我在iOS设备上使用密码自动填充。

https://github.com/SebastianRoese/tryouts/tree/master/keyboard-dismiss-problem

import React from 'react'
import { View, Button, TextInput, StyleSheet, Keyboard } from 'react-native'
const App = () => {
return (
<View style={styles.screen}>
<TextInput style={styles.textinput} textContentType="username" />
<TextInput style={styles.textinput} secureTextEntry textContentType="password" />
<Button title="Dismiss Keyboard" onPress={() => Keyboard.dismiss()} />
</View>
)
}
const styles = StyleSheet.create({
screen: {
width: '100%',
height: '100%',
paddingVertical: '15%',
backgroundColor: '#1e1e1e',
alignItems: 'center',
},
textinput: {
marginVertical: 10,
padding: 10,
width: '70%',
height: 40,
backgroundColor: '#ababab',
},
})
export default App

从世博会 SDK 34 升级到世博会 SDK 38 后,问题不再重现。

似乎至少在世博会SDK版本34中是一个问题。

最新更新