-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
44 lines (39 loc) · 1.07 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* eslint-disable react-native/no-inline-styles */
import React from 'react';
import {Text, TouchableHighlight, View} from 'react-native';
import {
KeyboardProvider,
useKeyboardController,
} from 'react-native-keyboard-controller';
function App(): React.JSX.Element {
return (
<KeyboardProvider
enabled={false}
statusBarTranslucent
navigationBarTranslucent>
<Home />
</KeyboardProvider>
);
}
function Home(): React.JSX.Element {
const {enabled, setEnabled} = useKeyboardController();
return (
<View
style={{
flex: 1,
backgroundColor: 'white',
justifyContent: 'center',
alignItems: 'center',
}}>
<Text style={{color: 'black'}}>
{`Keyboard Controller enabled: ${enabled}`}
</Text>
<TouchableHighlight
style={{borderRadius: 6, borderWidth: 1, marginTop: 16, padding: 16}}
onPress={() => setEnabled(prev => !prev)}>
<Text style={{color: 'black'}}>Toggle Keyboard Controller</Text>
</TouchableHighlight>
</View>
);
}
export default App;