TypeError: Cannot read property 'show' and 'dismiss' of null
Hello I am getting this warning on .show() and .dismiss()
Plugin version = 0.15.0
this warning comes up when .show() is used.
Possible Unhandled Promise Rejection (id: 0):
TypeError: Cannot read property 'show' of null
TypeError: Cannot read property 'show' of null
This warning shows up when .dismiss() is used.
Possible Unhandled Promise Rejection (id: 1):
TypeError: Cannot read property 'dismiss' of null
TypeError: Cannot read property 'dismiss' of null
What could be causing this ?
Could you check the version again?
cat node_modules/react-native-popup-dialog/package.json
@jacklam718 ... checked and the version is 0.15.0
could you show me your code ?
This is the Popup in one of the components
<PopupDialog
ref={locationWarningDialog => {
this.locationWarningPopup = locationWarningDialog;
}}
width={0.6}
height={0.6}
dismissOnTouchOutside={false}
>
<KeyboardAwareScrollView
resetScrollToCoords={{
x: 0,
y: 0
}}
enableAutomaticScroll
extraHeight={300}
scrollEnabled={false}
contentContainerStyle={{
flex: 1
}}
>
<LocationWarningModal
closeLocationPopup={this.closeLocationWarningPopup}
openAddressPopup={this.openAddressPopup}
isMoving={this.state.isMoving}
optionsVisibility={this.state.showWarningOptions}
startedMovingOn={this.state.inMotion}
updateAddressVisibility={this.state.showUpdateAddressOptions}
sleepVisibility={this.state.showSleepOptions}
showSleepSection={this.showSleepSection}
showUpdateAddressSection={this.showUpdateAddressSection}
/>
</KeyboardAwareScrollView>
</PopupDialog>
And these are the methods/function within the same component to show and dismiss the popup
openLocationWarningPopup = () => {
this.locationWarningPopup.show();
};
closeLocationWarningPopup = () => {
this.locationWarningPopup.dismiss();
};
hmmm... seems you using correctly. sorry, i can't figure it out. what about try upgrade to latest version? btw, if you want to upgrade to latest version, please read the README because there's some breaking changes.
@Base29 did you find a solution for the issue, I'm facing the same