|
1 | 1 | import React, { useEffect, useRef, useState } from 'react'; |
2 | 2 | import { Image, ImageStyle, Keyboard, StyleSheet, ViewStyle } from 'react-native'; |
3 | 3 |
|
4 | | -import { GestureDetector } from 'react-native-gesture-handler'; |
| 4 | +import { Gesture, GestureDetector } from 'react-native-gesture-handler'; |
5 | 5 |
|
6 | 6 | import Animated, { |
7 | 7 | Easing, |
@@ -500,77 +500,71 @@ export const ImageGallery = < |
500 | 500 | style={[StyleSheet.absoluteFillObject, showScreenStyle]} |
501 | 501 | > |
502 | 502 | <Animated.View style={[StyleSheet.absoluteFillObject, containerBackground]} /> |
503 | | - <GestureDetector gesture={singleTap}> |
| 503 | + <GestureDetector gesture={Gesture.Simultaneous(singleTap, doubleTap, pinch, pan)}> |
504 | 504 | <Animated.View style={StyleSheet.absoluteFillObject}> |
505 | | - <GestureDetector gesture={doubleTap}> |
506 | | - <Animated.View style={StyleSheet.absoluteFillObject}> |
507 | | - <GestureDetector gesture={pinch}> |
508 | | - <Animated.View style={StyleSheet.absoluteFill}> |
509 | | - <GestureDetector gesture={pan}> |
510 | | - <Animated.View style={StyleSheet.absoluteFill}> |
511 | | - <Animated.View style={[styles.animatedContainer, pagerStyle, pager]}> |
512 | | - {imageGalleryAttachments.map((photo, i) => |
513 | | - photo.type === FileTypes.Video ? ( |
514 | | - <AnimatedGalleryVideo |
515 | | - attachmentId={photo.id} |
516 | | - handleEnd={handleEnd} |
517 | | - handleLoad={handleLoad} |
518 | | - handleProgress={handleProgress} |
519 | | - index={i} |
520 | | - key={`${photo.uri}-${i}`} |
521 | | - offsetScale={offsetScale} |
522 | | - paused={photo.paused || false} |
523 | | - previous={selectedIndex > i} |
524 | | - repeat={true} |
525 | | - scale={scale} |
526 | | - screenHeight={fullWindowHeight} |
527 | | - selected={selectedIndex === i} |
528 | | - shouldRender={Math.abs(selectedIndex - i) < 4} |
529 | | - source={{ uri: photo.uri }} |
530 | | - style={[ |
531 | | - { |
532 | | - height: fullWindowHeight * 8, |
533 | | - marginRight: MARGIN, |
534 | | - width: fullWindowWidth * 8, |
535 | | - }, |
536 | | - slide, |
537 | | - ]} |
538 | | - translateX={translateX} |
539 | | - translateY={translateY} |
540 | | - videoRef={videoRef} |
541 | | - /> |
542 | | - ) : ( |
543 | | - <AnimatedGalleryImage |
544 | | - accessibilityLabel={'Image Item'} |
545 | | - index={i} |
546 | | - key={`${photo.uri}-${i}`} |
547 | | - offsetScale={offsetScale} |
548 | | - photo={photo} |
549 | | - previous={selectedIndex > i} |
550 | | - scale={scale} |
551 | | - screenHeight={fullWindowHeight} |
552 | | - selected={selectedIndex === i} |
553 | | - shouldRender={Math.abs(selectedIndex - i) < 4} |
554 | | - style={[ |
555 | | - { |
556 | | - height: fullWindowHeight * 8, |
557 | | - marginRight: MARGIN, |
558 | | - width: fullWindowWidth * 8, |
559 | | - }, |
560 | | - slide, |
561 | | - ]} |
562 | | - translateX={translateX} |
563 | | - translateY={translateY} |
564 | | - /> |
565 | | - ), |
566 | | - )} |
567 | | - </Animated.View> |
568 | | - </Animated.View> |
569 | | - </GestureDetector> |
| 505 | + <Animated.View style={StyleSheet.absoluteFillObject}> |
| 506 | + <Animated.View style={StyleSheet.absoluteFill}> |
| 507 | + <Animated.View style={StyleSheet.absoluteFill}> |
| 508 | + <Animated.View style={[styles.animatedContainer, pagerStyle, pager]}> |
| 509 | + {imageGalleryAttachments.map((photo, i) => |
| 510 | + photo.type === FileTypes.Video ? ( |
| 511 | + <AnimatedGalleryVideo |
| 512 | + attachmentId={photo.id} |
| 513 | + handleEnd={handleEnd} |
| 514 | + handleLoad={handleLoad} |
| 515 | + handleProgress={handleProgress} |
| 516 | + index={i} |
| 517 | + key={`${photo.uri}-${i}`} |
| 518 | + offsetScale={offsetScale} |
| 519 | + paused={photo.paused || false} |
| 520 | + previous={selectedIndex > i} |
| 521 | + repeat={true} |
| 522 | + scale={scale} |
| 523 | + screenHeight={fullWindowHeight} |
| 524 | + selected={selectedIndex === i} |
| 525 | + shouldRender={Math.abs(selectedIndex - i) < 4} |
| 526 | + source={{ uri: photo.uri }} |
| 527 | + style={[ |
| 528 | + { |
| 529 | + height: fullWindowHeight * 8, |
| 530 | + marginRight: MARGIN, |
| 531 | + width: fullWindowWidth * 8, |
| 532 | + }, |
| 533 | + slide, |
| 534 | + ]} |
| 535 | + translateX={translateX} |
| 536 | + translateY={translateY} |
| 537 | + videoRef={videoRef} |
| 538 | + /> |
| 539 | + ) : ( |
| 540 | + <AnimatedGalleryImage |
| 541 | + accessibilityLabel={'Image Item'} |
| 542 | + index={i} |
| 543 | + key={`${photo.uri}-${i}`} |
| 544 | + offsetScale={offsetScale} |
| 545 | + photo={photo} |
| 546 | + previous={selectedIndex > i} |
| 547 | + scale={scale} |
| 548 | + screenHeight={fullWindowHeight} |
| 549 | + selected={selectedIndex === i} |
| 550 | + shouldRender={Math.abs(selectedIndex - i) < 4} |
| 551 | + style={[ |
| 552 | + { |
| 553 | + height: fullWindowHeight * 8, |
| 554 | + marginRight: MARGIN, |
| 555 | + width: fullWindowWidth * 8, |
| 556 | + }, |
| 557 | + slide, |
| 558 | + ]} |
| 559 | + translateX={translateX} |
| 560 | + translateY={translateY} |
| 561 | + /> |
| 562 | + ), |
| 563 | + )} |
570 | 564 | </Animated.View> |
571 | | - </GestureDetector> |
| 565 | + </Animated.View> |
572 | 566 | </Animated.View> |
573 | | - </GestureDetector> |
| 567 | + </Animated.View> |
574 | 568 | </Animated.View> |
575 | 569 | </GestureDetector> |
576 | 570 | <ImageGalleryHeader<StreamChatGenerics> |
|
0 commit comments