安卓scrollview包含地图控件,上下滑动的时候手势冲突
安卓scrollview包含地图控件,上下滑动的时候手势冲突 代码结构如下 <ScrollView style={{flex:1}} scrollEventThrottle={50}> <MapView showsIndoorMap showsCompass={false} zoomLevel={15} coordinate={{ latitude: this.state.latitudeChoose?this.state.latitudeChoose:this.state.latitude, longitude: this.state.longitudeChoose?this.state.longitudeChoose:this.state.longitude, }} style={styles.map}> <MapView.Marker title='我在这里' coordinate={{ latitude: this.state.latitude, longitude: this.state.longitude, }} > </MapView.Marker>
请问解决了吗?遇到了同样的问题
没有,后面调整了UI
------------------ 原始邮件 ------------------ 发件人: "淡淡蓝蓝"<[email protected]>; 发送时间: 2020年3月19日(星期四) 上午10:36 收件人: "qiuxiang/react-native-amap3d"<[email protected]>; 抄送: "张志坚"<[email protected]>; "Author"<[email protected]>; 主题: Re: [qiuxiang/react-native-amap3d] 安卓scrollview包含地图控件,上下滑动的时候手势冲突 (#565)
请问解决了吗?遇到了同样的问题
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
好的,我也调整一下ui试试
我也遇到了 可以在不调整 UI 的情况下解决吗
我也遇到了 可以在不调整 UI 的情况下解决吗
你好,最后用react-native的PanResponder解决了,阻止事件的冒泡。在
componentWillMount(){
this._gestureHandlers = PanResponder.create({
onStartShouldSetPanResponder: (evt, gestureState) => true,
onStartShouldSetPanResponderCapture: (evt, gestureState) => true,
onMoveShouldSetPanResponder: (evt, gestureState) => true,
onMoveShouldSetPanResponderCapture: (evt, gestureState) => true,
onPanResponderTerminationRequest: (evt, gestureState) => true,
});
}
然后在MapView中
<MapView
{...this._gestureHandlers.panHandlers}
..../>
@chenyumiao 谢谢 真的可以