Skip to content

react-native-gesture-image-viewer@1.7.0

Compare
Choose a tag to compare
@github-actions github-actions released this 21 Aug 02:15
· 5 commits to main since this release
7658f14

Minor Changes

  • a2e60a4: feat: implement trigger-based modal animation system

    • Add GestureTrigger component for registering trigger elements
    • Implement trigger position-based modal open/close animations
    • Enable smooth transition from trigger element to full modal view
    • add triggerAnimation prop for customizable open animation (duration/easing/reduce-motion, with onAnimationComplete)
    • add onDismissStart callback to signal dismiss gesture start (useful for hiding external UI)
    • add dismiss() helper to renderContainer for programmatic close

    Example:

    import { GestureTrigger, GestureViewer } from 'react-native-gesture-image-viewer';
    
    // Wrap your thumbnail with GestureTrigger
    <GestureTrigger id="gallery" onPress={() => openModal(index)}>
      <Pressable>
        <Image source={{ uri }} />
      </Pressable>
    </GestureTrigger>
    
    // Configure GestureViewer with matching id
    <GestureViewer
      id="gallery"
      data={images}
      renderItem={renderImage}
      onDismiss={() => setVisible(false)}
      onDismissStart={() => setShowUI(false)}
      triggerAnimation={{
        duration: 300,
        easing: Easing.bezier(0.25, 0.1, 0.25, 1.0),
        onAnimationComplete: () => console.log('Animation finished!')
      }}
      renderContainer={(children, helpers) => (
        <View style={{ flex: 1 }}>
          {children}
          {showUI && (
            <View style={styles.header}>
              <Button onPress={helpers.dismiss} title="Close" />
            </View>
          )}
        </View>
      )}
    />

Patch Changes

  • c58bd5a: docs(readme): update trigger based animation example

  • 58e650e: fix: sync dataRef on data change; use manager.currentIndex for comparison

    • move dataRef.current update into useEffect([data]) to sync only when data changes
    • compare against manager.getState().currentIndex for accurate index checks