React-native-image-viewer: Put a cross/cancel icon on top in modal

Created on 15 Aug 2017  路  2Comments  路  Source: ascoders/react-native-image-viewer

I would want to know how to put a cross/cancel icon in the modal view pressing on which I close the modal view. Any props to get this done? (maybe like leftIcon) Very normal use case I guess.

Most helpful comment

You can do this:

                 renderHeader={() => (
                    <TouchableOpacity
                      onPress={() => this.setState({ slideshow: false })}
                      style={{ alignItem: 'right',backgroundColor:'#FFA800'}}
                    >
                      <Icon
                        right
                        ios="ios-close"
                        android="md-close"
                        style={{ color: 'white', textAlign:'right', paddingRight:10 }}
                      />
                    </TouchableOpacity>
                  )

All 2 comments

Did you solve it?

You can do this:

                 renderHeader={() => (
                    <TouchableOpacity
                      onPress={() => this.setState({ slideshow: false })}
                      style={{ alignItem: 'right',backgroundColor:'#FFA800'}}
                    >
                      <Icon
                        right
                        ios="ios-close"
                        android="md-close"
                        style={{ color: 'white', textAlign:'right', paddingRight:10 }}
                      />
                    </TouchableOpacity>
                  )
Was this page helpful?
0 / 5 - 0 ratings