Skip to content

Commit

Permalink
fix: title styling
Browse files Browse the repository at this point in the history
  • Loading branch information
pwysowski committed Apr 14, 2020
1 parent c79e707 commit a113156
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 43 deletions.
14 changes: 7 additions & 7 deletions src/predefinedComponents/AvatarHeader/AvatarHeader.js
Expand Up @@ -66,20 +66,20 @@ class AvatarHeader extends React.Component {

return (
<View style={[styles.headerWrapper, styles.userModalHeader, { backgroundColor }]}>
<TouchableOpacity hitSlop={sizes.hitSlop} onPress={leftTopIconOnPress}>
<Image style={styles.icon} resizeMode="contain" source={leftTopIcon} />
</TouchableOpacity>
<View style={styles.headerMenu}>
<TouchableOpacity hitSlop={sizes.hitSlop} onPress={leftTopIconOnPress} style={styles.leftHeaderButton}>
<Image style={styles.icon} resizeMode="contain" source={leftTopIcon} />
</TouchableOpacity>
<View style={styles.headerTitleContainer}>
<Animated.Image source={image} style={[styles.headerPic, { opacity: imageOpacity }]} />
<Animated.Text style={[styles.headerTitle, { opacity: nameOpacity }]}>
<Animated.Text numberOfLines={1} style={[styles.headerTitle, { opacity: nameOpacity }]}>
{title}
</Animated.Text>
</View>
<TouchableOpacity hitSlop={sizes.hitSlop} onPress={rightTopIconOnPress} style={styles.rightHeaderBtn}>
<Image style={styles.icon} resizeMode="contain" source={rightTopIcon} />
</TouchableOpacity>
</View>
<TouchableOpacity hitSlop={sizes.hitSlop} onPress={rightTopIconOnPress}>
<Image style={styles.icon} resizeMode="contain" source={rightTopIcon} />
</TouchableOpacity>
</View>
)
}
Expand Down
20 changes: 15 additions & 5 deletions src/predefinedComponents/AvatarHeader/AvatarHeader.styles.js
Expand Up @@ -17,20 +17,22 @@ export default StyleSheet.create({
alignItems: 'center'
},
headerTitleContainer: {
flex: 8,
flexDirection: 'row',
alignItems: 'center',
marginLeft: -(constants.deviceWidth / 3)
marginRight: 24
},
headerTitle: {
fontSize: 16,
lineHeight: 20,
color: colors.white,
marginLeft: 12,
fontFamily: 'AvertaStd-Semibold'
marginRight: 12
},
infoContainer: {
flex: 1,
flexDirection: 'row',
paddingBottom: 32
marginBottom: 16
},
iconContainer: {
flexDirection: 'row',
Expand All @@ -42,8 +44,7 @@ export default StyleSheet.create({
infoText: {
color: colors.white,
fontSize: constants.normalizedFontSize(16),
lineHeight: 24,
fontFamily: 'AvertaStd-Regular'
lineHeight: 24
},
icon: {
width: 16,
Expand All @@ -61,6 +62,15 @@ export default StyleSheet.create({
borderRadius: 8
},
userModalMessageContainer: {
marginTop: 12,
flex: 5,
paddingBottom: 8
},
rightHeaderButton: {
flex: 1,
alignItems: 'flex-end'
},
leftHeaderButton: {
flex: 1,
}
})
30 changes: 9 additions & 21 deletions src/predefinedComponents/DetailsHeader/DetailsHeader.js
Expand Up @@ -20,7 +20,7 @@ class DetailsHeader extends React.Component {
this.scrollY = new ValueXY()
}

setHeaderSize = headerLayout => this.setState({ headerLayout })
setHeaderSize = (headerLayout) => this.setState({ headerLayout })

scrollPosition = (value) => {
const { headerLayout } = this.state
Expand All @@ -29,13 +29,7 @@ class DetailsHeader extends React.Component {
}

renderHeader = (user) => {
const {
backgroundColor,
leftTopIconOnPress,
rightTopIconOnPress,
leftTopIcon,
rightTopIcon
} = this.props
const { backgroundColor, leftTopIconOnPress, rightTopIconOnPress, leftTopIcon, rightTopIcon } = this.props

const opacity = this.scrollY.y.interpolate({
inputRange: [0, this.scrollPosition(60), this.scrollPosition(90)],
Expand All @@ -52,10 +46,10 @@ class DetailsHeader extends React.Component {
<Animated.View style={[styles.headerTitleContainer, { opacity }]}>
<Text style={styles.headerTitle}>{user.label}</Text>
</Animated.View>
<TouchableOpacity hitSlop={sizes.hitSlop} onPress={rightTopIconOnPress}>
<Image style={styles.icon} resizeMode="contain" source={rightTopIcon} />
</TouchableOpacity>
</View>
<TouchableOpacity hitSlop={sizes.hitSlop} onPress={rightTopIconOnPress}>
<Image style={styles.icon} resizeMode="contain" source={rightTopIcon} />
</TouchableOpacity>
</View>
)
}
Expand Down Expand Up @@ -106,8 +100,9 @@ class DetailsHeader extends React.Component {
const {
headerLayout: { height }
} = this.state
const headerBorderRadius = hasBorderRadius
&& this.scrollY.y.interpolate({
const headerBorderRadius =
hasBorderRadius &&
this.scrollY.y.interpolate({
inputRange: [0, height],
outputRange: [80, 0],
extrapolate: 'extend'
Expand All @@ -128,14 +123,7 @@ class DetailsHeader extends React.Component {

render() {
const user = Brandon
const {
backgroundColor,
backgroundImage,
renderBody,
headerHeight,
snapToEdge,
bounces
} = this.props
const { backgroundColor, backgroundImage, renderBody, headerHeight, snapToEdge, bounces } = this.props

return (
<React.Fragment>
Expand Down
16 changes: 6 additions & 10 deletions src/predefinedComponents/DetailsHeader/DetailsHeader.styles.js
Expand Up @@ -5,16 +5,14 @@ export default StyleSheet.create({
...screenStyles,
foregroundText: {
color: colors.white,
fontFamily: 'AvertaStd-Semibold',
paddingHorizontal: 12
},
foregroundTitle: {
height: 36,
alignSelf: 'flex-start',
borderRadius: 18,
alignItems: 'center',
justifyContent: 'center',
fontFamily: 'AvertaStd-Semibold'
justifyContent: 'center'
},
infoContainer: {
flexDirection: 'row',
Expand All @@ -36,10 +34,10 @@ export default StyleSheet.create({
color: colors.black,
paddingLeft: 4,
fontSize: 16,
lineHeight: 20,
fontFamily: 'AvertaStd-Semibold'
lineHeight: 20
},
footerContainer: {
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
Expand All @@ -54,20 +52,18 @@ export default StyleSheet.create({
fontSize: 16,
lineHeight: 20,
color: colors.white,
paddingLeft: 12,
fontFamily: 'AvertaStd-Semibold'
paddingLeft: 12
},
headerMenu: {
flexDirection: 'row',
alignItems: 'center'
},
headerTitleContainer: {
marginLeft: 24
flex: 8
},
headerTitle: {
fontSize: 16,
lineHeight: 20,
color: colors.white,
fontFamily: 'AvertaStd-Semibold'
color: colors.white
}
})

0 comments on commit a113156

Please sign in to comment.