Skip to content

Commit

Permalink
feat(expo): add expo example
Browse files Browse the repository at this point in the history
  • Loading branch information
xcarpentier committed Oct 18, 2017
1 parent 752fb3a commit 5ab2eba
Show file tree
Hide file tree
Showing 10 changed files with 4,191 additions and 11 deletions.
8 changes: 8 additions & 0 deletions example/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}
3 changes: 3 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/**/*
.expo/*
npm-debug.*
1 change: 1 addition & 0 deletions example/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
60 changes: 60 additions & 0 deletions example/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React from 'react'
import { StyleSheet, Text, View, PixelRatio } from 'react-native'
import CountryPicker from 'react-native-country-picker-modal'

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10
},
instructions: {
fontSize: 12,
textAlign: 'center',
color: '#888',
marginBottom: 5
},
data: {
padding: 15,
marginTop: 10,
backgroundColor: '#ddd',
borderColor: '#888',
borderWidth: 1 / PixelRatio.get(),
color: '#777'
}
})

export default class App extends React.Component {
constructor(props) {
super(props)
this.state = {
cca2: 'FR',
callingCode: ''
}
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to Country Picker !</Text>
<CountryPicker
onChange={value => {
this.setState({ cca2: value.cca2, callingCode: value.callingCode })
}}
cca2={this.state.cca2}
filterable
/>
<Text style={styles.instructions}>press on the flag</Text>
{this.state.country && (
<Text style={styles.data}>
{JSON.stringify(this.state.country, null, 2)}
</Text>
)}
</View>
)
}
}
22 changes: 22 additions & 0 deletions example/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"expo": {
"name": "example",
"description": "An empty new project",
"slug": "example",
"privacy": "public",
"sdkVersion": "21.0.0",
"version": "1.0.0",
"orientation": "portrait",
"primaryColor": "#cccccc",
"icon": "./assets/icons/app-icon.png",
"loading": {
"icon": "./assets/icons/loading-icon.png"
},
"packagerOpts": {
"assetExts": ["ttf", "mp4"]
},
"ios": {
"supportsTablet": true
}
}
}
Binary file added example/assets/icons/app-icon.png
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/icons/loading-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "example",
"version": "0.0.0",
"description": "Hello Expo!",
"author": null,
"private": true,
"main": "node_modules/expo/AppEntry.js",
"dependencies": {
"expo": "^21.0.0",
"react": "16.0.0-alpha.12",
"react-native": "https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz",
"react-native-country-picker-modal": "^0.3.0"
}
}

0 comments on commit 5ab2eba

Please sign in to comment.