Skip to content

Commit 3857324

Browse files
committed
Add docs for InputAccessoryView
1 parent 3d8cae9 commit 3857324

4 files changed

Lines changed: 95 additions & 3 deletions

File tree

‎docs/inputaccessoryview.md‎

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
id: inputaccessoryview
3+
title: InputAccessoryView
4+
---
5+
6+
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.
7+
8+
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 simple example:
9+
10+
```ReactNativeWebPlayer
11+
import React, { Component } from 'react';
12+
import { View, ScrollView, AppRegistry, TextInput, InputAccessoryView, Button } from 'react-native';
13+
14+
export default class UselessTextInput extends Component {
15+
constructor(props) {
16+
super(props);
17+
this.state = {text: 'Placeholder Text'};
18+
}
19+
20+
render() {
21+
const inputAccessoryViewID = "uniqueID";
22+
return (
23+
<View>
24+
<ScrollView keyboardDismissMode="interactive">
25+
<TextInput
26+
style={{
27+
padding: 10,
28+
paddingTop: 50,
29+
}}
30+
inputAccessoryViewID={inputAccessoryViewID}
31+
onChangeText={text => this.setState({text})}
32+
value={this.state.text}
33+
/>
34+
</ScrollView>
35+
<InputAccessoryView nativeID={inputAccessoryViewID}>
36+
<Button
37+
onPress={() => this.setState({text: 'Placeholder Text'})}
38+
title="Reset Text"
39+
/>
40+
</InputAccessoryView>
41+
</View>
42+
);
43+
}
44+
}
45+
46+
// skip this line if using Create React Native App
47+
AppRegistry.registerComponent('AwesomeProject', () => UselessTextInput);
48+
```
49+
50+
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](https://github.com/facebook/react-native/blob/master/RNTester/js/InputAccessoryViewExample.js).
51+
52+
### Props
53+
54+
* [`backgroundColor`](inputaccessoryview.md#backgroundcolor)
55+
* [`nativeID`](inputaccessoryview.md#nativeid)
56+
* [`style`](inputaccessoryview.md#style)
57+
58+
---
59+
60+
# Reference
61+
62+
## Properties
63+
64+
### `backgroundColor`
65+
66+
| Type | Required |
67+
| ------------------ | -------- |
68+
| [color](colors.md) | No |
69+
70+
---
71+
72+
### `nativeID`
73+
74+
An ID which is used to associate this `InputAccessoryView` to specified TextInput(s).
75+
76+
| Type | Required |
77+
| ------ | -------- |
78+
| string | No |
79+
80+
---
81+
82+
### `style`
83+
84+
| Type | Required |
85+
| ---------------------------- | -------- |
86+
| [style](view-style-props.md) | No |

‎website/core/RemarkablePlugins.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ function htmlForCodeBlock(code) {
4242
* whenever an example that uses the SnackPlayer is updated with code
4343
* that requires a newer Expo SDK release.
4444
*/
45-
const LatestSDKVersion = '23.0.0';
45+
const LatestSDKVersion = '25.0.0';
4646
const ReactNativeToExpoSDKVersionMap = {
47+
'0.52': '25.0.0',
48+
'0.51': '24.0.0',
4749
'0.50': '23.0.0',
4850
'0.49': '22.0.0',
4951
'0.48': '21.0.0',

‎website/i18n/en.json‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"images": "Images",
5757
"imagestore": "ImageStore",
5858
"improvingux": "Improving User Experience",
59+
"inputaccessoryview": "InputAccessoryView",
5960
"integration-with-existing-apps": "Integration with Existing Apps",
6061
"interactionmanager": "InteractionManager",
6162
"javascript-environment": "JavaScript Environment",
@@ -153,8 +154,10 @@
153154
"APIs": "APIs"
154155
},
155156
"pages-strings": {
156-
"Help Translate|recruit community translators for your project": "Help Translate",
157+
"Help Translate|recruit community translators for your project":
158+
"Help Translate",
157159
"Edit this Doc|recruitment message asking to edit the doc source": "Edit",
158-
"Translate this Doc|recruitment message asking to translate the docs": "Translate"
160+
"Translate this Doc|recruitment message asking to translate the docs":
161+
"Translate"
159162
}
160163
}

‎website/sidebars.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"drawerlayoutandroid",
6565
"flatlist",
6666
"image",
67+
"inputaccessoryview",
6768
"keyboardavoidingview",
6869
"listview",
6970
"maskedviewios",

0 commit comments

Comments
 (0)