npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-modal-manager

v0.0.2

Published

Simple opening and closing modals in react-native with no dependencies

Readme

react-native-modal-manager

Simple opening and closing modals in react-native with no dependencies

Warning: project at beta-testing stage

Purposes

  • Simple opening and closing modals (no boilerplate code)
  • Separate modal state management logic from components, that use modals
  • Easily open the same modal from different components
  • Use some default props for all modals
  • Compatible with both: react-native modals and react-native-modal animated modals.

Example

MyModal.js

import * as React from 'react';
import modalManager from "react-native-modal-manager";
import { Modal, Text, Button } from "react-native";

const MyModal = ({ name, message, ...props }) => <Modal>  
  <Text>{message}</Text>
  <Button
    title="Close"
    onPress={() => modalManager.close(name)}
  />
</Modal>

export const myModalName = "MyModal";
modalManager.push(myModalName, MyModal);

MyButton.js

import * as React from 'react';
import { Button } from "react-native";
import modalManager from "react-native-modal-manager";
import { myModalName } from "./MyModal.js";

const MyButton = () => <Button
  title="Open modal"
  onPress={() => modalManager.open(
    myModalName,
    {
      message: "Hello world!"
    }
  )}
/>

App.js

import * as React from 'react';
import { View } from "react-native";
import { ModalContainer } from "react-native-modal-manager";
import MyButton from "./MyButton";

const App = () => <View>
  <MyButton />
  <ModalContainer />
</View>

Usage

With react-native-modal

Add to your index.js

(Warning: if this option is enabled - modalManager will be incompatible with react-native modals)

modalManager.setup({
  reactNativeModalCompatibleMode: true
});

Set default props for all modals

modalManager.setup({
  props: {
    // Your default props for all modals
  }
});

Debug

If strict mode enabled - some useful warnings will be shown.

For example: calling close method of ModalManager with name, that differs from currently running modal's name will produce warning.

modalManager.setup({
  strict: true
});

API

ModalManager

setup(options object) - change options of ModalManager. Can be called at any time.

push(name string, modal function | class) - register given component as modal with a name, which can be used in future for opening or closing this modal. Name must be unique in application scope.

open(name string, props object) - open modal, associated with given name. Given props will be passed to opened modal.

close(name string) - close modal, associated with given name.

getOption(option string) - return current ModalManager option value.

PR

Pull requests, feedbacks and suggestions are welcome!

License

MIT