Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 994 Bytes

File metadata and controls

48 lines (37 loc) · 994 Bytes

react-native-add-items-in-dev-menu

Package to add items in dev menu for toggle funcionalities

Installation

npm install react-native-add-items-in-dev-menu

Usage

import { useDevSettings } from "react-native-add-items-in-dev-menu";

// ...
const { loading, state } = useDevSettings([
    {name: "Title to show in dev menu"},
    {name: "Fixtures"},
    {name: "Clear AssyncStorage", action: async () => await AsyncStorage.clear()},
    {name: "Say hello", action: () => Alert.alert("Hello!")}
])
/*
    Value of the variable state:
    {"useTitleToShowInDevMenu": false, "useSayHello": false}
*/

// ...
const isShowTitle = state.useTitleToShowInDevMenu

if (loading) {
    return <View />
}

return (
    <View>
        <Text>{isShowTitle ? 'Title enabled' : 'Title disabled'}</Text>
        ...
    </View>
)

Example

exemplo de dev menu com itens inseridos pela lib

readme in construction...