Skip to content

Commit cfc4b4b

Browse files
authored
Solved issue with title alignment (#14)
1 parent b1ca264 commit cfc4b4b

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

lib/RouteMapper.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,26 @@ export function titleRouteMapperGenerator (TitleComponent, styles, topNavigator)
7373
export class CenteredText extends React.Component {
7474
render () {
7575
return (
76-
<View style={{flex: 1, flexDirection: 'row', alignItems: 'center'}}>
77-
<Text style={this.props.style}>
76+
<View style={titleStyles.container}>
77+
<Text style={[titleStyles.title, this.props.style]}>
7878
{this.props.children}
7979
</Text>
8080
</View>
8181
)
8282
}
8383
}
8484

85+
const titleStyles = StyleSheet.create({
86+
container: {
87+
flex: 1,
88+
flexDirection: 'row',
89+
alignItems: 'center',
90+
},
91+
title: {
92+
textAlign: (Platform.OS === 'ios') ? 'center' : 'left',
93+
}
94+
})
95+
8596
const defaultStyles = StyleSheet.create({
8697
back: {
8798
flex: 1,

0 commit comments

Comments
 (0)