Menu crashes on the second open
See original GitHub issueEnvironment
Running a react-native app on a Pixel 3 with the latest Android version.
Description
It seems like every 2nd open of a <Menu>
triggers some error. This is happening after 3.0.0-alpha.4
. I think it might have been introduced with https://github.com/callstack/react-native-paper/commit/fa22a68.
Might be related to https://github.com/callstack/react-native-paper/issues/1329.
Reproducible Demo
Made a simple snack, but this is more or less the component I’m rendering the menu in:
import React, {
useCallback,
useMemo,
useState
} from 'react';
import {
ScrollView,
StyleSheet,
Vibration,
View
} from 'react-native';
import {SafeAreaView} from 'react-navigation';
import {
Appbar,
Divider,
Menu,
Provider
} from 'react-native-paper';
export default function MyComp() {
const [menuVisible, setMenuVisible] = useState(false);
const hideMenu = useCallback(() => setMenuVisible(false), [setMenuVisible]);
const showMenu = useCallback(() => setMenuVisible(true), [setMenuVisible]);
const menuAnchor = useMemo(() => (
<Appbar.Action
onPress={showMenu}
icon="dots-vertical"
/>
), []);
return (
<SafeAreaView>
<Provider>
<Appbar.Header>
<Appbar.Content
title="Title"
subtitle="Subtitle"
/>
<Menu
visible={menuVisible}
onDismiss={hideMenu}
anchor={menuAnchor}
>
<Menu.Item onPress={hideMenu} title="Item 1" />
<Menu.Item onPress={hideMenu} title="Item 2" />
<Divider />
<Menu.Item
// onPress={() => {}}
title="Logout"
icon="logout"
/>
</Menu>
</Appbar.Header>
</Provider>
</SafeAreaView>
);
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Keeps crashing before main menu - Steam Community
Split/Second · 1 Right-click on the game title under the Library in Steam and select Properties. · 2 Under the General tab click...
Read more >Crash when open and exit menu a fews time. | Forums
My game will crashed after I open and close the menu several time. Be it setting menu, inventory or the map.
Read more >Windows Crashing and start menu Problem
My PC crashes everytime and even when it works, the start menu doesn't opens. I tried many steps like: changing Bios settings, ...
Read more >The amount of crashing in menus is absurd. It is beginning to ...
I crashed 3 games in a row on crucible today while opening menus on ps5. Before today it would only happen once every...
Read more >VS crash when menu View->Other windows is opened
You don't need anything like the amount of information requested, to see this happening. Just open VS, even without any code, then try...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It still happens for me at the first menu dismiss.
"react-native": "^0.59.9", "react-native-paper": "^3.8.0"
Crashes on production.
@SwitiSM Updated to most recent version of react-native-paper and replaced the menu with react-native-material-menu.