|
1 | 1 | import React from 'react' |
2 | | -import { StyleSheet, View } from 'react-native' |
3 | | -import { Plane } from 'react-native-animated-spinkit' |
| 2 | +import { View, StatusBar, Text, StyleSheet } from 'react-native' |
| 3 | +import { |
| 4 | + Plane, |
| 5 | + Chase, |
| 6 | + Bounce, |
| 7 | + Wave, |
| 8 | + Wander, |
| 9 | + Pulse, |
| 10 | + Flow, |
| 11 | + Circle, |
| 12 | + Grid, |
| 13 | + CircleFade, |
| 14 | + Fold, |
| 15 | + Swing, |
| 16 | +} from 'react-native-animated-spinkit' |
| 17 | + |
| 18 | +const spinners = [ |
| 19 | + { component: Plane, backgroundColor: '#d35400' }, |
| 20 | + { component: Chase, backgroundColor: '#2c3e50' }, |
| 21 | + { component: Bounce, backgroundColor: '#1abc9c' }, |
| 22 | + { component: Wave, backgroundColor: '#2980b9' }, |
| 23 | + { component: Wander, backgroundColor: '#7f8c8d' }, |
| 24 | + { component: Pulse, backgroundColor: '#ffcb65' }, |
| 25 | + { component: Swing, backgroundColor: '#d35400' }, |
| 26 | + { component: Flow, backgroundColor: '#27ae60' }, |
| 27 | + { component: Circle, backgroundColor: '#d35400' }, |
| 28 | + { component: Grid, backgroundColor: '#2c3e50' }, |
| 29 | + { component: CircleFade, backgroundColor: '#1abc9c' }, |
| 30 | + { component: Fold, backgroundColor: '#2980b9' }, |
| 31 | +] |
4 | 32 |
|
5 | 33 | export default function App() { |
6 | 34 | return ( |
7 | 35 | <View style={styles.container}> |
8 | | - <Plane /> |
| 36 | + <StatusBar barStyle="light-content" /> |
| 37 | + {Array(Math.round(spinners.length / 3)) |
| 38 | + .fill(null) |
| 39 | + .map((_, rowIndex) => ( |
| 40 | + <View key={rowIndex} style={styles.row}> |
| 41 | + {spinners |
| 42 | + .slice(rowIndex * 3, rowIndex * 3 + 3) |
| 43 | + .map((spinner, index) => { |
| 44 | + const Spinner = spinner.component |
| 45 | + return ( |
| 46 | + <View |
| 47 | + style={[ |
| 48 | + styles.cell, |
| 49 | + { |
| 50 | + backgroundColor: spinner.backgroundColor, |
| 51 | + }, |
| 52 | + ]} |
| 53 | + key={index} |
| 54 | + > |
| 55 | + <Spinner color="#FFF" /> |
| 56 | + <Text style={styles.componentLabel}> |
| 57 | + {`<${spinner.component.name} \/>`} |
| 58 | + </Text> |
| 59 | + </View> |
| 60 | + ) |
| 61 | + })} |
| 62 | + </View> |
| 63 | + ))} |
9 | 64 | </View> |
10 | 65 | ) |
11 | 66 | } |
12 | 67 |
|
13 | 68 | const styles = StyleSheet.create({ |
14 | 69 | container: { |
15 | 70 | flex: 1, |
16 | | - backgroundColor: '#fff', |
| 71 | + }, |
| 72 | + componentLabel: { |
| 73 | + position: 'absolute', |
| 74 | + bottom: 14, |
| 75 | + color: '#FFF', |
| 76 | + fontWeight: 'bold', |
| 77 | + opacity: 0.7, |
| 78 | + }, |
| 79 | + row: { |
| 80 | + flexDirection: 'row', |
| 81 | + flex: 1, |
| 82 | + }, |
| 83 | + cell: { |
| 84 | + flex: 1, |
17 | 85 | alignItems: 'center', |
18 | 86 | justifyContent: 'center', |
19 | 87 | }, |
|
0 commit comments