From 8e1f2f963396ee83330f4c2b21b68a4cab132e7f Mon Sep 17 00:00:00 2001 From: Dmitriy Kolesnikov Date: Fri, 31 Jan 2020 12:54:53 +0100 Subject: [PATCH 1/5] fix: tap on text input clear button on ios --- examples/expo/src/components/modals/FixedContent.js | 6 +++++- examples/expo/src/components/modals/SimpleContent.js | 6 +++++- .../react-native-navigation/src/screens/FixedContent.js | 6 +++++- .../react-native-navigation/src/screens/SimpleContent.js | 6 +++++- .../react-navigation/src/components/modals/FixedContent.js | 6 +++++- .../react-navigation/src/components/modals/SimpleContent.js | 6 +++++- src/index.tsx | 5 ++++- 7 files changed, 34 insertions(+), 7 deletions(-) diff --git a/examples/expo/src/components/modals/FixedContent.js b/examples/expo/src/components/modals/FixedContent.js index 7d0ed785..fc71e024 100644 --- a/examples/expo/src/components/modals/FixedContent.js +++ b/examples/expo/src/components/modals/FixedContent.js @@ -12,7 +12,11 @@ export class FixedContent extends React.PureComponent { {'Last step'.toUpperCase()} Send the message? {faker.lorem.paragraph()} - + {'Send'.toUpperCase()} diff --git a/examples/expo/src/components/modals/SimpleContent.js b/examples/expo/src/components/modals/SimpleContent.js index 66cc2819..8ff0e9ed 100644 --- a/examples/expo/src/components/modals/SimpleContent.js +++ b/examples/expo/src/components/modals/SimpleContent.js @@ -38,7 +38,11 @@ export class SimpleContent extends React.PureComponent { ))} - + , ]; diff --git a/examples/react-native-navigation/src/screens/FixedContent.js b/examples/react-native-navigation/src/screens/FixedContent.js index 2ade8fdf..91b1dda1 100644 --- a/examples/react-native-navigation/src/screens/FixedContent.js +++ b/examples/react-native-navigation/src/screens/FixedContent.js @@ -33,7 +33,11 @@ export class FixedContent extends React.PureComponent { {'Last step'.toUpperCase()} Send the message? {faker.lorem.paragraph()} - + {'Send'.toUpperCase()} diff --git a/examples/react-native-navigation/src/screens/SimpleContent.js b/examples/react-native-navigation/src/screens/SimpleContent.js index c9684846..8d0e00f9 100644 --- a/examples/react-native-navigation/src/screens/SimpleContent.js +++ b/examples/react-native-navigation/src/screens/SimpleContent.js @@ -53,7 +53,11 @@ export class SimpleContent extends React.PureComponent { ))} - + , ]; diff --git a/examples/react-navigation/src/components/modals/FixedContent.js b/examples/react-navigation/src/components/modals/FixedContent.js index 34356982..86cabc4e 100644 --- a/examples/react-navigation/src/components/modals/FixedContent.js +++ b/examples/react-navigation/src/components/modals/FixedContent.js @@ -24,7 +24,11 @@ export class FixedContent extends React.PureComponent { {'Last step'.toUpperCase()} Send the message? {faker.lorem.paragraph()} - + {'Send'.toUpperCase()} diff --git a/examples/react-navigation/src/components/modals/SimpleContent.js b/examples/react-navigation/src/components/modals/SimpleContent.js index 2b2591d4..e5e6cb85 100644 --- a/examples/react-navigation/src/components/modals/SimpleContent.js +++ b/examples/react-navigation/src/components/modals/SimpleContent.js @@ -44,7 +44,11 @@ export class SimpleContent extends React.PureComponent { ))} - + , ]; diff --git a/src/index.tsx b/src/index.tsx index b63857cf..d2cba418 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -696,7 +696,10 @@ export class Modalize extends React.C ref={this.modal} maxDurationMs={100000} maxDeltaY={lastSnap} - enabled={panGestureEnabled} + enabled={Platform.select({ + ios: false, + android: panGestureEnabled, + })} > {showContent && ( From 2de790edb426a3a95fc26a17780954fb2f436a6f Mon Sep 17 00:00:00 2001 From: Dmitriy Kolesnikov Date: Fri, 31 Jan 2020 12:57:24 +0100 Subject: [PATCH 2/5] fix: enable nested horizontal scroll (ScrollView from RN) --- examples/expo/src/components/modals/SimpleContent.js | 3 +-- examples/react-native-navigation/src/screens/SimpleContent.js | 3 +-- .../react-navigation/src/components/modals/SimpleContent.js | 3 +-- src/index.tsx | 3 +++ 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/expo/src/components/modals/SimpleContent.js b/examples/expo/src/components/modals/SimpleContent.js index 8ff0e9ed..67bdca0c 100644 --- a/examples/expo/src/components/modals/SimpleContent.js +++ b/examples/expo/src/components/modals/SimpleContent.js @@ -1,6 +1,5 @@ import React from 'react'; -import { StyleSheet, Text, View, Dimensions, TextInput } from 'react-native'; -import { ScrollView } from 'react-native-gesture-handler'; +import { StyleSheet, Text, View, Dimensions, TextInput, ScrollView } from 'react-native'; import { Modalize } from 'react-native-modalize'; import faker from 'faker'; diff --git a/examples/react-native-navigation/src/screens/SimpleContent.js b/examples/react-native-navigation/src/screens/SimpleContent.js index 8d0e00f9..3541174f 100644 --- a/examples/react-native-navigation/src/screens/SimpleContent.js +++ b/examples/react-native-navigation/src/screens/SimpleContent.js @@ -1,6 +1,5 @@ import React from 'react'; -import { StyleSheet, Text, View, Dimensions, TextInput } from 'react-native'; -import { ScrollView } from 'react-native-gesture-handler'; +import { StyleSheet, Text, View, Dimensions, TextInput, ScrollView } from 'react-native'; import { Navigation } from 'react-native-navigation'; import { Modalize } from 'react-native-modalize'; import faker from 'faker'; diff --git a/examples/react-navigation/src/components/modals/SimpleContent.js b/examples/react-navigation/src/components/modals/SimpleContent.js index e5e6cb85..4cd94568 100644 --- a/examples/react-navigation/src/components/modals/SimpleContent.js +++ b/examples/react-navigation/src/components/modals/SimpleContent.js @@ -1,6 +1,5 @@ import React from 'react'; -import { StyleSheet, Text, View, Dimensions, TextInput } from 'react-native'; -import { ScrollView } from 'react-native-gesture-handler'; +import { StyleSheet, Text, View, Dimensions, TextInput, ScrollView } from 'react-native'; import { Modalize } from 'react-native-modalize'; import faker from 'faker'; diff --git a/src/index.tsx b/src/index.tsx index d2cba418..0ec97642 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -596,6 +596,9 @@ export class Modalize extends React.C onGestureEvent={Animated.event([{ nativeEvent: { translationY: this.dragY } }], { useNativeDriver, })} + minDist={20} + activeOffsetY={20} + activeOffsetX={20} onHandlerStateChange={this.onHandleChildren} > Date: Fri, 31 Jan 2020 12:58:24 +0100 Subject: [PATCH 3/5] fix: statusbar.currentheight is available on android only --- src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 0ec97642..9c7f484f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -86,7 +86,7 @@ export class Modalize extends React.C const fullHeight = isIos ? screenHeight - : screenHeight - (isIos ? StatusBar.currentHeight || 0 : 10); + : screenHeight - (StatusBar.currentHeight || 0); const computedHeight = fullHeight - this.handleHeight - (isIphoneX ? 34 : 0); const modalHeight = props.modalHeight || computedHeight; From 652729188303da86d72fa525a8bec46140cdf7a2 Mon Sep 17 00:00:00 2001 From: Dmitriy Kolesnikov Date: Fri, 31 Jan 2020 13:00:20 +0100 Subject: [PATCH 4/5] fix: avoid_keyboard_like_ios should be false on android by default --- examples/expo/src/components/modals/FixedContent.js | 2 +- examples/expo/src/components/modals/SimpleContent.js | 1 - examples/react-native-navigation/src/screens/FixedContent.js | 1 - examples/react-native-navigation/src/screens/SimpleContent.js | 1 - examples/react-navigation/src/components/modals/FixedContent.js | 2 +- .../react-navigation/src/components/modals/SimpleContent.js | 1 - 6 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/expo/src/components/modals/FixedContent.js b/examples/expo/src/components/modals/FixedContent.js index fc71e024..c79730fe 100644 --- a/examples/expo/src/components/modals/FixedContent.js +++ b/examples/expo/src/components/modals/FixedContent.js @@ -39,7 +39,7 @@ export class FixedContent extends React.PureComponent { render() { return ( - + {this.renderContent()} ); diff --git a/examples/expo/src/components/modals/SimpleContent.js b/examples/expo/src/components/modals/SimpleContent.js index 67bdca0c..26da9d68 100644 --- a/examples/expo/src/components/modals/SimpleContent.js +++ b/examples/expo/src/components/modals/SimpleContent.js @@ -59,7 +59,6 @@ export class SimpleContent extends React.PureComponent { showsVerticalScrollIndicator: false, stickyHeaderIndices: [0], }} - avoidKeyboardLikeIOS > {this.renderContent()} diff --git a/examples/react-native-navigation/src/screens/FixedContent.js b/examples/react-native-navigation/src/screens/FixedContent.js index 91b1dda1..88971892 100644 --- a/examples/react-native-navigation/src/screens/FixedContent.js +++ b/examples/react-native-navigation/src/screens/FixedContent.js @@ -52,7 +52,6 @@ export class FixedContent extends React.PureComponent { ref={this.modal} onClosed={this.onClosed} adjustToContentHeight - avoidKeyboardLikeIOS > {this.renderContent()} diff --git a/examples/react-native-navigation/src/screens/SimpleContent.js b/examples/react-native-navigation/src/screens/SimpleContent.js index 3541174f..c7d15e89 100644 --- a/examples/react-native-navigation/src/screens/SimpleContent.js +++ b/examples/react-native-navigation/src/screens/SimpleContent.js @@ -69,7 +69,6 @@ export class SimpleContent extends React.PureComponent { showsVerticalScrollIndicator: false, stickyHeaderIndices: [0], }} - avoidKeyboardLikeIOS > {this.renderContent()} diff --git a/examples/react-navigation/src/components/modals/FixedContent.js b/examples/react-navigation/src/components/modals/FixedContent.js index 86cabc4e..0d79fd22 100644 --- a/examples/react-navigation/src/components/modals/FixedContent.js +++ b/examples/react-navigation/src/components/modals/FixedContent.js @@ -39,7 +39,7 @@ export class FixedContent extends React.PureComponent { render() { return ( - + {this.renderContent()} ); diff --git a/examples/react-navigation/src/components/modals/SimpleContent.js b/examples/react-navigation/src/components/modals/SimpleContent.js index 4cd94568..79f76f68 100644 --- a/examples/react-navigation/src/components/modals/SimpleContent.js +++ b/examples/react-navigation/src/components/modals/SimpleContent.js @@ -59,7 +59,6 @@ export class SimpleContent extends React.PureComponent { showsVerticalScrollIndicator: false, stickyHeaderIndices: [0], }} - avoidKeyboardLikeIOS > {this.renderContent()} From 3da96313343e63c7b67b04cd68ae446b327af9c3 Mon Sep 17 00:00:00 2001 From: Dmitriy Kolesnikov Date: Fri, 31 Jan 2020 16:58:04 +0100 Subject: [PATCH 5/5] feat: modal top offset prop --- src/index.tsx | 8 +++++--- src/options.ts | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 9c7f484f..637206dd 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -48,6 +48,10 @@ export class Modalize extends React.C ios: true, android: false, }), + modalTopOffset: Platform.select({ + ios: 0, + android: StatusBar.currentHeight || 0, + }), panGestureEnabled: true, closeOnOverlayTap: true, withReactModal: false, @@ -84,9 +88,7 @@ export class Modalize extends React.C constructor(props: IProps) { super(props); - const fullHeight = isIos - ? screenHeight - : screenHeight - (StatusBar.currentHeight || 0); + const fullHeight = screenHeight - props.modalTopOffset!; const computedHeight = fullHeight - this.handleHeight - (isIphoneX ? 34 : 0); const modalHeight = props.modalHeight || computedHeight; diff --git a/src/options.ts b/src/options.ts index 1f718c9e..05a5591c 100644 --- a/src/options.ts +++ b/src/options.ts @@ -46,6 +46,11 @@ export interface IProps { */ modalHeight?: number; + /** + * A number to define the modal's top offset + */ + modalTopOffset?: number; + /** * Using this props will show the modal all the time, and the number represents how expanded the modal has to be */