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-card-modal-reanimated

v1.0.2

Published

react-native transition vertically slides the modal view up from the bottom of the screen and back down when it's dismissed.

Downloads

2

Readme

react-native-card-modal-reanimated

react-native-card-modal-reanimated is a cross-platform, smooth animation, pure js component. Modal transition vertically slides the modal view up from the bottom of the screen and back down when it's dismissed.

Dependencies

react-native-reanimated : https://github.com/software-mansion/react-native-reanimated

react-native-gesture-handler : https://github.com/software-mansion/react-native-gesture-handler

react-native-safe-area-context : https://github.com/th3rdwave/react-native-safe-area-context

react-native-redash : https://github.com/wcandillon/react-native-redash

Installation

yarn add react-native-reanimated react-native-gesture-handler react-native-safe-area-context react-native-redash
cd ios && pod install
yarn add react-native-card-modal-reanimated

Why another wheel instead of CardStyleInterpolators.forModalPresentationIOS

react-navigation CardStyleInterpolators.forModalPresentationIOS just a transition animation, can not handle gesture event exactly. On the contrary, react-native-card-modal-reanimated have greate gesture handler and animation no difference with original ios modal animation.

Usage

Basic

import {SafeAreaProvider, initialWindowMetrics} from 'react-native-safe-area-context';
import createSlideModal, {openModal} from 'react-native-card-modal-reanimated';

const SlideModalContainer = createSlideModal([
    {name: "ModalA", title: "Modal A", component: ModalA},
    {name: "ModalB", title: "Modal B", component: ModalB},
    {name: "ModalC", title: "Modal C", component: ModalC},
]);

const App = () => {
    return (
        <SafeAreaProvider initialMetrics={initialWindowMetrics}>
            <SlideModalContainer>
                // main page, such as react-navigation container etc.
                <View style={styles.container}>
                    <TouchableHighlight style={{borderRadius: 5}} onPress={() => {
                        openModal("ModalA", {count: 0});
                    }}>
                        <View style={styles.button}>
                            <Text style={styles.buttonText}>Press Me</Text>
                        </View>
                    </TouchableHighlight>
                </View>
            </SlideModalContainer>
        </SafeAreaProvider>
    )
}

Open Modal, Close Modal

import {openModal} from 'react-native-card-modal-reanimated';

export declare const openModal: (name: string, params?: any) => void | undefined;
export declare const closeModal: (name?: string) => void | undefined;

Prepare Modal

prepared modal exsit always

import {openModal} from 'react-native-card-modal-reanimated';

export declare const addPrepared: (name: string, params?: any) => void | undefined;
export declare const clearPrepared: (name: string) => void | undefined;

createSlideModal

declare const createSlideModal: (modals: Array<ModalType>) => (props: {
    children: React.ReactNode;  // main page
    toggleStatusBarStyle?: boolean;  // toggle status bar style, default true
}) => JSX.Element;

declare type ModalType = {
    name: string;
    title: string | ((params: any) => string);
    hideHeaderButton?: boolean;  // default false
    hideHeader?: boolean; // default false
    component: any; // modal component
};

Modal props

declare type ModalNavigation = {
    params: any;  // params state
    setParams: (params: any) => void; // like setState
    close: () => void; // close self
    gestureHandler: {  // gesture controller
        onHandlerStateChange: (...args: any[]) => void;
        onGestureEvent: (...args: any[]) => void;
    };
    onModalDidFocus: (callback: () => void) => (() => void);  // invoke callback on modal did focus
};

Custom Header

Modal C example

Example

The source code for the example (showcase) app is under the Example/ directory. If you want to play with the API but don't feel like trying it on a real app, you can run the example project. Clone the repo, go to the Example/ folder and run:

yarn

Running on iOS

Before running the app, install the cocoapods dependencies:

cd ios && pod install && cd ..

Now, you can start the app:

react-native run-ios

Running on Android

Run the react native's cli command:

react-native run-android

Important:

You will need to have an Android or iOS device or emulator connected as well as react-native-cli package installed globally.

License

MIT. Copyright (c) 2020 Daniel Bryan.