Skip to content

Commit 15d4dd4

Browse files
machourHoussein Djirdeh
authored andcommitted
feat: support iPhone X (#707)
* feat: support iPhone X notch * chore: some ui adjustments to demo * fix: remove unwanted code * feat: add isIphoneX() and use it * test: mock react-native-device-info * chore: cleaner 3x image
1 parent 521ce15 commit 15d4dd4

File tree

14 files changed

+41
-76
lines changed

14 files changed

+41
-76
lines changed

ios/GitPoint/Images.xcassets/Contents.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
"version" : 1,
44
"author" : "xcode"
55
}
6-
}
6+
}

ios/GitPoint/Images.xcassets/LaunchImage-2.launchimage/Contents.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

ios/GitPoint/Images.xcassets/LaunchImage-3.launchimage/Contents.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

ios/GitPoint/Images.xcassets/LaunchImage-4.launchimage/Contents.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

ios/GitPoint/Images.xcassets/LaunchImage.launchimage/Contents.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@
3636
"scale": "3x",
3737
"subtype": "736h"
3838
},
39+
{
40+
"extent": "full-screen",
41+
"idiom": "iphone",
42+
"filename": "Default-Portrait-2436h@3x.png",
43+
"minimum-system-version": "11.0",
44+
"orientation": "portrait",
45+
"scale": "3x",
46+
"subtype": "2436h"
47+
},
3948
{
4049
"extent": "full-screen",
4150
"idiom": "iphone",
32.2 KB
Loading

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"react-native-communications": "^2.2.1",
7373
"react-native-config": "^0.6.0",
7474
"react-native-cookies": "^3.2.0",
75-
"react-native-device-info": "^0.11.0",
75+
"react-native-device-info": "^0.15.1",
7676
"react-native-elements": "^0.18.2",
7777
"react-native-htmlview": "^0.12.0",
7878
"react-native-i18n": "^2.0.4",
@@ -87,7 +87,7 @@
8787
"react-native-syntax-highlighter": "^1.2.1",
8888
"react-native-table-component": "^1.1.0",
8989
"react-native-vector-icons": "^4.4.0",
90-
"react-navigation": "^1.0.0-beta.11",
90+
"react-navigation": "^1.0.0-beta.27",
9191
"react-redux": "^5.0.2",
9292
"react-syntax-highlighter": "^5.6.2",
9393
"redux": "^3.6.0",

src/components/parallax-scroll.component.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { Icon } from 'react-native-elements';
55
import styled from 'styled-components';
66

77
import { colors, normalize, fonts } from 'config';
8+
import { isIphoneX } from 'utils';
89

9-
const STICKY_HEADER_HEIGHT = 62;
10+
const STICKY_HEADER_HEIGHT = isIphoneX() ? 76 : 62;
1011

1112
type Props = {
1213
renderContent: any,

src/notifications/screens/notifications.screen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
NotificationListItem,
1616
} from 'components';
1717
import { colors, fonts, normalize } from 'config';
18-
import { translate } from 'utils';
18+
import { isIphoneX, translate } from 'utils';
1919
import {
2020
getUnreadNotifications,
2121
getParticipatingNotifications,
@@ -55,7 +55,7 @@ const mapDispatchToProps = dispatch =>
5555

5656
const ButtonGroupWrapper = styled.View`
5757
background-color: ${colors.greyLight};
58-
padding-top: ${Platform.OS === 'ios' ? 30 : 10};
58+
padding-top: ${Platform.OS === 'ios' ? (isIphoneX() ? 40 : 30) : 10};
5959
padding-bottom: 10;
6060
margin-bottom: 15;
6161
`;

src/search/screens/search.screen.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
SearchBar,
2121
} from 'components';
2222
import { colors, fonts, normalize } from 'config';
23-
import { translate } from 'utils';
23+
import { isIphoneX, translate } from 'utils';
2424
import { searchRepos, searchUsers } from '../index';
2525

2626
const mapStateToProps = state => ({
@@ -43,7 +43,14 @@ const mapDispatchToProps = dispatch =>
4343
const styles = StyleSheet.create({
4444
searchBarWrapper: {
4545
flexDirection: 'row',
46-
marginTop: Platform.OS === 'ios' ? 20 : 5,
46+
...Platform.select({
47+
ios: {
48+
marginTop: isIphoneX() ? 30 : 20,
49+
},
50+
android: {
51+
marginTop: 5,
52+
},
53+
}),
4754
},
4855
searchContainer: {
4956
width: Dimensions.get('window').width,
@@ -217,7 +224,8 @@ class Search extends Component {
217224
showsCancelButton={this.state.searchFocus}
218225
onFocus={() => this.setState({ searchFocus: true })}
219226
onCancelButtonPress={() =>
220-
this.setState({ searchStart: false, query: '' })}
227+
this.setState({ searchStart: false, query: '' })
228+
}
221229
onSearchButtonPress={text => {
222230
this.search(text);
223231
}}

0 commit comments

Comments
 (0)