Skip to content

zhaoandong/react-native-location-picker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-location-picker

中国境内省市县的选择框(支持IOS)

##用法 ###npm install react-native-location-picker --save ##截图

##实例

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} = React;

var LocationPicker = require('./example');

var Example = React.createClass({
  getInitialState: function(){
    return {
      data: '省 市 县',
      selectedOption:'北京 北京 东城区'
    }
  },
  render: function() {
    return (
      <View style={styles.title}>
        <Text style={styles.titleWord}>{this.state.data}</Text>
      <Text
          onPress={()=>{
              this.refs.picker.show();
          }}>
         {this.state.selectedOption}
      </Text>
        <LocationPicker ref={'picker'}
          onSubmit={(province,city,county)=>{
                this.setState({selectedOption: province+' '+city+' '+county})
          }}
        />
      </View>
    );
  }
});

var styles = StyleSheet.create({
  title: {
    height:48,
    // borderBottomColor:'rgba(0,0,0,0.1)',
    // borderBottomWidth:1,
    paddingLeft:40,
    paddingRight:40,
    justifyContent: 'center',
    justifyContent: 'space-between',
    flexDirection:'row',
    alignItems: 'center',
    flex:1
  },
  titleWord: {
    fontSize:14,
    color:'#999',
    flex:1
  },
  titleWordRight: {
    fontSize: 12,
    color:'#7a9999'
  },
  textInput: {
    flex:1
  }
});

AppRegistry.registerComponent('Example', () => Example);

About

这是中国的省市县选择器

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published