react-native-modalbox icon indicating copy to clipboard operation
react-native-modalbox copied to clipboard

android app crashes while opening modal second time

Open tusharkhatiwada opened this issue 5 years ago • 4 comments

I have multiple markers loaded on the map. On pressing a marker a modal pops up with information. But when I try to open the modal next time the app crashes. It works on iOS though. I have also tried this hack but it doesn't seem to work. https://github.com/maxs15/react-native-modalbox/issues/248#issuecomment-435391832

react-native: 0.61.1 react-native-modalbox: 2.0.0

tusharkhatiwada avatar Nov 21 '19 14:11 tusharkhatiwada

This simple change fixed my issue: #291

tusharkhatiwada avatar Nov 21 '19 18:11 tusharkhatiwada

disable backdropPressToClose={false} swipeToClose={false} and add button setting false

ex: <Modal isOpen={this.state.isOpenModalMesa} onClosed={() => this.setState({ isOpenModaMesa: false })} style={{height: 250, width: 250, borderRadius: 5}} position={'center'} coverScreen={true} backdropPressToClose={false} swipeToClose={false} //backdropContent={BContent} > <TouchableOpacity onPress={()=> this.setState({isOpenModalMesa: false})}> <Text style={{fontWeight: 'bold', color: '#cc0000'}}>Cancelar</Text> </TouchableOpacity> </Modal>

leondenisjunior avatar Feb 18 '20 23:02 leondenisjunior

I'm experiencing the same issue. @tusharkhatiwada I tried your fix but it seems it is based on a particular scenario, for me it isn't working.

I'm using v2.0.0 React-native: 0.59 (expo SDK: 35)

@maxs15 on android the app crashes when a modal gets opened for the second time. I open the modal when a press on a row in a table to show more detailed data inside the modal. I configured the Modal component in a the following manner:

<Modal
  isOpen={this.props.orderId !== undefined}
  onOpened={this.openModal}   // side effect that dispatches an action
  onClosed={this.closeModal}  // performing a callback from the parent component.
  ... // some more props
/>

I can open and close the Modal 1 time, but the second time the app crashes without any error or other information. With some debugger statements I could determine that the Animated.View from renderContent gets returned.

I was wondering if it might be the this.state.position that is passed to the translateY in the transform that is incorrect. I'm quite new to Animations though...

Any help would be appreciated!

gertvdkolk avatar Apr 08 '20 15:04 gertvdkolk

hello everyone, if anyone stumbling upon this thread, and wondering a fix, i found my fix, not guaranteed will work for you just like other workaround, but worth to try, please refer here : my answer

SolidTears avatar Nov 19 '20 15:11 SolidTears