Differentiate keyboardavoiding behavior based on ios/android
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
|||||||
Dimensions,
|
Dimensions,
|
||||||
KeyboardAvoidingView,
|
KeyboardAvoidingView,
|
||||||
Modal,
|
Modal,
|
||||||
|
Platform,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
View,
|
View,
|
||||||
@@ -13,6 +14,10 @@ import CloseIcon from './close-icon'
|
|||||||
|
|
||||||
import { Sizes, Spacing } from '../../styles'
|
import { Sizes, Spacing } from '../../styles'
|
||||||
|
|
||||||
|
const keyboardVerticalOffsetPlatformDependent = Platform.OS === 'ios' ? 40 : 0
|
||||||
|
const keyboardBehaviorPlatformDependent =
|
||||||
|
Platform.OS === 'ios' ? 'position' : 'padding'
|
||||||
|
|
||||||
const AppModal = ({ children, onClose }) => (
|
const AppModal = ({ children, onClose }) => (
|
||||||
<Modal
|
<Modal
|
||||||
animationType="fade"
|
animationType="fade"
|
||||||
@@ -20,7 +25,11 @@ const AppModal = ({ children, onClose }) => (
|
|||||||
transparent={true}
|
transparent={true}
|
||||||
visible={true}
|
visible={true}
|
||||||
>
|
>
|
||||||
<KeyboardAvoidingView behavior={'padding'} style={styles.safeAreaView}>
|
<KeyboardAvoidingView
|
||||||
|
keyboardVerticalOffset={keyboardVerticalOffsetPlatformDependent}
|
||||||
|
behavior={keyboardBehaviorPlatformDependent}
|
||||||
|
style={styles.safeAreaView}
|
||||||
|
>
|
||||||
<TouchableOpacity onPress={onClose} style={styles.blackBackground} />
|
<TouchableOpacity onPress={onClose} style={styles.blackBackground} />
|
||||||
<View style={styles.modalWindow}>
|
<View style={styles.modalWindow}>
|
||||||
<View style={styles.headerContainer}>
|
<View style={styles.headerContainer}>
|
||||||
|
|||||||
Reference in New Issue
Block a user