Skip to main content

InputAccessoryView

一个可以在 iOS 上自定义键盘输入附件视图的组件。只要 TextInput 获得焦点,输入附件视图就会显示在键盘上方。该组件可用于创建自定义工具栏。

¥A component which enables customization of the keyboard input accessory view on iOS. The input accessory view is displayed above the keyboard whenever a TextInput has focus. This component can be used to create custom toolbars.

要使用此组件,请使用 InputAccessoryView 组件封装自定义工具栏,并设置 nativeID。然后,将 nativeID 作为你想要的 TextInputinputAccessoryViewID 传递。一个基本的例子:

¥To use this component wrap your custom toolbar with the InputAccessoryView component, and set a nativeID. Then, pass that nativeID as the inputAccessoryViewID of whatever TextInput you desire. A basic example:

该组件还可用于创建粘性文本输入(锚定到键盘顶部的文本输入)。为此,请使用 InputAccessoryView 组件封装 TextInput,并且不要设置 nativeID。例如,查看 InputAccessoryViewExample.js

¥This component can also be used to create sticky text inputs (text inputs which are anchored to the top of the keyboard). To do this, wrap a TextInput with the InputAccessoryView component, and don't set a nativeID. For an example, look at InputAccessoryViewExample.js.


参考

¥Reference

属性

¥Props

backgroundColor

类型
color

nativeID

用于将此 InputAccessoryView 关联到指定 TextInput 的 ID。

¥An ID which is used to associate this InputAccessoryView to specified TextInput(s).

类型
string

style

类型
View 样式

已知的问题

¥Known issues