This repository has been archived by the owner on Jul 2, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android package name changed, example app created
- Loading branch information
Talut TASGIRAN
committed
Jan 13, 2019
1 parent
c82455c
commit 0a8fa10
Showing
12 changed files
with
165 additions
and
95 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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.reactlibrary"> | ||
package="com.taluttasgiran"> | ||
|
||
</manifest> | ||
|
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
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 |
---|---|---|
@@ -1,49 +1,47 @@ | ||
/** | ||
* Sample React Native App | ||
* https://github.com/facebook/react-native | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
|
||
import React, {Component} from 'react'; | ||
import {Platform, StyleSheet, Text, View} from 'react-native'; | ||
import {Picker, StyleSheet, Text, View} from 'react-native'; | ||
import RNCountry from "react-native-countries"; | ||
|
||
const instructions = Platform.select({ | ||
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', | ||
android: | ||
'Double tap R on your keyboard to reload,\n' + | ||
'Shake or press menu button for dev menu', | ||
}); | ||
export default class App extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
countryCode: "TR" | ||
} | ||
} | ||
|
||
type Props = {}; | ||
export default class App extends Component<Props> { | ||
render() { | ||
return ( | ||
<View style={styles.container}> | ||
<Text style={styles.welcome}>Welcome to React Native!</Text> | ||
<Text style={styles.instructions}>To get started, edit App.js</Text> | ||
<Text style={styles.instructions}>{instructions}</Text> | ||
</View> | ||
); | ||
} | ||
} | ||
componentWillMount() { | ||
let countryNamesWithCodes = RNCountry.getCountryNamesWithCodes; | ||
countryNamesWithCodes.sort((a, b) => a.name.localeCompare(b.name)); | ||
this.setState({ | ||
countryNameListWithCode: countryNamesWithCodes | ||
}) | ||
} | ||
|
||
render() { | ||
return ( | ||
<View style={styles.container}> | ||
<Picker | ||
selectedValue={this.state.countryCode} | ||
style={styles.picker} | ||
onValueChange={(itemValue, itemIndex) => this.setState({countryCode: itemValue})}> | ||
{this.state.countryNameListWithCode.map((val) => { | ||
return <Picker.Item key={'country-item-' + val.code} label={val.name} value={val.code}/> | ||
})} | ||
</Picker> | ||
<Text>Selected Country Code: {this.state.countryCode}</Text> | ||
</View> | ||
) | ||
} | ||
} | ||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: '#F5FCFF', | ||
}, | ||
welcome: { | ||
fontSize: 20, | ||
textAlign: 'center', | ||
margin: 10, | ||
}, | ||
instructions: { | ||
textAlign: 'center', | ||
color: '#333333', | ||
marginBottom: 5, | ||
}, | ||
}); | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center' | ||
}, | ||
picker: { | ||
height: 50, | ||
width: 200 | ||
} | ||
}); |
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
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
rootProject.name = 'example' | ||
include ':react-native-countries' | ||
project(':react-native-countries').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-countries/android') | ||
|
||
include ':app' |
Oops, something went wrong.