Set width and height for React-native modal

I canโ€™t adjust the modal height and width using the style property. Is there any other way to set modal height and width?

<Modal style={{height: 300, width: 300}} visible={this.state.isVisible} onRequestClose={this.closeModal} > 

The code above does not work.

+6
source share
2 answers

According to the Modal documentation, there is no style prop.

Instead of <Modal> you can adjust the dimensions of <View> :

 <Modal transparent={true} visible={this.state.isVisible} onRequestClose={this.closeModal}> <View style={{ flex: 1, flexDirection: 'column', justifyContent: 'center', alignItems: 'center'}}> <View style={{ width: 300, height: 300}}> ... </View> </View> </Modal> 
+21
source

see the documentation for Modal https://facebook.imtqy.com/react-native/docs/modal.html . but itโ€™s better to use View instead of Modal. You can manipulate the View in different ways.

-3
source

Source: https://habr.com/ru/post/1012501/


All Articles