Skip to content

Commit 2e1f9c5

Browse files
authored
Merge pull request #357 from Vn-ChemGio/RNS-356_Fix_Avatar_header
Fix Avatar Header (#356)
2 parents 73e20c5 + 5c43b30 commit 2e1f9c5

File tree

7 files changed

+55
-38
lines changed

7 files changed

+55
-38
lines changed

src/constants/commonStyles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ const commonStyles = StyleSheet.create({
3737
},
3838
message: {
3939
color: colors.white,
40-
fontSize: 72,
41-
lineHeight: 85,
40+
fontSize: 48,
41+
lineHeight: 55,
4242
letterSpacing: -1,
4343
textAlign: 'left',
4444
},

src/predefinedComponents/AvatarHeader/AvatarHeaderFlatList.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function AvatarHeaderFlatListInner<ItemT>(
2121
data,
2222
decelerationRate = 'fast',
2323
enableSafeAreaTopInset = true,
24+
image,
2425
keyExtractor,
2526
leftTopIcon,
2627
leftTopIconAccessibilityLabel,
@@ -66,6 +67,7 @@ function AvatarHeaderFlatListInner<ItemT>(
6667
backgroundColor={backgroundColor}
6768
enableSafeAreaTopInset={enableSafeAreaTopInset}
6869
height={parallaxHeight}
70+
image={image}
6971
leftTopIcon={leftTopIcon}
7072
leftTopIconAccessibilityLabel={leftTopIconAccessibilityLabel}
7173
leftTopIconOnPress={leftTopIconOnPress}

src/predefinedComponents/AvatarHeader/AvatarHeaderScrollView.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const AvatarHeaderScrollView = React.forwardRef<ScrollView, AvatarHeaderS
1919
contentContainerStyle,
2020
decelerationRate = 'fast',
2121
enableSafeAreaTopInset = true,
22+
image,
2223
leftTopIcon,
2324
leftTopIconAccessibilityLabel,
2425
leftTopIconOnPress,
@@ -62,6 +63,7 @@ export const AvatarHeaderScrollView = React.forwardRef<ScrollView, AvatarHeaderS
6263
backgroundColor={backgroundColor}
6364
enableSafeAreaTopInset={enableSafeAreaTopInset}
6465
height={parallaxHeight}
66+
image={image}
6567
leftTopIcon={leftTopIcon}
6668
leftTopIconAccessibilityLabel={leftTopIconAccessibilityLabel}
6769
leftTopIconOnPress={leftTopIconOnPress}

src/predefinedComponents/AvatarHeader/AvatarHeaderSectionList.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function AvatarHeaderSectionListInner<ItemT, SectionT>(
2020
contentContainerStyle,
2121
decelerationRate = 'fast',
2222
enableSafeAreaTopInset = true,
23+
image,
2324
leftTopIcon,
2425
leftTopIconAccessibilityLabel,
2526
leftTopIconOnPress,
@@ -67,6 +68,7 @@ function AvatarHeaderSectionListInner<ItemT, SectionT>(
6768
backgroundColor={backgroundColor}
6869
enableSafeAreaTopInset={enableSafeAreaTopInset}
6970
height={parallaxHeight}
71+
image={image}
7072
leftTopIcon={leftTopIcon}
7173
leftTopIconAccessibilityLabel={leftTopIconAccessibilityLabel}
7274
leftTopIconOnPress={leftTopIconOnPress}

src/predefinedComponents/AvatarHeader/components/HeaderBar.tsx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,18 @@ export const HeaderBar: React.FC<HeaderProps> = ({
103103
<AnimatedSafeAreaView
104104
edges={safeAreaEdges}
105105
style={[commonStyles.headerWrapper, wrapperAnimatedStyle]}>
106-
<Pressable
107-
accessibilityLabel={leftTopIconAccessibilityLabel}
108-
accessibilityRole="button"
109-
hitSlop={HIT_SLOP}
110-
onPress={leftTopIconOnPress}
111-
style={styles.leftHeaderButton}
112-
testID={leftTopIconTestID}>
113-
<IconRenderer icon={leftTopIcon} />
114-
</Pressable>
106+
{leftTopIcon ? (
107+
<Pressable
108+
accessibilityLabel={leftTopIconAccessibilityLabel}
109+
accessibilityRole="button"
110+
hitSlop={HIT_SLOP}
111+
onPress={leftTopIconOnPress}
112+
style={styles.leftHeaderButton}
113+
testID={leftTopIconTestID}>
114+
<IconRenderer icon={leftTopIcon} />
115+
</Pressable>
116+
) : null}
117+
115118
<View style={[styles.headerTitleContainer, headerTitleContainerRTLStyle]}>
116119
<Animated.Image
117120
source={image as ImageSourcePropType}
@@ -124,15 +127,17 @@ export const HeaderBar: React.FC<HeaderProps> = ({
124127
{title}
125128
</Animated.Text>
126129
</View>
127-
<Pressable
128-
accessibilityLabel={rightTopIconAccessibilityLabel}
129-
accessibilityRole="button"
130-
hitSlop={HIT_SLOP}
131-
onPress={rightTopIconOnPress}
132-
style={styles.rightHeaderButton}
133-
testID={rightTopIconTestID}>
134-
<IconRenderer icon={rightTopIcon} />
135-
</Pressable>
130+
{rightTopIcon ? (
131+
<Pressable
132+
accessibilityLabel={rightTopIconAccessibilityLabel}
133+
accessibilityRole="button"
134+
hitSlop={HIT_SLOP}
135+
onPress={rightTopIconOnPress}
136+
style={styles.rightHeaderButton}
137+
testID={rightTopIconTestID}>
138+
<IconRenderer icon={rightTopIcon} />
139+
</Pressable>
140+
) : null}
136141
</AnimatedSafeAreaView>
137142
);
138143
};

src/predefinedComponents/AvatarHeader/withAvatarHeaderFlashList.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function withAvatarHeaderFlashList<ItemT>(
2626
backgroundColor,
2727
decelerationRate = 'fast',
2828
enableSafeAreaTopInset = true,
29+
image,
2930
leftTopIcon,
3031
leftTopIconAccessibilityLabel,
3132
leftTopIconOnPress,
@@ -69,6 +70,7 @@ export function withAvatarHeaderFlashList<ItemT>(
6970
backgroundColor={backgroundColor}
7071
enableSafeAreaTopInset={enableSafeAreaTopInset}
7172
height={parallaxHeight}
73+
image={image}
7274
leftTopIcon={leftTopIcon}
7375
leftTopIconAccessibilityLabel={leftTopIconAccessibilityLabel}
7476
leftTopIconOnPress={leftTopIconOnPress}

src/predefinedComponents/DetailsHeader/components/HeaderBar.tsx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,33 @@ export const HeaderBar: React.FC<HeaderBarProps> = ({
6060
<AnimatedSafeAreaView
6161
edges={safeAreaEdges}
6262
style={[commonStyles.headerWrapper, wrapperAnimatedStyle]}>
63-
<Pressable
64-
accessibilityLabel={leftTopIconAccessibilityLabel}
65-
accessibilityRole="button"
66-
hitSlop={HIT_SLOP}
67-
onPress={leftTopIconOnPress}
68-
style={styles.leftHeaderButton}
69-
testID={leftTopIconTestID}>
70-
<IconRenderer icon={leftTopIcon} />
71-
</Pressable>
63+
{leftTopIcon ? (
64+
<Pressable
65+
accessibilityLabel={leftTopIconAccessibilityLabel}
66+
accessibilityRole="button"
67+
hitSlop={HIT_SLOP}
68+
onPress={leftTopIconOnPress}
69+
style={styles.leftHeaderButton}
70+
testID={leftTopIconTestID}>
71+
<IconRenderer icon={leftTopIcon} />
72+
</Pressable>
73+
) : null}
7274
<Animated.View style={[styles.headerTitleContainer, headerTitleContainerAnimatedStyle]}>
7375
<Animated.Text style={[styles.headerTitle, titleStyle]} testID={titleTestID}>
7476
{title}
7577
</Animated.Text>
7678
</Animated.View>
77-
<Pressable
78-
accessibilityLabel={rightTopIconAccessibilityLabel}
79-
accessibilityRole="button"
80-
hitSlop={HIT_SLOP}
81-
onPress={rightTopIconOnPress}
82-
style={styles.rightHeaderButton}
83-
testID={rightTopIconTestID}>
84-
<IconRenderer icon={rightTopIcon} />
85-
</Pressable>
79+
{rightTopIcon ? (
80+
<Pressable
81+
accessibilityLabel={rightTopIconAccessibilityLabel}
82+
accessibilityRole="button"
83+
hitSlop={HIT_SLOP}
84+
onPress={rightTopIconOnPress}
85+
style={styles.rightHeaderButton}
86+
testID={rightTopIconTestID}>
87+
<IconRenderer icon={rightTopIcon} />
88+
</Pressable>
89+
) : null}
8690
</AnimatedSafeAreaView>
8791
);
8892
};

0 commit comments

Comments
 (0)