Skip to content

Commit

Permalink
Edit TextInput example to compare PRs
Browse files Browse the repository at this point in the history
I added SafeAreaView component because it is necessary in this case and wrote two TextInput component so that the reader would know the difference between a value prop and a placeholder prop and also understand the use of keyboardType.
  • Loading branch information
mojvan authored Aug 31, 2020
1 parent 0749856 commit 58f5808
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions docs/textinput.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,25 @@ The most basic use case is to plop down a `TextInput` and subscribe to the `onCh

```SnackPlayer name=TextInput
import React, { Component } from 'react';
import { TextInput } from 'react-native';
import { TextInput , SafeAreaView} from 'react-native';
const UselessTextInput = () => {
const [value, onChangeText] = React.useState('Useless Placeholder');
const [number, onChangeNumber] = React.useState('Phone number');
return (
<TextInput
style={{ height: 40, borderColor: 'gray', borderWidth: 1 }}
onChangeText={text => onChangeText(text)}
value={value}
/>
<SafeAreaView>
<TextInput
style={{ height: 40, borderColor: 'gray', borderWidth: 1 }}
onChangeText={onChangeText}
value={value}
/>
<TextInput
style={{ height: 40, marginTop: 20, borderWidth: 1 }}
onChangeText={onChangeNumber}
placeholder={number}
keyboardType={'numeric'}
/>
</SafeAreaView>
);
}
Expand Down

0 comments on commit 58f5808

Please sign in to comment.