-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
91 lines (85 loc) Β· 2.45 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import React, {FC} from 'react';
import {Alert, StyleSheet, Text, View} from 'react-native';
import {DailyDealsHeader} from './components/DailyDealsHeader.tsx';
import {GradientBackground} from './components/GradientBackground.tsx';
import {DailyDealsShapeSkia} from './components/DailyDealsShapeSkia.tsx';
import {PolygonFeatures} from './components/DailyDealsBackgroundShape.tsx';
import {DailyDealsShapeSvg} from './components/DailyDealsShapeSvg.tsx';
const renderDailyDealsShapeSkia = (
polygonFeatures: PolygonFeatures,
shapeColor: string,
) => (
<DailyDealsShapeSkia
polygonFeatures={polygonFeatures}
shapeColor={shapeColor}
/>
);
const renderDailyDealsShapeSvg = (
polygonFeatures: PolygonFeatures,
shapeColor: string,
) => (
<DailyDealsShapeSvg
polygonFeatures={polygonFeatures}
shapeColor={shapeColor}
/>
);
const App: FC = () => {
const onPress = () =>
Alert.alert('Pressed', 'Custom Component Pressed', [
{text: 'OK', onPress: () => console.log('OK Pressed')},
]);
const originCity = 'London (LON)';
return (
<View style={styles.container}>
<GradientBackground />
<View style={styles.section}>
<Text style={styles.titleLabel}>React Native Skia</Text>
<DailyDealsHeader
originCity={originCity}
onPress={onPress}
originShape={polygonFeatures =>
renderDailyDealsShapeSkia(polygonFeatures, '#FFFFFF')
}
titleShape={polygonFeatures =>
renderDailyDealsShapeSkia(polygonFeatures, '#F2007D')
}
/>
</View>
<View style={styles.section}>
<Text style={styles.titleLabel}>React Native SVG</Text>
<DailyDealsHeader
originCity={originCity}
onPress={onPress}
originShape={polygonFeatures =>
renderDailyDealsShapeSvg(polygonFeatures, '#FFFFFF')
}
titleShape={polygonFeatures =>
renderDailyDealsShapeSvg(polygonFeatures, '#F2007D')
}
/>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'column',
},
titleLabel: {
color: 'white',
fontSize: 24,
fontWeight: 'bold',
fontFamily: 'Ubuntu-Bold',
marginBottom: 16,
textDecorationLine: 'underline',
},
section: {
display: 'flex',
flexDirection: 'column',
marginBottom: 72,
},
});
export default App;