Skip to content

Commit

Permalink
chore: create example project
Browse files Browse the repository at this point in the history
  • Loading branch information
mrnkr committed Dec 15, 2022
1 parent 88f11a7 commit 858d869
Show file tree
Hide file tree
Showing 10 changed files with 6,750 additions and 0 deletions.
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/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/

# macOS
.DS_Store
94 changes: 94 additions & 0 deletions example/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import React, { useCallback, useState } from 'react';
import { Platform, StyleSheet, Button, Text, View, TouchableOpacity } from 'react-native';
import { FancyAlert } from 'react-native-expo-fancy-alerts';
import Ionicons from '@expo/vector-icons/Ionicons';

export default function App() {
const [alertVisible, setAlertVisible] = useState(false);

const handlePress = useCallback(() => {
setAlertVisible(true);
}, []);

const handleClose = useCallback(() => {
setAlertVisible(false);
}, []);

return (
<View style={styles.container}>
<FancyAlert
style={styles.alert}
icon={
<View style={[ styles.icon, { borderRadius: 32 } ]}>
<Ionicons
name={Platform.select({ ios: 'ios-close', android: 'md-close' })}
size={36}
color="#FFFFFF"
/>
</View>
}
onRequestClose={handleClose}
visible={alertVisible}
>
<View style={styles.content}>
<Text style={styles.contentText}>Failed Successfully</Text>
<TouchableOpacity style={styles.btn} onPress={handleClose}>
<Text style={styles.btnText}>Okay :(</Text>
</TouchableOpacity>
</View>
</FancyAlert>

<Button
onPress={handlePress}
title="Show Alert"
/>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
alert: {
backgroundColor: '#EEEEEE',
},
icon: {
flex: 1,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#C3272B',
width: '100%',
},
content: {
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
marginTop: -16,
marginBottom: 16,
},
contentText: {
textAlign: 'center',
},
btn: {
borderRadius: 32,
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 8,
paddingVertical: 8,
alignSelf: 'stretch',
backgroundColor: '#C3272B',
marginTop: 16,
paddingHorizontal: 16,
},
btnText: {
color: '#FFFFFF',
},
});
33 changes: 33 additions & 0 deletions example/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"expo": {
"name": "example",
"slug": "example",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
Binary file added example/assets/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Binary file added example/assets/splash.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'],
};
};
22 changes: 22 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "example",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"expo": "~47.0.8",
"expo-status-bar": "~1.4.2",
"react": "18.1.0",
"react-native": "0.70.5",
"react-native-expo-fancy-alerts": "file:.."
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
Loading

0 comments on commit 858d869

Please sign in to comment.