content: /**
   * Created by Liyazhou on 16/9/7.
   */
  
  import React from 'react';
  import {
      AppRegistry,
      View,
      StyleSheet,
      TouchableOpacity,
      Text,
      PixelRatio,
      AlertIOS
  } from 'react-native';
  
  export default class Index extends React.Component {
      render() {
          return (
              <View style={[styles.container, styles.center]}>
                  <TouchableOpacity onPress={()=>this._getData()}>
                      <View style={[styles.btn, styles.center]}>
                          <Text style={{fontWeight:'bold',fontSize:14,}}>访问</Text>
                      </View>
                  </TouchableOpacity>
              </View>
          );
      }
  
      // 私有方法
      _getData() {
          fetch('http://restapi.amap.com/v3/place/text?keywords=北京大学&city=beijing&offset=2&key=98cd4d3c1c2865132e73d851654c9c1b')
              .then(response=>response.text())
              .then(responseText=>{
                  AlertIOS.alert("成功" + JSON.parse(responseText));
              })
              .catch(err=>{
                  AlertIOS.alert("出错" + err);
              });
      }
  }
  
  const styles = StyleSheet.create({
      container:{
          flex:1,
          backgroundColor:'#ddd',
      },
      center:{
          justifyContent:'center',
          alignItems:'center',
      },
      btn:{
          backgroundColor:'#999',
          borderColor:'red',
          borderWidth:2/PixelRatio.get(),
          borderRadius:4,
          height:38,
          width:70,
      }
  });