-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
65 lines (59 loc) · 1.9 KB
/
App.tsx
File metadata and controls
65 lines (59 loc) · 1.9 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
53
54
55
56
57
58
59
60
61
62
63
64
65
import React, {useMemo, useState} from 'react';
import {Dimensions, SafeAreaView, StyleSheet, View} from 'react-native';
import Entypo from 'react-native-vector-icons/Entypo';
function App(): React.JSX.Element {
const [barHeight, setBarHeight] = useState(10);
const memoStyles = useMemo(() => styles(barHeight), [barHeight]);
return (
<SafeAreaView>
<View style={memoStyles.container}>
<View style={memoStyles.outer}>
<View style={memoStyles.icons}>
<Entypo name="light-up" size={50} color="black" />
<Entypo name="light-down" size={50} color="black" />
</View>
<View style={memoStyles.inner} />
</View>
</View>
</SafeAreaView>
);
}
const outerRoundedCorner = 60;
const innerRoundedCorner = outerRoundedCorner - 5;
const styles = (barHeight: number) =>
StyleSheet.create({
container: {
justifyContent: 'center',
alignItems: 'center',
padding: 20,
height: '100%',
},
outer: {
alignItems: 'center',
justifyContent: 'flex-end',
backgroundColor: 'lightgray',
width: Dimensions.get('window').width / 2,
height: '80%',
borderTopEndRadius: outerRoundedCorner - 5,
borderTopStartRadius: outerRoundedCorner - 5,
borderBottomRightRadius: outerRoundedCorner - 5,
borderBottomLeftRadius: outerRoundedCorner - 5,
},
icons: {
position: 'absolute',
zIndex: 1,
height: '100%',
justifyContent: 'space-between',
padding: 20,
},
inner: {
backgroundColor: 'gray',
width: Dimensions.get('window').width / 2,
height: `${barHeight}%`,
borderBottomRightRadius: innerRoundedCorner,
borderBottomLeftRadius: innerRoundedCorner,
borderTopEndRadius: barHeight > 90 ? innerRoundedCorner : 0,
borderTopStartRadius: barHeight > 90 ? innerRoundedCorner : 0,
},
});
export default App;