@@ -3,7 +3,11 @@ import { RefreshControl, StyleSheet, Text, TouchableOpacity, View } from 'react-
33import { useSafeAreaInsets } from 'react-native-safe-area-context' ;
44import { useNavigation } from '@react-navigation/native' ;
55import { Header , LargeHeader , ScrollViewWithHeaders } from '@codeherence/react-native-header' ;
6- import type { ScrollHeaderProps , ScrollLargeHeaderProps } from '@codeherence/react-native-header' ;
6+ import type {
7+ ScrollHeaderProps ,
8+ ScrollLargeHeaderProps ,
9+ ScrollLargeHeaderSubtitleProps ,
10+ } from '@codeherence/react-native-header' ;
711import { range } from '../../utils' ;
812import { Avatar , BackButton } from '../../components' ;
913import { RANDOM_IMAGE_NUM } from '../../constants' ;
@@ -24,7 +28,12 @@ const HeaderComponent: React.FC<ScrollHeaderProps> = ({ showNavBar }) => {
2428 }
2529 headerRight = {
2630 < TouchableOpacity onPress = { onPressProfile } >
27- < Avatar size = "sm" source = { { uri : `https://i.pravatar.cc/128?img=${ RANDOM_IMAGE_NUM } ` } } />
31+ < Avatar
32+ size = "sm"
33+ source = { {
34+ uri : `https://i.pravatar.cc/128?img=${ RANDOM_IMAGE_NUM } ` ,
35+ } }
36+ />
2837 </ TouchableOpacity >
2938 }
3039 headerRightFadesIn
@@ -46,6 +55,10 @@ const LargeHeaderComponent: React.FC<ScrollLargeHeaderProps> = () => {
4655 ) ;
4756} ;
4857
58+ const LargeHeaderSubtitleComponent : React . FC < ScrollLargeHeaderSubtitleProps > = ( ) => (
59+ < Text style = { styles . largeHeaderSubtitleStyle } > Scroll to see header animation</ Text >
60+ ) ;
61+
4962const Simple : React . FC < SimpleUsageScreenNavigationProps > = ( ) => {
5063 const { bottom } = useSafeAreaInsets ( ) ;
5164 const [ refreshing , setRefreshing ] = useState ( false ) ;
@@ -65,14 +78,15 @@ const Simple: React.FC<SimpleUsageScreenNavigationProps> = () => {
6578 < ScrollViewWithHeaders
6679 HeaderComponent = { HeaderComponent }
6780 LargeHeaderComponent = { LargeHeaderComponent }
81+ LargeHeaderSubtitleComponent = { LargeHeaderSubtitleComponent }
6882 contentContainerStyle = { { paddingBottom : bottom } }
6983 refreshControl = {
7084 < RefreshControl refreshing = { refreshing } colors = { [ '#8E8E93' ] } onRefresh = { onRefresh } />
7185 }
7286 >
7387 < View style = { styles . children } >
7488 { data . map ( ( i ) => (
75- < Text key = { `text-${ i } ` } > Scroll to see header animation </ Text >
89+ < View key = { `text-${ i } ` } style = { styles . box } / >
7690 ) ) }
7791 </ View >
7892 </ ScrollViewWithHeaders >
@@ -83,6 +97,17 @@ export default Simple;
8397
8498const styles = StyleSheet . create ( {
8599 children : { marginTop : 16 , paddingHorizontal : 16 } ,
100+ box : {
101+ backgroundColor : 'lightgray' ,
102+ height : 50 ,
103+ marginVertical : 8 ,
104+ borderRadius : 8 ,
105+ } ,
86106 navBarTitle : { fontSize : 16 , fontWeight : 'bold' } ,
87107 largeHeaderStyle : { flexDirection : 'row-reverse' } ,
108+ largeHeaderSubtitleStyle : {
109+ fontSize : 16 ,
110+ fontWeight : 'bold' ,
111+ paddingHorizontal : 16 ,
112+ } ,
88113} ) ;
0 commit comments