I want to show my react native modal in the middle of screen even I have done styling but the window appers at the top of my screen but not in the center of screen. This is what I have tried so far:
<Modal animationType = {"slide"} transparent = {true}
style={styles.modal}
visible = {this.state.modalVisible}
onRequestClose = {this.closeModal}>
<View style={{justifyContent: 'center', backgroundColor: '#ffff', margin: 0,
alignItems: 'center'}}>
<Text >Enter Email</Text>
<TextInput
underlineColorAndroid='transparent'
onChangeText={(email) => this.setState({email})}/>
<Text>Enter Password</Text>
<TextInput
secureTextEntry={true}
underlineColorAndroid='transparent'
onChangeText={(password) => this.setState({password})}/>
<TouchableHighlight onPress = {() => {
this.toggleModal(!this.state.modalVisible)}}>
<Text >Close</Text>
</TouchableHighlight>
</View>
</Modal>
This is the modal styling:
const styles = StyleSheet.create({
modal:{
position:"relative",
width: 250,
height: 100,
backgroundColor: '#FFF',
justifyContent: 'center',
alignSelf: 'center',
}
});