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

TypeError: Cannot read property 'show' and 'dismiss' of null

Open Base29 opened this issue 6 years ago • 6 comments

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 ?

Base29 avatar May 17 '19 07:05 Base29

Could you check the version again? cat node_modules/react-native-popup-dialog/package.json

jacklam718 avatar May 19 '19 18:05 jacklam718

@jacklam718 ... checked and the version is 0.15.0

Base29 avatar May 20 '19 05:05 Base29

could you show me your code ?

jacklam718 avatar May 20 '19 14:05 jacklam718

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();
    };

Base29 avatar May 21 '19 07:05 Base29

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.

jacklam718 avatar May 22 '19 16:05 jacklam718

@Base29 did you find a solution for the issue, I'm facing the same

hanaechahid avatar Oct 20 '20 16:10 hanaechahid