In React Native when making development builds you can shake the device or use the menu button to bring up a developer menu. How do you add an additional custom item to this menu? I haven't been able to find any documentation on adding another item but I think it would be very handy to say toggle between server environments (dev, prod, etc.) from the dev menu rather than making separate builds to test against each environment.
You can use DevSettings addMenuItem
function to add item in React Native developer menu
in your main App.js
component, write
import { DevSettings } from 'react-native';
//...
useEffect(() => {
// componentDidMount
// Add our toggle command to the menu
DevSettings.addMenuItem('Toggle Storybook', () => {
// Perform your logic here
});
}, []);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With