在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ HTML/ Map 視圖
JavaScript 環(huán)境
計時器
Native 模塊(iOS)
入門
在設(shè)備上運(yùn)行
ProgressBarAndroid
iOS 應(yīng)用程序狀態(tài)
網(wǎng)絡(luò)
ToolbarAndroid
測試
輔助功能
網(wǎng)絡(luò)信息
DrawerLayoutAndroid
樣式表
手勢應(yīng)答系統(tǒng)
與現(xiàn)有的應(yīng)用程序集成
樣式
教程
不透明觸摸
調(diào)試 React Native 應(yīng)用
iOS 活動指示器
導(dǎo)航器
無反饋觸摸
動畫布局
Web 視圖
鏈接庫
像素比率
React Native 官網(wǎng)首頁介紹
iOS 導(dǎo)航器
交互管理器
全景響應(yīng)器
SwitchAndroid
TabBarIOS.Item
相機(jī)滾動
ToastAndroid
iOS 震動
BackAndroid
文本輸入
iOS 選擇器
應(yīng)用程序注冊表
iOS 開關(guān)
滾動視圖
iOS 日期選擇器
iOS 警告
iOS 鏈接
視圖
圖片
列表視圖
異步存儲
Native UI 組件(Android)
iOS 滑塊
Map 視圖
高亮觸摸
iOS 推送通知
文本
定位
iOS 狀態(tài)欄
Native UI 組件(iOS)
在設(shè)備上運(yùn)行(Android)
Native 模塊(Android)
Flexbox
已知 Issues
iOS 選項卡
安裝 Android 運(yùn)行環(huán)境

Map 視圖

Props

Edit on GitHub

legalLabelInsets {頂部:數(shù)字型;左部:數(shù)字型;底部:數(shù)字型;右部:數(shù)字型}

為 map 嵌入合法的標(biāo)簽,最初是在 map 的左下角。更多信息請看 EdgeInsetsPropType.js

maxDelta 數(shù)字型

能夠顯示的區(qū)域的最大尺寸。

minDelta 數(shù)字型

能夠顯示的區(qū)域的最小尺寸。

onRegionChange 函數(shù)型

當(dāng)用戶拖動 map 時,會不斷地調(diào)用回調(diào)函數(shù)。

onRegionChangeComplete 函數(shù)型

當(dāng)用戶完成移動 map 時,調(diào)用一次回調(diào)函數(shù)。

pitchEnabled 布爾型

當(dāng)這個屬性設(shè)置為 true,且有效的相機(jī)與 map 相關(guān)聯(lián),那么相機(jī)的螺旋角用于傾斜 map 的平面。當(dāng)這個屬性設(shè)置為 false 時,相機(jī)的螺旋角被忽略,并且 map 上總是顯示為好像用戶直接向下看。

region {緯度:數(shù)字型,經(jīng)度:數(shù)字型,latitudeDelta:數(shù)字型,longitudeDelta:數(shù)字型}

該地區(qū)會被 map 顯示出來。

由中心坐標(biāo)和坐標(biāo)跨度定義的區(qū)域顯示出來。

rotateEnabled 布爾型

當(dāng)這個屬性設(shè)置為 true,且有效的相機(jī)與 map 相關(guān)聯(lián),那么相機(jī)的航向角用于圍繞 map 中心點(diǎn)旋轉(zhuǎn) map 平面。當(dāng)該屬性設(shè)置為 false 時,相機(jī)的航向角被忽略,map 總是定向的,這樣真正的北方就會位于 map 視圖的頂部。

scrollEnabled 布爾型

如果是 false,用戶無法更改 map 顯示的區(qū)域。默認(rèn)值是 true。

showsUserLocation 布爾型

如果是 true,應(yīng)用程序會請求用戶的位置并關(guān)注它。默認(rèn)值是 false。

注意:為了獲取地理位置,你需要添加把 NSLocationWhenInUseUsageDescription 鍵添加到 info.plist,否則就會失敗!

style View#style

用于 MapView 的樣式設(shè)置和布局。更多信息請看 StyleSheet.jsViewStylePropTypes.js

zoomEnabled 布爾型

如果是 false,用戶無法縮小/放大 map。默認(rèn)值是 true。

例子

Edit on GitHub

'use strict';
var React = require('react-native');
var StyleSheet = require('StyleSheet');
var {
  MapView,
  Text,
  TextInput,
  View,
} = React;
var MapRegionInput = React.createClass({
  propTypes: {
    region: React.PropTypes.shape({
      latitude: React.PropTypes.number,
      longitude: React.PropTypes.number,
      latitudeDelta: React.PropTypes.number,
      longitudeDelta: React.PropTypes.number,
    }),
    onChange: React.PropTypes.func.isRequired,
  },
  getInitialState: function() {
    return {
      latitude: 0,
      longitude: 0,
      latitudeDelta: 0,
      longitudeDelta: 0,
    };
  },
  componentWillReceiveProps: function(nextProps) {
    this.setState(nextProps.region);
  },
  render: function() {
    var region = this.state;
    return (
      <View>
        <View style={styles.row}>
          <Text>
            {'Latitude'}
          </Text>
          <TextInput
            value={'' + region.latitude}
            style={styles.textInput}
            onChange={this._onChangeLatitude}
          />
        </View>
        <View style={styles.row}>
          <Text>
            {'Longitude'}
          </Text>
          <TextInput
            value={'' + region.longitude}
            style={styles.textInput}
            onChange={this._onChangeLongitude}
          />
        </View>
        <View style={styles.row}>
          <Text>
            {'Latitude delta'}
          </Text>
          <TextInput
            value={'' + region.latitudeDelta}
            style={styles.textInput}
            onChange={this._onChangeLatitudeDelta}
          />
        </View>
        <View style={styles.row}>
          <Text>
            {'Longitude delta'}
          </Text>
          <TextInput
            value={'' + region.longitudeDelta}
            style={styles.textInput}
            onChange={this._onChangeLongitudeDelta}
          />
        </View>
        <View style={styles.changeButton}>
          <Text onPress={this._change}>
            {'Change'}
          </Text>
        </View>
      </View>
    );
  },
  _onChangeLatitude: function(e) {
    this.setState({latitude: parseFloat(e.nativeEvent.text)});
  },
  _onChangeLongitude: function(e) {
    this.setState({longitude: parseFloat(e.nativeEvent.text)});
  },
  _onChangeLatitudeDelta: function(e) {
    this.setState({latitudeDelta: parseFloat(e.nativeEvent.text)});
  },
  _onChangeLongitudeDelta: function(e) {
    this.setState({longitudeDelta: parseFloat(e.nativeEvent.text)});
  },
  _change: function() {
    this.props.onChange(this.state);
  },
});
var MapViewExample = React.createClass({
  getInitialState() {
    return {
      mapRegion: null,
      mapRegionInput: null,
    };
  },
  render() {
    return (
      <View>
        <MapView
          style={styles.map}
          onRegionChange={this._onRegionChanged}
          region={this.state.mapRegion}
        />
        <MapRegionInput
          onChange={this._onRegionInputChanged}
          region={this.state.mapRegionInput}
        />
      </View>
    );
  },
  _onRegionChanged(region) {
    this.setState({mapRegionInput: region});
  },
  _onRegionInputChanged(region) {
    this.setState({
      mapRegion: region,
      mapRegionInput: region,
    });
  },
});
var styles = StyleSheet.create({
  map: {
    height: 150,
    margin: 10,
    borderWidth: 1,
    borderColor: '#000000',
  },
  row: {
    flexDirection: 'row',
    justifyContent: 'space-between',
  },
  textInput: {
    width: 150,
    height: 20,
    borderWidth: 0.5,
    borderColor: '#aaaaaa',
    fontSize: 13,
    padding: 4,
  },
  changeButton: {
    alignSelf: 'center',
    marginTop: 5,
    padding: 3,
    borderWidth: 0.5,
    borderColor: '#777777',
  },
});
exports.title = '<MapView>';
exports.description = 'Base component to display maps';
exports.examples = [
  {
    title: 'Map',
    render(): ReactElement { return <MapViewExample />; }
  },
  {
    title: 'Map shows user location',
    render() {
      return  <MapView style={styles.map} showsUserLocation={true} />;
    }
  }
];