Skip to content

Commit

Permalink
Add Example project
Browse files Browse the repository at this point in the history
  • Loading branch information
peacechen committed Apr 20, 2020
1 parent b9ee466 commit 918d1f6
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local.properties
#
node_modules/
npm-debug.log
example/ReactNativeCalendarStripExample/node_modules/
Example/react-native-make-it-rain/
package-lock.json
yarn.lock

Expand Down
14 changes: 14 additions & 0 deletions Example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node_modules/**/*
.expo/*
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
web-report/

# macOS
.DS_Store
65 changes: 65 additions & 0 deletions Example/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,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={25}
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 }]
}
});
28 changes: 28 additions & 0 deletions Example/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"expo": {
"name": "Make It Rain Example",
"slug": "Example",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/icon.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
}
}
}
1 change: 1 addition & 0 deletions assets/cashMoney.js → Example/assets/cashMoney.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
Stop
} from 'react-native-svg';

// Note: This SVG is offset to the right which prevents the tint overlay from aligning properly.
export default function CashMoney(props) {
return (
<Svg height="64px" id="Layer_1" width="64px" version="1.1" viewBox="0 0 64 64" xmlSpace="preserve" {...props}>
Expand Down
Binary file added Example/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Example/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
28 changes: 28 additions & 0 deletions Example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"cp": "cpx ../src/** react-native-make-it-rain -u",
"postinstall": "npm run cp",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~37.0.3",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-animatable": "^1.3.3",
"react-native-reanimated": "^1.8.0",
"react-native-svg": "11.0.1",
"react-native-web": "~0.11.7"
},
"devDependencies": {
"@babel/core": "^7.8.6",
"babel-preset-expo": "~8.1.0",
"cpx": "^1.5.0"
},
"private": true
}

0 comments on commit 918d1f6

Please sign in to comment.