From dc1545b4c46bf8d83f6db242d9211be66b59eee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Barbet?= Date: Thu, 20 Jun 2019 14:28:25 +0000 Subject: [PATCH] `alwaysOpen` props to keep the modal visible * Initial work * Fix watch scripts for examples * Transition on overlay * Fix watch script for RN * Add examples * Update docs * Fix post version script --- docs/PROPSMETHODS.md | 10 +++ examples/expo/App.js | 10 +-- examples/expo/src/components/footer/Footer.js | 26 ------- examples/expo/src/components/header/Header.js | 15 +++-- .../expo/src/components/modals/AlwaysOpen.js | 67 +++++++++++++++++++ .../src/components/footer/Footer.js | 26 ------- .../src/components/header/Header.js | 15 +++-- .../src/screens/AlwaysOpen.js | 67 +++++++++++++++++++ .../src/screens/App.js | 10 ++- examples/react-navigation/App.js | 10 +-- .../src/components/footer/Footer.js | 26 ------- .../src/components/header/Header.js | 15 +++-- .../src/components/modals/AlwaysOpen.js | 67 +++++++++++++++++++ package.json | 4 +- post-version.sh | 8 +-- src/Modalize.tsx | 52 ++++++++++---- src/Options.ts | 5 ++ 17 files changed, 304 insertions(+), 129 deletions(-) delete mode 100644 examples/expo/src/components/footer/Footer.js create mode 100644 examples/expo/src/components/modals/AlwaysOpen.js delete mode 100644 examples/react-native-navigation/src/components/footer/Footer.js create mode 100644 examples/react-native-navigation/src/screens/AlwaysOpen.js delete mode 100644 examples/react-navigation/src/components/footer/Footer.js create mode 100644 examples/react-navigation/src/components/modals/AlwaysOpen.js diff --git a/docs/PROPSMETHODS.md b/docs/PROPSMETHODS.md index 73e8fbf9..11bc7a08 100644 --- a/docs/PROPSMETHODS.md +++ b/docs/PROPSMETHODS.md @@ -22,6 +22,16 @@ The value you pass is the height of the modal before being full opened. | -------- | -------- | | number | No | +### `alwaysOpen` + +A number that will make the modal visible all the time. You can still [open](/PROPSMETHODS.md?id=open) and [close](/PROPSMETHODS.md?id=close) it, using the build-in methods. + +The value you pass is the height of the visible part of the modal on top of the screen. + +| Type | Required | +| -------- | -------- | +| number | No | + ### `handlePosition` Define where the handle on top of the modal should be positioned. diff --git a/examples/expo/App.js b/examples/expo/App.js index 2657c108..210625b1 100644 --- a/examples/expo/App.js +++ b/examples/expo/App.js @@ -2,7 +2,6 @@ import React from 'react'; import { Layout } from './src/components/layout/Layout'; import { Header } from './src/components/header/Header'; -import { Footer } from './src/components/footer/Footer'; import { Button } from './src/components/button/Button'; import { AbsoluteHeader } from './src/components/modals/AbsoluteHeader'; import { SimpleContent } from './src/components/modals/SimpleContent'; @@ -11,6 +10,7 @@ import { SnappingList } from './src/components/modals/SnappingList'; import { CustomStyle } from './src/components/modals/CustomStyle'; import { FlatList } from './src/components/modals/FlatList'; import { SectionList } from './src/components/modals/SectionList'; +import { AlwaysOpen } from './src/components/modals/AlwaysOpen'; export default () => { const modal = []; @@ -27,10 +27,7 @@ export default () => { return ( -
+
{renderButtons([ 'Modal with a simple content', @@ -42,8 +39,6 @@ export default () => { 'Modal with a Section List', ])} -