-
Notifications
You must be signed in to change notification settings - Fork 61
Description
In portrait mode, when the height of the three images (900) is less than the height of Dimensions.get('window').height, the onSingleTap click event returns a different event.nativeEvent.target for each image, which is correct.
But when the height of the three images (900) is greater than the height of Dimensions.get('window').height, clicking on the first image onSingleTap will return the same value as the third image?
This issue occurs when the ReactNativeZoomableView wrapper content height is greater than the contentHeight height.
The expectation is that when the image height exceeds the screen height, clicking on a different image Target will also return a different value。
This issue only appears on Android phones and iOS phones normally
react-native-zoomable-view v2.4.2
The code is as follows
`<ReactNativeZoomableView
ref={this.zoomableViewRef}
maxZoom={3}
minZoom={0.8}
zoomStep={1}
panEnabled={true}
bindToBorders={true}
initialZoom={curImgZoom ? curImgZoom.zoom : 1}
disablePanOnInitialZoom={false}
doubleTapDelay={260}
movementSensibility={2.5}
contentWidth={Dimensions.get('window').width}
contentHeight={900}
visualTouchFeedbackEnabled={true}
panBoundaryPadding={0}
initialOffsetX={0}
initialOffsetY={OffsetY}
onMoveShouldSetPanResponderCapture={(evt, gestureState) =>
Math.abs(gestureState.dx) > 3 || Math.abs(gestureState.dy) > 3
}
onSingleTap={(event) => {
const { pageX, pageY, locationX, locationY, target } = event.nativeEvent;
console.log(event.nativeEvent);
console.log(pageX, pageY, locationX, locationY, target);
}}
onZoomEnd={(event, gestureState, zoomableViewEventObject) => {
console.log('onZoomEnd----', zoomableViewEventObject.zoomLevel);
const currentZoom = zoomableViewEventObject.zoomLevel;
}}
onDoubleTapAfter={(event, zoomableViewEventObject) => {
const currentZoom = zoomableViewEventObject.zoomLevel;
console.log('Double Tap Zoom Level:', currentZoom);
}}>
<View
style={{
justifyContent: 'center',
alignContent: 'center',
backgroundColor: '#eee',
}}
>
<FastImage
style={{
width: Dimensions.get('window').width,
height: 300,
}}
ref={(ref) => (this.imageRefs[index] = ref)}
source={{
uri: info.replace('http://', 'https://'),
priority: FastImage.priority.high,
cache: FastImage.cacheControl.none,
}}
resizeMode={FastImage.resizeMode.contain}
/>
<FastImage
style={{
width: Dimensions.get('window').width,
height: 300,
}}
ref={(ref) => (this.imageRefs[index] = ref)}
source={{
uri: info.replace('http://', 'https://'),
priority: FastImage.priority.high,
cache: FastImage.cacheControl.none,
}}
resizeMode={FastImage.resizeMode.contain}
/>
<FastImage
style={{
width: Dimensions.get('window').width,
height: 300,
}}
ref={(ref) => (this.imageRefs[index] = ref)}
source={{
uri: info.replace('http://', 'https://'),
priority: FastImage.priority.high,
cache: FastImage.cacheControl.none,
}}
resizeMode={FastImage.resizeMode.contain}
/>