react-native-popup-menu icon indicating copy to clipboard operation
react-native-popup-menu copied to clipboard

undefined is not an object (evaluating 't._getOpenedMenu().instance'

Open john1jan opened this issue 7 years ago • 7 comments

Getting this crash from play console

com.facebook.react.common.JavascriptException: undefined is not an object (evaluating 't._getOpenedMenu().instance'), stack:
_onBackdropPress@729:1065
touchableHandlePress@263:844
_performSideEffectsForTransition@256:8508
_receiveSignal@256:7291
touchableHandleResponderRelease@256:4735

john1jan avatar Feb 20 '18 09:02 john1jan

hi there. do you know how to reproduce this?

sodik82 avatar Feb 20 '18 09:02 sodik82

It happens when you click multiple times fastly in MenuTrigger

john1jan avatar Feb 20 '18 09:02 john1jan

Here is the code i user for showing popup menu

<Menu
                opened={this.state.opened}
                onBackdropPress={() => this.setState({ opened: false })}
                onSelect={value => { }}
            >
                <MenuTrigger onPress={() => this.setState({ opened: true })}
                    customStyles={triggerStyles}>

                    <IonIcon name={iconName} color={Colors.BLACK_80} size={25} style={{ paddingVertical: 5, paddingHorizontal: 8 }} />

                </MenuTrigger>
                <MenuOptions customStyles={OptionsCustomStyle} >
                    {
                        options.map((item, index) => (
                            <MenuOption text={item} key={index} customStyles={OptionCustomStyle}
                                onSelect={() => {
                                    this.setState({ opened: false })
                                    onSelectOptions(item)
                                }
                                }
                            />
                        ))
                    }
                </MenuOptions>
            </Menu>

john1jan avatar Feb 20 '18 09:02 john1jan

thanks. Which version of RN and popup menu do you use?

sodik82 avatar Feb 20 '18 09:02 sodik82

it got fixed when I removed all the props from Menu component

opened={this.state.opened}
                onBackdropPress={() => this.setState({ opened: false })}
                onSelect={value => { }}
<Menu>
                <MenuTrigger onPress={() => this.setState({ opened: true })}
                    customStyles={triggerStyles}>

                    <IonIcon name={iconName} color={Colors.BLACK_80} size={25} style={{ paddingVertical: 5, paddingHorizontal: 8 }} />

                </MenuTrigger>
                <MenuOptions customStyles={OptionsCustomStyle} >
                    {
                        options.map((item, index) => (
                            <MenuOption text={item} key={index} customStyles={OptionCustomStyle}
                                onSelect={() => {
                                    this.setState({ opened: false })
                                    onSelectOptions(item)
                                }
                                }
                            />
                        ))
                    }
                </MenuOptions>
</Menu>

john1jan avatar Feb 20 '18 10:02 john1jan

thanks for letting us know. I will reopen this issue so that I can "re-check" the controlled menu.

sodik82 avatar Feb 20 '18 11:02 sodik82

Not sure if it's the same error message. But I also was getting crashes when I double clicked menu options (both clicks on the same option as well if it were different options).

I had the onSelect on the Menu. Moving it to MenuOption instead resolved the issue.

On iOS only, no issue when on Android

Aequitas737 avatar Jun 14 '19 04:06 Aequitas737