react-native-mapa是一款开源的React Native地图组件,支持iOS和Android。
react-native-mapa面向开源,我们欢迎任何感兴趣的开发者加入社区, 进入留言区。
react-native-mapa底层依赖mapbox,因此需要提供Mapbox Access Token
。
- node
- npm
- React Native (0.70+)
查看安装文档Installation
# YARN
yarn run ios
# NPM
npm run ios
# YARN
yarn run android
# NPM
npm run android
import Mapa from 'react-native-mapa';
import {SafeAreaView, StyleSheet} from 'react-native';
import React from 'react';
Mapa.setAccessToken(
'pk.XXX',
);
function Mapview({}: any): React.JSX.Element {
return (
<SafeAreaView style={styles.container}>
<Mapa.MapView>
<Mapa.Camera />
<Mapa.Compass />
</Mapa.MapView>
</SafeAreaView>
);
}
export default Mapview;
const styles = StyleSheet.create({
container: {
height: '100%',
},
});