1
1
import React from 'react' ;
2
- import { Modal , Dimensions , VirtualizedList , View } from 'react-native' ;
2
+ import { Modal , Dimensions , VirtualizedList , Platform } from 'react-native' ;
3
3
import Image from './Image' ;
4
- import { ImageViewerImageProps , ImageViewerComponentProps , ImageViewerComponentState , SwipeDirection } from './types' ;
4
+ import { ImageViewerImageProps , ImageViewerComponentProps , ImageViewerComponentState } from './types' ;
5
5
6
6
const SCREEN_WIDTH = Dimensions . get ( 'window' ) . width ;
7
7
@@ -47,6 +47,14 @@ class ImageViewer extends React.Component<ImageViewerComponentProps, ImageViewer
47
47
private _keyExtractor = ( _item : ImageViewerImageProps , index : number ) => `${ index } ` ;
48
48
49
49
render ( ) {
50
+ const platformProps = Platform . select ( {
51
+ ios : {
52
+ bounces : false ,
53
+ directionalLockEnabled : true ,
54
+ } ,
55
+ android : { } ,
56
+ } ) ;
57
+
50
58
return (
51
59
< Modal visible = { this . props . visible } transparent animationType = { this . props . animationType } onRequestClose = { this . _closeInternal } >
52
60
< VirtualizedList
@@ -64,10 +72,12 @@ class ImageViewer extends React.Component<ImageViewerComponentProps, ImageViewer
64
72
removeClippedSubviews = { true }
65
73
maxToRenderPerBatch = { 2 }
66
74
initialNumToRender = { 2 }
75
+ updateCellsBatchingPeriod = { 100 }
67
76
pagingEnabled
68
- initialScrollIndex = { this . props . initialIndex !== undefined ? this . props . initialIndex : 0 }
77
+ initialScrollIndex = { this . props . initialIndex }
69
78
listKey = { 'RNImageViewer' }
70
79
disableScrollViewPanResponder = { ! this . state . scrollEnabled }
80
+ { ...platformProps }
71
81
/>
72
82
</ Modal >
73
83
) ;
0 commit comments