react-native在IOS上集成百度地图详解

export default class BaiDuMapTest extends Component {

render() {

return (

);

}

}

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,

},

});

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

BaiduMapDemo.js

/**

  • @author lovebing

*/

import React, {

Component,

PropTypes

} from 'react';

import {

MapView,

MapTypes,

Geolocation

} from 'react-native-baidu-map';

import {

Button,

AppRegistry,

StyleSheet,

Text,

View,

TouchableHighlight

} from 'react-native';

import Dimensions from 'Dimensions';

export default class BaiduMapDemo extends Component {

constructor() {

super();

this.state = {

mayType: MapTypes.NORMAL,

zoom: 15,

center: {

longitude: 113.981718,

latitude: 22.542449

},

trafficEnabled: false,

baiduHeatMapEnabled: false,

markers: [{

longitude: 113.981718,

latitude: 22.542449,

title: "Window of the world"

},{

longitude: 113.995516,

latitude: 22.537642,

title: ""

}]

};

}

componentDidMount() {

}

render() {

return (

<MapView

trafficEnabled={this.state.trafficEnabled}

baiduHeatMapEnabled={this.state.baiduHeatMapEnabled}

zoom={this.state.zoom}

mapType={this.state.mapType}

center={this.state.center}

marker={this.state.marker}

markers={this.state.markers}

style={styles.map}

onMarkerClick={(e) => {

console.warn(JSON.stringify(e));

}}

onMapClick={(e) => {

}}

<Button title="Normal" onPress={() => {

this.setState({

mapType: MapTypes.NORMAL

});

}} />

<Button style={styles.btn} title="Satellite" onPress={() => {

this.setState({

mapType: MapTypes.SATELLITE

});

}} />

<Button style={styles.btn} title="Locate" onPress={() => {

console.warn('center', this.state.center);

Geolocation.getCurrentPosition()

.then(data => {

console.warn(JSON.stringify(data));

this.setState({

zoom: 15,

marker: {

latitude: data.latitude,

longitude: data.longitude,

title: 'Your location'

},

center: {

latitude: data.latitude,

longitude: data.longitude,

rand: Math.random()

}

});

})

.catch(e =>{

console.warn(e, 'error');

})

}} />

<Button title="Zoom+" onPress={() => {

this.setState({

zoom: this.state.zoom + 1

});

}} />

<Button title="Zoom-" onPress={() => {

if(this.state.zoom > 0) {

this.setState({

zoom: this.state.zoom - 1

});

}

}} />

<Button title="Traffic" onPress={() => {

this.setState({

trafficEnabled: !this.state.trafficEnabled

});

}} />

<Button title="Baidu HeatMap" onPress={() => {

this.setState({

baiduHeatMapEnabled: !this.state.baiduHeatMapEnabled

});

}} />

);

}

}

const styles = StyleSheet.create({

row: {

flexDirection: 'row',

height: 40

},

container: {

flex: 1,

justifyContent: 'flex-start',

web浏览器中的javascript

  • 客户端javascript
  • 在html里嵌入javascript
  • javascript程序的执行
  • 兼容性和互用性
  • 可访问性
  • 安全性
  • 客户端框架

window对象

  • 计时器

  • 浏览器定位和导航

  • 浏览历史

  • 浏览器和屏幕信息

  • 对话框

  • 错误处理

  • 作为window对象属性的文档元素

相关推荐
加油乐3 小时前
解决 iOS 端输入框聚焦时页面上移问题
前端·javascript·ios
电话交换机IPPBX-3CX8 小时前
电话交换机软件 3CX iOS 应用 V5.4 Beta 更新
ios·软件更新·ip pbx·电话交换机
初遇你时动了情15 小时前
uniapp/flutter中实现苹果IOS 26 毛玻璃效果、跟随滑动放大动画
flutter·ios·uni-app
2501_9160074718 小时前
Fastlane 结合 开心上架(Appuploader)命令行实现跨平台上传发布 iOS App 的完整方案
android·ios·小程序·https·uni-app·iphone·webview
CV大师杨某18 小时前
如何在uni-app中禁用iOS橡皮筋效果?
ios·uni-app
2501_9159184121 小时前
iOS 上架应用市场全流程指南,App Store 审核机制、证书管理与跨平台免 Mac 上传发布方案(含开心上架实战)
android·macos·ios·小程序·uni-app·cocoa·iphone
C_philadd1 天前
Xcode26升级以后重要
ios
2501_915909061 天前
HTTPS 错误排查实战,从握手到应用层的工程化流程
网络协议·http·ios·小程序·https·uni-app·iphone
美狐美颜sdk1 天前
跨平台直播美颜sdk集成攻略:Android、iOS与Web的统一方案
android·前端·ios
2501_915106322 天前
“HTTPS Everywhere” 的工程化实践,从全面加密到排查与真机取证
网络协议·http·ios·小程序·https·uni-app·iphone