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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-scroll-provider

v1.0.2

Published

Context Provider for tracking state-driven values read from scrolling.

Downloads

3

Readme

React Native Modal Provider

React Native Modal Provider is a flexible and customizable modal provider for React Native applications. It allows you to easily manage modals with different detents (small, medium, large) while providing a smooth and visually appealing user experience.

Animated photo of the Modal Provider.

Installation

To install the React Native Modal Provider in your project, follow these steps:

  1. Add the package to your project using:
npm install git+https://github.com/thordotcomputer/react-native-modal-provider.git

or

yarn add git+https://github.com/thordotcomputer/react-native-modal-provider.git
  1. Import and use the Modal Provider in your React Native code:
import { ModalProvider } from 'react-native-modal-provider';

// Wrap your app with the ModalProvider component
<ModalProvider>
    {/* Your app content goes here */}
</ModalProvider>

Usage

The Modal Provider allows you to easily manage modals in your React Native application. You can control the presentation and behavior of modals using the provided hooks and components.

Opening a Modal To open a modal with custom content and a specific detent, you can use the openModal function as shown in the example above. Replace CustomModalContent with your actual modal content component.

import { useModal } from 'react-native-modal-provider';

// Example of opening a modal
const { openModal } = useModal();

// Open a modal with custom content and detent
openModal({
isPresented: true,
detent: 'medium',
node: <CustomModalContent />,
});

Retrieving the Current Modal State To retrieve the current modal state, you can use the readModal function as follows:

import { useModal } from 'react-native-modal-provider';

// Example of reading the current modal state
const { readModal } = useModal();

// Get the current modal state
const modalState = readModal();

// You can now access properties of the modal state like modalState.isPresented, modalState.detent, etc.

Updating the Modal State To update the modal state with a provided key-value pair, you can use the updateModal function like this:

import { useModal } from 'react-native-modal-provider';

// Example of updating the modal state
const { updateModal } = useModal();

// Update the modal state with a new value for a specific key
updateModal({ key: 'detent', value: 'large' });

// This will update the 'detent' property of the modal state to 'large'

Closing the Current Modal To close the currently open modal, you can use the closeModal function as shown below:

import { useModal } from 'react-native-modal-provider';

// Example of closing the current modal
const { closeModal } = useModal();

// Close the currently open modal
closeModal();

These examples demonstrate how to use each function provided by the React Native Modal Provider. You can adapt them to your specific use case and component names.

Customization

The Modal Provider is highly customizable. You can adjust the appearance and behavior of modals by modifying the provided styles, or by creating your own components and using the context.

API Reference

ModalProvider

Properties

| Name | Description | Optional | | ----------------- | --------------------------------------------------------------------------- | -------- | | backgroundColor | Customize the background color of the area behind the modal when presented. | Optional | | debug | Enable debugging logs for methods in the Modal Provider. | Optional |

useModal

A hook for managing modals. Provides functions to open, read, update, and close modals.

Methods

| Name | Description | | -------------------------------------------------- | --------------------------------------------------------- | | openModal(content: ModalState) | Opens a modal with the specified content and detent. | | readModal() | Retrieves the current modal state. | | updateModal(update: { key: string; value: any }) | Updates the modal state with the provided key-value pair. | | closeModal() | Closes the currently open modal. |