av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

創(chuàng)新互聯(lián)React教程:定位

你需要在 info.plist 中添加 NSLocationWhenInUseUsageDescription 鍵來定位,當你用 react-native init 來創(chuàng)建一個項目時,默認情況下定位是能夠使用的。

創(chuàng)新互聯(lián)主要從事做網(wǎng)站、網(wǎng)站制作、網(wǎng)頁設計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務。立足成都服務東至,十年網(wǎng)站建設經(jīng)驗,價格優(yōu)惠、服務專業(yè),歡迎來電咨詢建站服務:028-86922220

定位遵循 MDN 規(guī)范:
https://developer.mozilla.org/en-US/docs/Web/API/Geolocation

方法

static getCurrentPosition(geo_success: Function, geo_error?: Function, geo_options?: Object)

static watchPosition(success: Function, error?: Function, options?: Object)

static clearWatch(watchID: number)

static stopObserving()

例子

Edit on GitHub

/* eslint no-console: 0 */'use strict';var React = require('react-native');var {
  StyleSheet,
  Text,
  View,
} = React;
exports.framework = 'React';
exports.title = 'Geolocation';
exports.description = 'Examples of using the Geolocation API.';
exports.examples = [
  {
    title: 'navigator.geolocation',
    render: function(): ReactElement {      return ;
    },
  }
];var GeolocationExample = React.createClass({
  watchID: (null: ?number),
  getInitialState: function() {    return {
      initialPosition: 'unknown',
      lastPosition: 'unknown',
    };
  },
  componentDidMount: function() {
    navigator.geolocation.getCurrentPosition(
      (initialPosition) => this.setState({initialPosition}),
      (error) => console.error(error)
    );    this.watchID = navigator.geolocation.watchPosition((lastPosition) => {      this.setState({lastPosition});
    });
  },
  componentWillUnmount: function() {
    navigator.geolocation.clearWatch(this.watchID);
  },
  render: function() {    return (      
        
          Initial position: 
          {JSON.stringify(this.state.initialPosition)}        
        
          Current position: 
          {JSON.stringify(this.state.lastPosition)}        
      
    );
  }
});var styles = StyleSheet.create({
  title: {
    fontWeight: '500',
  },
});


網(wǎng)頁題目:創(chuàng)新互聯(lián)React教程:定位
網(wǎng)頁URL:http://uogjgqi.cn/article/dhpsppg.html
掃二維碼與項目經(jīng)理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流