meliorence / react-native-image-gallery

Pure JavaScript image gallery component for iOS and Android with high-performance and native feeling in mind
715 stars 298 forks source link

Orientation change (landscape) blocks the gallery on Android #94

Open Draccan opened 6 years ago

Draccan commented 6 years ago

I have a problem with this component about orientation change on Android. If I change the orientation from portrait to landscape and even if I am already in landscape mode, the gallery stops. It seems to be a rendering problem, but I don't understand why it doesn't work on landscape while it is perfect in portrait mode.

Someone could help me?

My gallery code is: <Gallery style={{ flex: 1, backgroundColor: 'black' }} images={this.state.imageUrls} initialPage = {this.state.selectedImageIndex} flatListProps={ { initialNumToRender: 20, initialScrollIndex:this.state.selectedImageIndex, getItemLayout: (data, index) => ({length: Dimensions.get('screen').width, offset: Dimensions.get('screen').width * index, index}) } }/>

lavarajallu commented 6 years ago

Hi in android i am not getting images can you suggest me .

here this is my Code:
<Content style={{ backgroundColor: 'rgba(0, 0, 0, 0.7)', flex:1 }}>
           <View style={{ flex: 1 }} >
            {
            this.state.animating == true ? <View style={{ flex: 1, justifyContent:'center', backgroundColor:'green' }}>
            <Text style={{fontSize:18, fontWeight:'bold', color:'grey'}}> Please Wait it's Loading Calender ......</Text>
            </View> :  
            <View style={{ flex: 1 }} >
             <Gallery
                  style={{ flex: 1, backgroundColor: 'black' }}
                  images={this.state.images}
                  errorComponent={this.renderError}
                  onPageSelected={this.onChangeImage}
                  initialPage={0}
                />
                { this.galleryCount }
                { this.caption }
                </View>}

            </View>
        </Content>
Draccan commented 6 years ago

@lavarajallu I think that you could open another issue. However try to set some borders to the views to understand if the gallery has the space to show images and ensure that your "this.state.images" is correct --> [{source:{uri:""}}]

Draccan commented 6 years ago

Just a little update: I've seen that the orientation change works on Android using a real device (OnePlus One, Lenovo P2, Samsung Galaxy S3, S4, S5, S6). However is a bit slow: it blocks for a while before showing the image landscape (I have 100 images at least).