react-native-modalbox
react-native-modalbox copied to clipboard
unable open the modal from right or left
I also want this feature.
Check line 448 in index.js for this project. Change to something like this:
style={[styles.wrapper, size, this.props.style, {transform: [{translateY: this.props.sideOpening == 'horizontal' ? offsetX : this.state.position}, {translateX: this.props.sideOpening == 'horizontal' ? this.state.position : offsetX}]} ]}
and around line 246 change this:
let positionDest = this.calculateModalPosition(this.state.containerHeight - this.state.keyboardOffset, this.state.containerWidth);
to this:
let positionDest = this.calculateModalPosition(this.state.containerWidth, this.state.containerHeight);
I added props called sideOpening so when it's horizontal it opens from the right to left and when it's vertical it opens from bottom to top. It's just a quick fix. Works for my current project.
Cheers.
I have the same issue did you solve it? @cindyya
this.calculateModalPosition(this.state.containerWidth, this.state.containerHeight);
Very nice work @prodoxx !
I used your description to make a version that work from left to right with other parts of his lib working like pan gestures and animations.
I used the prop entry with the value 'left' instead of creating a new one.
https://github.com/AugustusCosta/react-native-modalbox