Commit ab76c214 authored by 7c00's avatar 7c00

Update readme

parent db3850ff
...@@ -140,7 +140,20 @@ const coordinate = { ...@@ -140,7 +140,20 @@ const coordinate = {
</MapView.Marker> </MapView.Marker>
``` ```
[更多示例](https://github.com/qiuxiang/react-native-amap3d/tree/master/example/examples) ### 更多示例
[examples](https://github.com/qiuxiang/react-native-amap3d/tree/master/example/examples)
#### Android
```bash
$ yarn
$ yarn run-android
```
#### iOS
```bash
$ yarn
$ cd ios && pod install && cd ..
$ yarn run-ios
```
## 接口 ## 接口
......
...@@ -68,9 +68,9 @@ export default class MarkerExample extends Component { ...@@ -68,9 +68,9 @@ export default class MarkerExample extends Component {
}, },
] ]
_onInfoWindowPress = () => Alert.alert('信息窗口点击事件') _onMarkerPress = () => Alert.alert('onPress')
_onCustomInfoWindowPress = () => Alert.alert('自定义信息窗口点击事件') _onInfoWindowPress = () => Alert.alert('onInfoWindowPress')
_onDragEvent = ({ nativeEvent }) => Alert.alert(`新坐标:${nativeEvent.latitude}, ${nativeEvent.longitude}`) _onDragEvent = ({ nativeEvent }) => Alert.alert(`${nativeEvent.latitude}, ${nativeEvent.longitude}`)
render() { render() {
return ( return (
...@@ -85,7 +85,7 @@ export default class MarkerExample extends Component { ...@@ -85,7 +85,7 @@ export default class MarkerExample extends Component {
coordinate={this._coordinates[0]} coordinate={this._coordinates[0]}
/> />
<MapView.Marker color="green" coordinate={this._coordinates[1]} > <MapView.Marker color="green" coordinate={this._coordinates[1]} >
<TouchableOpacity activeOpacity={0.9} onPress={this._onCustomInfoWindowPress}> <TouchableOpacity activeOpacity={0.9} onPress={this._onInfoWindowPress}>
<View style={styles.customInfoWindow}> <View style={styles.customInfoWindow}>
<Text>自定义信息窗口</Text> <Text>自定义信息窗口</Text>
<Text>{this.state.time.toLocaleTimeString()}</Text> <Text>{this.state.time.toLocaleTimeString()}</Text>
...@@ -95,6 +95,7 @@ export default class MarkerExample extends Component { ...@@ -95,6 +95,7 @@ export default class MarkerExample extends Component {
<MapView.Marker <MapView.Marker
image="flag" image="flag"
title="自定义图片" title="自定义图片"
onPress={this._onMarkerPress}
coordinate={this._coordinates[2]} coordinate={this._coordinates[2]}
/> />
<MapView.Marker <MapView.Marker
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment