-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Xavier Carpentier
committed
Jun 1, 2016
1 parent
c5dc48b
commit 95918f5
Showing
6 changed files
with
249 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[**.js] | ||
indent_style = space | ||
indent_size = 2 | ||
quote_type = single | ||
space_after_anon_function = true | ||
curly_bracket_next_line = true | ||
brace_style = end-expand | ||
|
||
[**.jsx] | ||
indent_style = space | ||
indent_size = 2 | ||
quote_type = single | ||
space_after_anon_function = true | ||
curly_bracket_next_line = true | ||
brace_style = end-expand | ||
|
||
[**.css] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[**.html] | ||
indent_style = space | ||
indent_size = 4 | ||
max_char = 78 | ||
brace_style = expand | ||
|
||
[node_modules/**.js] | ||
codepaint = false | ||
|
||
[*.json] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"rules": { | ||
"indent": [ | ||
2, | ||
2, | ||
{"SwitchCase": 1} | ||
], | ||
"quotes": [ | ||
2, | ||
"single" | ||
], | ||
"linebreak-style": [ | ||
2, | ||
"unix" | ||
], | ||
"semi": [ | ||
2, | ||
"always" | ||
] | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"amd": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"ecmaFeatures": { | ||
"jsx": true, | ||
"experimentalObjectRestSpread": true, | ||
"modules": true, | ||
"async": true | ||
}, | ||
"plugins": [ | ||
"react" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.DS_Store | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
/node_modules | ||
|
||
# Xcode | ||
*.xcuserstate | ||
examples/ios/swiper.xcodeproj/project.xcworkspace/ | ||
examples/ios/swiper.xcodeproj/xcuserdata | ||
|
||
# IntelliJ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.DS_Store | ||
logs | ||
*.log | ||
pids | ||
*.pid | ||
*.seed | ||
lib-cov | ||
coverage | ||
.lock-wscript | ||
build/Release | ||
node_modules | ||
res | ||
examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# react-native-country-picker-modal | ||
|
||
[![npm version](http://img.shields.io/npm/dm/react-native-country-picker-modal.svg?style=flat-square)](https://npmjs.org/package/react-native-country-picker-modal "View this project on npm") | ||
|
||
The best Country Picker for React Native. | ||
|
||
![](http://i.imgur.com/WF4sdT7.gif) | ||
|
||
### Installation | ||
```bash | ||
$ npm i react-native-country-picker-modal --save | ||
``` | ||
### Basic Usage | ||
- Install `react-native` first | ||
|
||
```bash | ||
$ npm i react-native -g | ||
``` | ||
|
||
- Initialization of a react-native project | ||
|
||
```bash | ||
$ react-native init myproject | ||
``` | ||
|
||
- Then, edit `myproject/index.ios.js`, like this: | ||
|
||
```jsx | ||
'use strict'; | ||
import React, { | ||
AppRegistry, | ||
Component, | ||
StyleSheet, | ||
Text, | ||
View, | ||
StatusBarIOS, | ||
PixelRatio | ||
} from 'react-native'; | ||
|
||
import CountryPicker from 'react-native-country-picker-modal'; | ||
|
||
class Example extends Component { | ||
constructor(props){ | ||
StatusBarIOS.setHidden(true); | ||
super(props); | ||
this.state = { | ||
cca2: 'US' | ||
}; | ||
} | ||
render() { | ||
return ( | ||
<View style={styles.container}> | ||
<Text style={styles.welcome}> | ||
Welcome to Country Picker ! | ||
</Text> | ||
<CountryPicker | ||
onChange={(value)=> this.setState({country: value})} | ||
cca2={this.state.cca2} | ||
translation='eng' | ||
/> | ||
<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> | ||
); | ||
} | ||
} | ||
|
||
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' | ||
} | ||
}); | ||
|
||
AppRegistry.registerComponent('example', () => Example); | ||
``` | ||
|
||
## Contribution | ||
|
||
- [@xcapentier](mailto:contact@xaviercarpentier.com) The main author. | ||
|
||
## Questions | ||
|
||
Feel free to [contact me](mailto:contact@xaviercarpentier.com) or [create an issue](https://github.com/xcarpentier/react-native-country-picker/issues/new) | ||
|
||
> made with ♥ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters