-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExplore.tsx
More file actions
52 lines (46 loc) · 1.63 KB
/
Explore.tsx
File metadata and controls
52 lines (46 loc) · 1.63 KB
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
45
46
47
48
49
50
51
52
import { Button, Text, View } from 'react-native';
import { exploreStyle } from './styles';
import RNOrientationDirector, {
useDeviceOrientation,
useInterfaceOrientation,
useIsInterfaceOrientationLocked,
} from 'react-native-orientation-director';
import { useNavigation } from '@react-navigation/native';
function Explore() {
const navigation = useNavigation();
const interfaceOrientation = useInterfaceOrientation();
const deviceOrientation = useDeviceOrientation();
const isInterfaceOrientationLocked = useIsInterfaceOrientationLocked();
const handleGoToInnerExploreOnPress = () => {
navigation.navigate('InnerExplore' as never);
};
return (
<View style={exploreStyle.container}>
<Text>Explore!</Text>
<View style={exploreStyle.marginBottom} />
<Button
title="Go to inner explore"
onPress={handleGoToInnerExploreOnPress}
/>
<View style={exploreStyle.body}>
<Text style={[exploreStyle.text, exploreStyle.marginBottom]}>
Current Interface Orientation:
{RNOrientationDirector.convertOrientationToHumanReadableString(
interfaceOrientation
)}
</Text>
<Text style={[exploreStyle.text, exploreStyle.marginBottom]}>
Current Device Orientation:
{RNOrientationDirector.convertOrientationToHumanReadableString(
deviceOrientation
)}
</Text>
<Text style={[exploreStyle.text, exploreStyle.marginBottom]}>
Is Interface Orientation Locked:
{isInterfaceOrientationLocked ? 'Yes' : 'No'}
</Text>
</View>
</View>
);
}
export default Explore;