一个 Map 组件,在 iOS 上用 Apple Maps, Android 上用 Google Maps。由 Airbnb 创建: airbnb/react-native-maps. 在 Exponent app 里用不需要任何设置,在 iOS standalone app 里用也不需要。下面有具体步骤详细说明怎么发布 Android standalone app。
import React from 'react';
import { Components } from 'exponent';
export default class HomeScreen extends React.Component {
static route = {
navigationBar: {
visible: false,
},
}
render() {
return (
<Components.MapView
style={{flex: 1}}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
/>
);
}
}
Exponent.Components.
MapView
¶完整文档在: airbnb/react-native-maps.
keytool -list -printcert -jarfile growler.apk | grep SHA1 | awk '{ print $2 }'
(替换 growler.apk
为第 1 步生成的apk).exp.json
, 添加 api key 到 android.config.googleMaps.apiKey
字段. See an example diff.不需要特殊的配置。