Skip to content

Commit 32ab5b6

Browse files
JoelMarceyFacebook Github Bot 0
authored andcommitted
ES6-ify TextInput Basics
Summary: Closes #8367 Differential Revision: D3477404 Pulled By: caabernathy fbshipit-source-id: 16c279853b5c7a2d24033ef0d987da52dd148b24
1 parent 7476139 commit 32ab5b6

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

docs/Basics-Component-TextInput.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,28 @@ Direct text-based user input is a foundation for many apps. Writing a post or co
1212
This example creates a simple `TextInput` box with the `string` `Type something here` as the placeholder when the `TextInput` is empty.
1313

1414
```ReactNativeWebPlayer
15-
import React from 'react';
15+
import React, { Component } from 'react';
1616
import { AppRegistry, Text, TextInput, View } from 'react-native';
1717
18-
const AwesomeProject = () => {
19-
return (
20-
<View style={{paddingTop: 22}}>
21-
<TextInput
22-
style={{
23-
height: 40,
24-
margin: 5,
25-
paddingLeft: 10,
26-
borderColor: 'black',
27-
borderWidth: 1
28-
}}
29-
placeholder="Type something here"
30-
/>
31-
</View>
32-
);
18+
class TextInputBasics extends Component {
19+
render() {
20+
return (
21+
<View style={{paddingTop: 22}}>
22+
<TextInput
23+
style={{
24+
height: 40,
25+
margin: 5,
26+
paddingLeft: 10,
27+
borderColor: 'black',
28+
borderWidth: 1
29+
}}
30+
placeholder="Type something here"
31+
/>
32+
</View>
33+
);
34+
}
3335
}
3436
3537
// App registration and rendering
36-
AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
38+
AppRegistry.registerComponent('AwesomeProject', () => TextInputBasics);
3739
```

0 commit comments

Comments
 (0)