New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

mayo-settings

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mayo-settings

A injectable modal in react-native apps to host user preferences

latest
Source
npmnpm
Version
1.2.9
Version published
Maintainers
1
Created
Source

A generic user settings modal for React Native

Easily integrate a user preference modal in your React Native applications with MayoSettingsModal, now supporting multiple independent modal instances.

🚀 Installation

npm install mayo-settings
# OR
yarn add mayo-settings

📖 Usage

Wrapping your app with MayoSettingsProvider

First, wrap your application with MayoSettingsProvider. This provides the necessary context for managing multiple MayoSettingsModal instances.

import { MayoSettingsProvider } from 'mayo-settings';

function App() {
  return (
    <MayoSettingsProvider>
      {/* Rest of your app components */}
    </MayoSettingsProvider>
  );
}

Using MayoSettingsModal in your component

Here's how you can use the MayoSettingsModal in your component:

import { MayoSettingsModal, useMayoSettings } from 'mayo-settings';

function SettingsComponent() {
  const { openModal, closeModal } = useMayoSettings();

  return (
    <>
      <Button onPress={() => openModal("settingsModalId")} title="Open Settings" />

      <MayoSettingsModal
        id="settingsModalId"
        onClose={() => closeModal("settingsModalId")}
        onLogout={handleLogout}
        config={{
          headerTitle: 'Custom Settings',
          logoutButtonText: 'Custom Logout',
        }}
      >
        {/* Your custom settings go here */}
      </MayoSettingsModal>
    </>
  );
}

🛠️ Props and Configuration

Here are some of the available props and configuration options you can pass to MayoSettingsModal:

Prop NameTypeDescription
idbooleanA unique identifier for the modal instance.
onClosefunctionCallback function when closing the modal.
onLogoutfunctionCallback function when the logout action is triggered.
configobjectConfiguration object for additional modal settings.

For the config object:

Property NameTypeDescription
headerTitlestringTitle text for the modal header.
logoutButtonTextstringText for the logout action button.
showFooterbooleanShows of not the footer with the logout button

 🔍 API

MayoSettingsModal

PropTypeDescription
onLogoutfunctionCallback to handle logout logic.
childrenReactNodeChildren components for your settings.
configobject (optional)Configuration for the modal.

useMayoSettings

Hook to manage user preferences.

  • openModal(id: string): Opens a modal by its unique ID.
  • closeModal(id: string): Closes a modal by its unique ID.

📚 License

This project is licensed under the MIT License.

FAQs

Package last updated on 20 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts