Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #98 from Wilsonator5000/iphone-x-padding
Browse files Browse the repository at this point in the history
Fix padding for iPhone X
  • Loading branch information
halilb committed Oct 28, 2019
2 parents 6d2bc2e + b34bdfd commit 097f8ea
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3955,10 +3955,16 @@ react-native-drawer-layout@1.3.2:
dependencies:
react-native-dismiss-keyboard "1.0.0"

react-native-iphone-x-helper@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.2.1.tgz#645e2ffbbb49e80844bb4cbbe34a126fda1e6772"
integrity sha512-/VbpIEp8tSNNHIvstuA3Swx610whci1Zpc9mqNkqn14DkMbw+ORviln2u0XyHG1kPvvwTNGZY6QpeFwxYaSdbQ==

"react-native-photo-browser@file:..":
version "0.5.0"
dependencies:
prop-types "15.5.10"
react-native-iphone-x-helper "^1.2.1"
react-native-progress "^3.2.0"

react-native-progress@^3.2.0:
Expand Down
3 changes: 3 additions & 0 deletions lib/GridContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
ViewPropTypes
} from 'react-native';

import { ifIphoneX } from 'react-native-iphone-x-helper';

import Constants from './constants';
import { Photo } from './media';

Expand Down Expand Up @@ -98,6 +100,7 @@ export default class GridContainer extends React.Component {
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: ifIphoneX(18, 0),
paddingBottom: Constants.TOOLBAR_HEIGHT,
},
row: {
Expand Down
5 changes: 4 additions & 1 deletion lib/bar/BarContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
ViewPropTypes
} from 'react-native';

import { getBottomSpace } from 'react-native-iphone-x-helper';

const BAR_POSITIONS = {
TOP: 'top',
BOTTOM: 'bottom',
Expand Down Expand Up @@ -53,7 +55,7 @@ class BarContainer extends Component {
styles.container,
isBottomBar ? styles.bottomBar : styles.topBar,
{
height,
height: height + (isBottomBar ? getBottomSpace() : 0),
opacity: this.state.animation,
transform: [{
translateY: this.state.animation.interpolate({
Expand Down Expand Up @@ -84,6 +86,7 @@ const styles = StyleSheet.create({
},
bottomBar: {
bottom: 0,
paddingBottom: getBottomSpace(),
},
});

Expand Down
6 changes: 4 additions & 2 deletions lib/bar/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
Platform,
} from 'react-native';

import { ifIphoneX } from 'react-native-iphone-x-helper';

import { BarContainer } from './BarContainer';

export default class TopBar extends React.Component {
Expand Down Expand Up @@ -58,7 +60,7 @@ export default class TopBar extends React.Component {
<BarContainer
style={styles.container}
displayed={displayed}
height={height}
height={height + ifIphoneX(18, 0)}
>
{this.renderBackButton()}
<Text style={styles.text}>{title}</Text>
Expand All @@ -72,7 +74,7 @@ const styles = StyleSheet.create({
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
paddingTop: 30,
paddingTop: ifIphoneX(48, 30),
},
text: {
fontSize: 18,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"author": "Halil Bilir <hbilir@gmail.com>",
"homepage": "https://github.com/halilb/react-native-photo-browser#readme",
"dependencies": {
"react-native-iphone-x-helper": "^1.2.1",
"react-native-progress": "^3.2.0",
"prop-types": "15.5.10"
}
Expand Down

0 comments on commit 097f8ea

Please sign in to comment.