Commit f3f4f6c3 authored by Qiu Xiang's avatar Qiu Xiang

提供 OnInfoWindowPress 失效时的解决方案

parent ceb0acce
......@@ -107,6 +107,7 @@ export default class Marker extends Component {
/**
* 信息窗体点击事件
* 使用自定义 View 会使该事件失效,这时候可以用 Touchable* 代替
*/
onInfoWindowPress: React.PropTypes.func,
}
......
import React, {Component} from 'react'
import {StyleSheet, Alert, Text, Image, View} from 'react-native'
import {
StyleSheet,
Alert,
Text,
Image,
View,
TouchableOpacity,
} from 'react-native'
import {MapView, Marker} from 'react-native-amap3d'
export default class MarkerExample extends Component {
......@@ -44,9 +51,11 @@ export default class MarkerExample extends Component {
latitude: 39.806901,
longitude: 116.297972,
}}>
<View style={styles.customInfoWindow}>
<Text>Custom View InfoWindow</Text>
</View>
<TouchableOpacity activeOpacity={0.9} onPress={() => Alert.alert('Custom View InfoWindow onPress')}>
<View style={styles.customInfoWindow}>
<Text>Custom View InfoWindow</Text>
</View>
</TouchableOpacity>
</Marker>
<Marker
icon={() =>
......
......@@ -107,7 +107,7 @@
_callout = (AMapOverlay *) subview;
_callout.delegate = self;
UIButton *button = [[UIButton alloc] initWithFrame:CGRectZero];
UIButton *button = [UIButton new];
[button addSubview:_callout];
_annotationView.customCalloutView = [[MACustomCalloutView alloc] initWithCustomView:button];
......
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