Skip to content

Commit

Permalink
Merge pull request #150 from alimek/master
Browse files Browse the repository at this point in the history
add margin bottom for iPhone X
  • Loading branch information
mmazzarolo authored Mar 28, 2018
2 parents ba5fe82 + a082735 commit 3c5d6f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/CustomDatePickerIOS/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class CustomDatePickerIOS extends React.PureComponent {
isVisible: false,
onHideAfterConfirm: () => {},
reactNativeModalPropsIOS: {},
onDateChange: Function.prototype
onDateChange: () => {},
};

state = {
Expand Down Expand Up @@ -175,11 +175,11 @@ export default class CustomDatePickerIOS extends React.PureComponent {
>
<DatePickerComponent
ref={pickerRefCb}
date={this.state.date}
mode={mode}
onDateChange={this._handleDateChange}
minuteInterval={this.state.minuteInterval}
{...otherProps}
date={this.state.date}
onDateChange={this._handleDateChange}
/>
</View>
<TouchableHighlight
Expand Down
14 changes: 13 additions & 1 deletion src/CustomDatePickerIOS/index.style.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { StyleSheet } from "react-native";
import { StyleSheet, Dimensions, Platform } from "react-native";

export const isIphoneX = () => {
const { height, width } = Dimensions.get("window");

return (
Platform.OS === "ios" &&
!Platform.isPad &&
!Platform.isTVOS &&
(height === 812 || width === 812)
);
};

const BORDER_RADIUS = 13;
const BACKGROUND_COLOR = "white";
Expand Down Expand Up @@ -49,6 +60,7 @@ export default StyleSheet.create({
backgroundColor: BACKGROUND_COLOR,
borderRadius: BORDER_RADIUS,
height: 57,
marginBottom: isIphoneX() ? 20 : 0,
justifyContent: "center"
},
cancelText: {
Expand Down

0 comments on commit 3c5d6f4

Please sign in to comment.