我如何 keep/blur React Native 上的 TextInput 键盘

How do I keep/blur TextInput keyboard on React Native

我点击文本输入,键盘从底部滑出,如何将其滑回或keep/blur React Native 上的键盘?

使用 iqkeyboardManager 最适合隐藏带有完成按钮工具栏的键盘

Link: https://github.com/hackiftekhar/IQKeyboardManager

https://github.com/facebook/react-native/blob/master/Libraries/Utilities/dismissKeyboard.js

var dismissKeyboard = require('dismissKeyboard')

onPressCancelButton {
    dismissKeyboard();
}

这是目前的默认行为。显示 onFocus 并隐藏 onBlur。所以不再需要额外的库了。

您可以使用 react-native 中的 Keyboard 模块。

https://facebook.github.io/react-native/docs/keyboard

import { Keyboard } from react-native;

Keyboard.dismiss();