Skip to content
This repository was archived by the owner on Mar 30, 2022. It is now read-only.

Commit f6a2262

Browse files
committed
fixed android layout issues
1 parent fbcba61 commit f6a2262

File tree

7 files changed

+59
-24
lines changed

7 files changed

+59
-24
lines changed

index.android.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
import React from 'react'
22
import { AppRegistry } from 'react-native'
3-
import { Provider } from 'react-redux'
4-
import AppRootContainer from './src'
5-
import configureStore from './src/store/configureStore'
6-
7-
const store = configureStore()
3+
import AppRootContainer from './src/AppRootContainer'
84

95
const HackathonStarter = () => (
10-
<Provider store={store}>
11-
<AppRootContainer />
12-
</Provider>
6+
<AppRootContainer />
137
)
148

159
AppRegistry.registerComponent('HackathonStarter', () => HackathonStarter)

src/App.js

+15-3
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,25 @@ class App extends Component {
5252
<About />
5353
</TabNavigator.Item>
5454
<TabNavigator.Item
55-
tabStyle={selectedTab !== 'contact' && { marginBottom: -6 }}
55+
tabStyle={[
56+
selectedTab !== 'contact' && { marginBottom: -6 },
57+
selectedTab === 'contact' && Platform.OS === 'android' && {marginBottom: -3}
58+
]}
5659
titleStyle={[styles.titleStyle, {marginTop: -1}]}
57-
selectedTitleStyle={[styles.titleSelected, {marginTop: -3, marginBottom: 7}]}
60+
selectedTitleStyle={[
61+
styles.titleSelected,
62+
{marginBottom: 7},
63+
Platform.OS === 'android' ? {marginTop: 1 } : {marginTop: -3}
64+
]}
5865
selected={selectedTab === 'contact'}
5966
title={selectedTab === 'contact' ? 'CONTACT' : null}
6067
renderIcon={() => <Icon style={{paddingBottom: 4}} color={colors.grey2} name='contacts' size={26} />}
61-
renderSelectedIcon={() => <Icon color={colors.primary} name='contacts' size={26} />}
68+
renderSelectedIcon={() => (
69+
<Icon
70+
color={colors.primary}
71+
name='contacts'
72+
size={Platform.OS === 'ios' ? 26 : 22 } />
73+
)}
6274
onPress={() => this.changeTab('contact')}>
6375
<Contact />
6476
</TabNavigator.Item>

src/about/About.js

-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class About extends Component {
5555
<View key={i} style={styles.user}>
5656
<Image
5757
style={styles.image}
58-
resizeMode='center'
5958
source={{uri: u.avatar}} />
6059
<RNEText style={styles.name}>{u.name}</RNEText>
6160
</View>
@@ -86,9 +85,6 @@ class About extends Component {
8685
<RNESocialIcon
8786
type='tumblr'
8887
/>
89-
<RNESocialIcon
90-
type='youtube'
91-
/>
9288
</View>
9389
</RNECard>
9490
<RNECard

src/components/nav/NavBar.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import Icon from 'react-native-vector-icons/MaterialIcons'
1111

1212
let styles = {}
1313

14-
const NavigationBar = () => {
15-
const src = require('image!logo')
14+
const NavigationBar = () => {
1615
const LeftButton = (route, navigator, index, navState) => {
1716
if (index > 0) {
1817
const leftAction = navigator.pop
@@ -37,7 +36,7 @@ const NavigationBar = () => {
3736
)
3837
}
3938
return (
40-
<NavTitleIcon src={src} />
39+
<NavTitleIcon />
4140
)
4241
}
4342

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* @providesModule HSNavTitleIcon
3+
*/
4+
5+
import React from 'react'
6+
import { View, Image, StyleSheet, Dimensions } from 'react-native'
7+
const { width } = Dimensions.get('window')
8+
9+
let styles = {}
10+
11+
const NavTitleIcon = () => (
12+
<View style={styles.iconContainer}>
13+
<Image
14+
source={require('../../images/logo.png')}
15+
style={styles.logo} />
16+
</View>
17+
)
18+
19+
styles = StyleSheet.create({
20+
iconContainer: {
21+
flex: 1,
22+
width: width - 140,
23+
justifyContent: 'center',
24+
alignItems: 'center'
25+
},
26+
logo: {
27+
width: 136,
28+
height: 28,
29+
resizeMode: 'contain'
30+
}
31+
})
32+
33+
export default NavTitleIcon

src/components/nav/NavTitleIcon.js renamed to src/components/nav/NavTitleIcon.ios.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ import { View, Image, StyleSheet } from 'react-native'
77

88
let styles = {}
99

10-
const NavTitleIcon = ({src}) => (
11-
<View>
10+
const NavTitleIcon = () => (
11+
<View style={styles.iconContainer}>
1212
<Image
13-
source={src}
13+
source={require('image!logo')}
1414
style={styles.logo} />
1515
</View>
1616
)
1717

1818
styles = StyleSheet.create({
19-
container: {
19+
iconContainer: {
2020
},
2121
logo: {
22-
resizeMode: 'center',
23-
marginTop: -15
22+
marginTop: -15,
23+
resizeMode: 'center'
2424
}
2525
})
2626

src/contact/Contact.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Contact extends Component {
2727
<RNEFormLabel containerStyle={styles.labelContainerStyle}>Phone</RNEFormLabel>
2828
<RNEFormInput placeholder='Please enter your phone number...' />
2929
<RNEButton
30+
raised
3031
onPress={() => console.log('yo')}
3132
icon={{name: 'done'}}
3233
buttonStyle={{marginTop: 15}}

0 commit comments

Comments
 (0)