-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathApp.js
More file actions
65 lines (61 loc) · 1.7 KB
/
Copy pathApp.js
File metadata and controls
65 lines (61 loc) · 1.7 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, { useState } from 'react';
import { StyleSheet, Text, View, Switch } from 'react-native';
import MakeItRain from './react-native-make-it-rain';
import CashMoney from './assets/cashMoney';
export default function App() {
const [isConfetti, setIsConfetti] = useState(true);
const toggleSwitch = () => setIsConfetti(previousState => !previousState);
return (
<View style={styles.container}>
<Text style={styles.font}>Make It Rain</Text>
{ isConfetti ?
<MakeItRain
numItems={100}
itemComponent={<Text>🤍</Text>}
itemTintStrength={0.8}
/>
:
<MakeItRain
numItems={50}
itemDimensions={{width: 200, height: 100}}
itemComponent={<CashMoney width={200} height={100}/>}
itemColors={['#ffffff00']}
flavor={"rain"}
/>
}
<View style={styles.switchRow}>
<Text style={styles.font}>rain</Text>
<Switch
style={styles.switch}
trackColor={{ false: "#767577", true: "#81b0ff" }}
thumbColor={isConfetti ? "#f5dd4b" : "#f4f3f4"}
ios_backgroundColor="#3e3e3e"
onValueChange={toggleSwitch}
value={isConfetti}
/>
<Text style={styles.font}>arrive</Text>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'space-around',
},
switchRow: {
flexDirection: 'row',
paddingVertical: 30,
alignItems: 'center',
justifyContent: 'center',
},
font: {
fontSize: 40,
},
switch: {
marginHorizontal: 20,
transform: [{ scaleX: 2 }, { scaleY: 2 }]
}
});