1.3.7 • Published 8 months ago

react-mobile-modals v1.3.7

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

react-mobile-modals

NPM JavaScript Style Guide

Use with webview for creation pretty navigation 📱

react-mobile-modals simplifies the process of implementing modals in your mobile application, providing a user-friendly and performant solution for displaying contextual content or gathering input from users. With its highly customizable nature, you have full control over the modal behavior and appearance to craft a modal experience that aligns perfectly with your application's requirements.

Enhance your mobile application's user experience with react-mobile-modals and empower your users with easily accessible and customizable modals for a seamless interaction within your app!

example

Install

npm install --save react-mobile-modals

or

yarn add react-mobile-modals

Usage

// App.tsx
import 'react-mobile-modals/dist/index.css';

const App = () => {
  render() {
    return (
      <ModalsProvider>
        {/* Your app */}
      </ModalsProvider>
    )
  }
}

Example

import React from 'react'
import { ModalsProvider, useModals } from 'react-mobile-modals'

const SecondPage = () => {
  const { closeModal } = useModals();

  return (
    <div className="page">
      <button onClick={closeModal}>
        Back
      </button>
    </div>
  )
}

const FirstPage = () => {
  const { openModal } = useModals();

  const openSecondPage = () => openModal({ component: <SecondPage />, direction: "vertical" });

  return (
    <div className="page">
      <button onClick={openSecondPage}>
        Open second page
      </button>
    </div>
  )
}


const MainWindow = () => {
  const { openModal } = useModals();

  const openFirstPage = () => openModal({ component: <FirstPage /> });

  return (
    <div className="page main">
      <button onClick={openFirstPage}>
        Open first page
      </button>
    </div>
  )
}

// App.tsx
import 'react-mobile-modals/dist/index.css';

const App = () => {
  render() {
    return (
      <ModalsProvider>
        <MainWindow />
      </ModalsProvider>
    )
  }
}

Props

openModal params
PropValuesDefault ValuesRequired
componentReactNodenonetrue
directionhorizontal, verticalhorizontalfalse

Example https://skilldill.github.io/react-mobile-modals/

License

MIT ©

1.3.7

8 months ago

1.3.6

8 months ago

1.3.5

8 months ago

1.3.4

8 months ago

1.3.3

8 months ago

1.3.2

8 months ago

1.3.1

8 months ago

1.3.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago