# react-native-remodal

> A "re" implementation of the classic react native modal

Latest version **1.0.0-alpha.9** (published 2019-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-remodal
pnpm add react-native-remodal
yarn add react-native-remodal
bun add react-native-remodal
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-alpha.9 |
| Published | 2019-09-20 |
| First published | 2019-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Brendon Sled |
| Maintainers | brendonsled |
| Keywords | modal, react, react, native |

## Links

- npm: https://www.npmjs.com/package/react-native-remodal
- Repository: https://github.com/BrendonSled/react-native-remodal
- Homepage: https://github.com/BrendonSled/react-native-remodal#readme
- Issues: https://github.com/BrendonSled/react-native-remodal/issues
- npm.io page: https://npm.io/package/react-native-remodal

## Dependencies (1)

- [cuid](https://npm.io/package/cuid.md) ^2.1.6

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0-alpha.9 (latest) — 2019-09-20
- 1.0.0-alpha.8 — 2019-09-19
- 1.0.0-alpha.7 — 2019-09-19
- 1.0.0-alpha.6 — 2019-09-18
- 1.0.0-alpha.5 — 2019-09-18
- 1.0.0-alpha.4 — 2019-09-17
- 1.0.0-alpha.2 — 2019-09-17
- 1.0.0-alpha.1 — 2019-09-17

## README

# React Navigation ReModal

![Recording](recording.gif)

# Getting Started

**Requirements**

```
react-native-reanimated
```

1. Installation

```
npm install react-native-remodal
```

2. Wrap your root component with the `ReModalProvider`

```tsx
<ReModalProvider>...</ReModalProvider>
```

3. Use it!

```tsx
<ReModal isVisible={open} onCancel={() => setOpen(false)}>
    ...
</ReModal>
```

# Props

## `<ReModal/>`

-   `children`: React.ReactElement;
-   `isVisible`: boolean;
-   `onCancel`?: () => void;
-   `autoCloseWhenOpeningNextDialog`?: boolean;
-   `modalAnimationFunction`?: (gestureState: Animated.Adaptable<number>, opacity: Animated.Adaptable<number>, modalLayout?: {
          width: Animated.Adaptable<number>;
          height: Animated.Adaptable<number>;
    })=> any;
-   `onModalShow`?: () => void;
-   `onModalHide`?: () => void;
-   `containerStyle`?: ViewStyle;
-   `onShowConfig`?: AnimationConfigs;
-   `onHideConfig`?: AnimationConfigs;

## AnimationConfigs

-   `duration`: number;
-   `easing`: Animated.EasingFunction;

# Full Example

```tsx
import React, { useState } from 'react';
import { Button, Dimensions, Text, View } from 'react-native';
import { ReModel } from 'react-native-remodal';

export default function ModalTest(props) {
    const [open1, setOpen1] = useState(false);
    const [open2, setOpen2] = useState(false);

    return (
        <View style={{ alignItems: 'center', justifyContent: 'center', flex: 1 }}>
            <ReModel isVisible={open1} onCancel={() => setOpen1(false)}>
                <View style={{ width: Dimensions.get('window').width * 0.8, backgroundColor: '#fff', padding: 32 }}>
                    <Text>This is a test!</Text>
                    <Button onPress={() => setOpen2(true)} title="Show Modal #2" />
                </View>
            </ReModel>
            <ReModel isVisible={open2} onCancel={() => setOpen2(false)}>
                <View style={{ width: Dimensions.get('window').width * 0.8, backgroundColor: '#fff', padding: 32 }}>
                    <Text>This is another modal!</Text>
                </View>
            </ReModel>
            <Button onPress={() => setOpen1(true)} title="Show Modal #1" />
            <Button onPress={() => setOpen2(true)} title="Show Modal #2" />
        </View>
    );
}
```

---
_Source: https://npm.io/package/react-native-remodal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
