|
1 | 1 | # react-native-gesture-image-viewer |
2 | 2 |
|
| 3 | +## 2.0.0-beta.8 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- 193779d: feat: add customizable `width` and `height` props to `GestureViewer` |
| 8 | + |
| 9 | + - Add `height` prop to enable custom viewer height |
| 10 | + - Remove `useSnap` restriction for `width` customization |
| 11 | + - Allow custom `width` in both snap and paging modes |
| 12 | + - Maintain backward compatibility with screen dimensions as defaults |
| 13 | + - Improve flexibility for different layout requirements |
| 14 | + |
| 15 | + Example: |
| 16 | + |
| 17 | + ```tsx |
| 18 | + <GestureViewer width={400} height={600} /> |
| 19 | + ``` |
| 20 | + |
| 21 | +- a7b58a5: feat: add auto-play functionality to gesture viewer with configurable interval |
| 22 | + |
| 23 | + - add `autoPlay` and `autoPlayInterval` props |
| 24 | + - when `autoPlay` is enabled, the viewer will automatically play the next item after the specified interval |
| 25 | + - when `enableLoop` is enabled, the viewer will loop back to the first item after the last item |
| 26 | + - when `enableLoop` is disabled, the viewer will stop at the last item |
| 27 | + - when there is only one item, auto-play is disabled |
| 28 | + - interval must be a positive integer in milliseconds (values < 250ms are clamped to 250ms) |
| 29 | + - `autoPlayInterval` is optional and defaults to 3000ms |
| 30 | + - `autoPlay` is optional and defaults to `false` |
| 31 | + - when zoom or rotate gestures are detected, the auto-play will be paused |
| 32 | + |
| 33 | + ```tsx |
| 34 | + import { GestureViewer } from "react-native-gesture-image-viewer"; |
| 35 | + |
| 36 | + function App() { |
| 37 | + return <GestureViewer autoPlay autoPlayInterval={3000} />; |
| 38 | + } |
| 39 | + ``` |
| 40 | + |
| 41 | +### Patch Changes |
| 42 | + |
| 43 | +- 9b006b7: fix: improve type inference for listProps with generic list components |
| 44 | + |
| 45 | + - Add InstantiateGeneric helper type for better generic component props inference |
| 46 | + - Change generic type parameter from T to ItemT for clarity |
| 47 | + - Fix type inference issues with FlashList, FlatList keyExtractor and renderItem props |
| 48 | + - Ensure all list component props receive correct ItemT type instead of unknown |
| 49 | + |
| 50 | + **Before:** |
| 51 | + |
| 52 | + ```tsx |
| 53 | + <GestureViewer |
| 54 | + data={images} |
| 55 | + renderItem={renderImage} |
| 56 | + ListComponent={FlashList} |
| 57 | + // keyExtractor's item parameter was unknown type |
| 58 | + listProps={{ |
| 59 | + keyExtractor: (item, index) => item.id, // ❌ item is unknown |
| 60 | + }} |
| 61 | + /> |
| 62 | + ``` |
| 63 | + |
| 64 | + **After:** |
| 65 | + |
| 66 | + ```tsx |
| 67 | + <GestureViewer |
| 68 | + data={images} |
| 69 | + renderItem={renderImage} |
| 70 | + ListComponent={FlashList} |
| 71 | + // keyExtractor's item parameter is now properly typed |
| 72 | + listProps={{ |
| 73 | + keyExtractor: (item, index) => item.id, // ✅ item has correct type |
| 74 | + // and other props... |
| 75 | + }} |
| 76 | + /> |
| 77 | + ``` |
| 78 | + |
3 | 79 | ## 2.0.0-beta.7 |
4 | 80 |
|
5 | 81 | ### Patch Changes |
|
0 commit comments