modal not begin from bottom
See original GitHub issueI try to make modal that begin from bottom of the screen until the middle of screen, but it always have little space between bottom to the modal and I don’t want it. I want the modal begin from the bottom.
import React, { Component } from 'react'
import { View, Text, Platform, Linking, Image } from 'react-native'
import { Button } from '..'
import style from './style'
import Modal from 'react-native-modal'
import Colors from '../../utils/Colors'
class MakeAppointmentModal extends Component {
constructor(props) {
super(props)
this.state = {
modalVisible: false,
}
}
componentDidMount = () => {
try {
this.props.onRef(this)
} catch (e) {}
}
componentWillUnmount = () => {
this.props.onRef(undefined)
}
setModalVisible = () => {
this.setState(state => {
return { modalVisible: !state.modalVisible }
})
}
render() {
const { container, view_modal, view_container_modal } = style
return (
<View style={container}>
<Modal
isVisible={this.state.modalVisible}
backdropColor={Colors.black}
backdropOpacity={0.8}
animationIn='fadeInUp'
hideModalContentWhileAnimating={true}
animationInTiming={1000}
animationOutTiming={600}
useNativeDriver={true}
onCancelPressed={() => this.setModalVisible()}
onBackButtonPressed={() => setModalInvisible()}
onModalHide={() => {
// this.setModalInvisible()
}}
onRequestClose={() => {
this.setModalVisible()
}}
>
<View style={view_modal}>
<View style={view_container_modal} />
</View>
</Modal>
</View>
)
}
}
export default MakeAppointmentModal
style
import { StyleSheet, Dimensions } from 'react-native'
import Colors from '../../utils/Colors'
import { calcSize } from '../../utils'
import { DIMENSIONS } from '../../utils/Consts'
const style = StyleSheet.create({
container: {
flex: 1,
},
view_modal: {
flex: 1,
position: 'absolute',
bottom: 0,
justifyContent: 'center',
alignItems: 'center',
shadowOpacity: 0,
},
view_container_modal: {
width: DIMENSIONS.width,
height: DIMENSIONS.height - calcSize(250),
backgroundColor: Colors.white,
alignItems: 'center',
justifyContent: 'center',
},
})
export default style
info
"react-native-modal": "^7.0.2",
"react": "16.6.3",
"react-native": "0.57.8",
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:15 (5 by maintainers)
Top Results From Across the Web
How to do Modal Bootstrap appear on bottom - Stack Overflow
Use modal-dialog, not modal, otherwise the modal won't disappear if you click above it. https://jsfiddle.net/9fg7jsu3/2/ · Share.
Read more >Modal - Bootstrap
Use Bootstrap's JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.
Read more >How to prevent Body from scrolling when a modal is opened ...
Given an HTML document with a modal, the task is to prevent the body element from scrolling whenever the modal is in an...
Read more >Bootstrap Modal Position - Visual LightBox
Shown below is a static modal sample ( signifying the position and display have been overridden). Incorporated are the modal header, modal body...
Read more >Prevent Page Scrolling When a Modal is Open | CSS-Tricks
The body will not respond when the screen is touched. However, there's still a “small” problem here. Let's say the modal trigger is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
<Modal style={{ margin: 0 }}>....</Modal>
can fix your problem
Try the following:
If it does work, please follow the README.md