Skip to content

Commit fe9c2c6

Browse files
abass-devvonovak
andauthored
docs: better readme example (#735)
* Update (README, Doc): Show the datetime/time picker when the button is pressed. - The datetime or time picker should pop up by passing (true) as a value to the setShow() function when the button is pressed. * docs: better example --------- Co-authored-by: Vojtech Novak <[email protected]>
1 parent 8c5d005 commit fe9c2c6

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ export const App = () => {
168168
};
169169

170170
return (
171-
<View>
171+
<SafeAreaView>
172172
<Button onPress={showDatepicker} title="Show date picker!" />
173173
<Button onPress={showTimepicker} title="Show time picker!" />
174174
<Text>selected: {date.toLocaleString()}</Text>
175-
</View>
175+
</SafeAreaView>
176176
);
177177
};
178178
```
@@ -192,10 +192,7 @@ export const App = () => {
192192
};
193193

194194
const showMode = (currentMode) => {
195-
if (Platform.OS === 'android') {
196-
setShow(false);
197-
// for iOS, add a button that closes the picker
198-
}
195+
setShow(true);
199196
setMode(currentMode);
200197
};
201198

@@ -208,7 +205,7 @@ export const App = () => {
208205
};
209206

210207
return (
211-
<View>
208+
<SafeAreaView>
212209
<Button onPress={showDatepicker} title="Show date picker!" />
213210
<Button onPress={showTimepicker} title="Show time picker!" />
214211
<Text>selected: {date.toLocaleString()}</Text>
@@ -221,7 +218,7 @@ export const App = () => {
221218
onChange={onChange}
222219
/>
223220
)}
224-
</View>
221+
</SafeAreaView>
225222
);
226223
};
227224
```

0 commit comments

Comments
 (0)