0.1.10 • Published 2 years ago

react-native-imperative-things v0.1.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Native Imperative Things 💉

Call pickers and modals from anywhere in the app

Installation

Non Expo

yarn add react-native-imperative-things react-native-modal-datetime-picker @react-native-community/datetimepicker
npm install react-native-imperative-things react-native-modal-datetime-picker @react-native-community/datetimepicker

Expo

expo install react-native-imperative-things react-native-modal-datetime-picker @react-native-community/datetimepicker

Usage

Add the following near the root of your app

import {ImperativeThingsPortal} from 'react-native-imperative-things';

const App = () => {
    return (
        <OtherProviders>
            <ImperativeThingsPortal include={['date-picker']}/> // <-- Add this
            <TheRestOfYourApp/>
        </OtherProviders>
    );
};

Now you're able to do the following, anywhere in the app, even outside of components

import {datePicker} from 'react-native-imperative-things';

datePicker.show({
    onSuccess: (date: Date) => {/*Do stuff*/},
    componentProps: {/*Props that will be passed to the date picker*/},
});

//OR

const selectedDate = await datePicker.showAsync({
    onSuccess: (date: Date) => {/* The return of this will be stored in selectedDate */},
    componentProps: {/*Props that will be passed to the date picker*/},
});

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago