A component which enables customization of the keyboard input accessory view. The input accessory view is displayed above the keyboard whenever a TextInput has focus. This component can be used to create custom toolbars. To use this component, wrap your custom toolbar with the InputAccessoryView component and set aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/facebook/react-native/llms.txt
Use this file to discover all available pages before exploring further.
nativeID. Then, pass that nativeID as the inputAccessoryViewID of whatever TextInput you desire.
Example
Props
nativeID
Type: string
An ID which is used to associate this InputAccessoryView to specified TextInput(s). To link the InputAccessoryView to a TextInput, set the TextInput’s inputAccessoryViewID prop to match this nativeID.
backgroundColor
Type: ColorValue
The background color of the input accessory view.
style
Type: ViewStyle
Style for the InputAccessoryView container.
children
Type: React.ReactNode
The content to display in the input accessory view. This is typically a toolbar with buttons or other controls.
Sticky TextInput
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 anativeID.
Complete Example
Custom Toolbar Example
Tips
- The
nativeIDmust be unique within your application. - Multiple TextInputs can share the same
inputAccessoryViewIDto use the same toolbar. - The InputAccessoryView will automatically appear and disappear with the keyboard.
- Use
keyboardDismissMode="interactive"on ScrollView to allow dismissing the keyboard by dragging. - The InputAccessoryView respects safe area insets automatically.