File tree Expand file tree Collapse file tree 6 files changed +62
-15
lines changed Expand file tree Collapse file tree 6 files changed +62
-15
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { SafeAreaViewExample } from './screens/SafeAreaViewExample';
7
7
import { SafeAreaProvider } from 'react-native-safe-area-context' ;
8
8
import type { RootStackParamList } from './types' ;
9
9
import { ImageForegroundExample } from './screens/ImageForegroundExample' ;
10
+ import { OnlyForegroundExample } from './screens/OnlyForegroundExample' ;
10
11
11
12
const App = ( ) => {
12
13
const Stack = createNativeStackNavigator < RootStackParamList > ( ) ;
@@ -31,6 +32,10 @@ const App = () => {
31
32
name = "ImageForegroundExample"
32
33
component = { ImageForegroundExample }
33
34
/>
35
+ < Stack . Screen
36
+ name = "OnlyForegroundExample"
37
+ component = { OnlyForegroundExample }
38
+ />
34
39
</ Stack . Navigator >
35
40
</ NavigationContainer >
36
41
</ SafeAreaProvider >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export const ExamplesDirectory = ({ navigation }: Props) => {
14
14
{ screen : SCREENS . OVERFLOW_HEADER_EXAMPLE } ,
15
15
{ screen : SCREENS . SAFE_AREA_VIEW_EXAMPLE } ,
16
16
{ screen : SCREENS . IMAGE_FOREGROUND_EXAMPLE } ,
17
+ { screen : SCREENS . ONLY_FOREGROUND_EXAMPLE } ,
17
18
] ;
18
19
19
20
return (
Original file line number Diff line number Diff line change
1
+ import { AnimatedScrollView } from '@kanelloc/react-native-animated-header-scroll-view' ;
2
+ import { Card , Header , OverflowHeaderComponent } from '../components' ;
3
+ import * as React from 'react' ;
4
+ import { ForegroundComponent } from '../components/ForegroundComponent' ;
5
+ import { data , isIOS } from '../utils' ;
6
+
7
+ export const OnlyForegroundExample = ( ) => {
8
+ return (
9
+ < AnimatedScrollView
10
+ ForegroundComponent = { < ForegroundComponent /> }
11
+ headerHeight = { isIOS ? 90 : 70 }
12
+ OverflowHeaderComponent = { < OverflowHeaderComponent /> }
13
+ HeaderComponent = { < Header /> }
14
+ >
15
+ { data . map ( ( e ) => {
16
+ return < Card item = { e } key = { e } /> ;
17
+ } ) }
18
+ </ AnimatedScrollView >
19
+ ) ;
20
+ } ;
Original file line number Diff line number Diff line change @@ -4,4 +4,5 @@ export type RootStackParamList = {
4
4
SafeAreaViewExample : undefined ;
5
5
SimpleExample : undefined ;
6
6
ImageForegroundExample : undefined ;
7
+ OnlyForegroundExample : undefined ;
7
8
} ;
Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ export enum SCREENS {
3
3
OVERFLOW_HEADER_EXAMPLE = 'OverflowHeaderExample' ,
4
4
SAFE_AREA_VIEW_EXAMPLE = 'SafeAreaViewExample' ,
5
5
IMAGE_FOREGROUND_EXAMPLE = 'ImageForegroundExample' ,
6
+ ONLY_FOREGROUND_EXAMPLE = 'OnlyForegroundExample' ,
6
7
}
Original file line number Diff line number Diff line change @@ -47,21 +47,40 @@ export const AnimatedScrollView = ({
47
47
] }
48
48
>
49
49
{ ForegroundComponent ? (
50
- < AnimatedImageBackground
51
- source = { headerImage }
52
- style = { [
53
- { height : imageHeight , width : width * 1.2 } ,
54
- {
55
- transform : [
56
- { scale } ,
57
- { translateY : translateYUp } ,
58
- { translateY : translateYDown } ,
59
- ] ,
60
- } ,
61
- ] }
62
- >
63
- { ForegroundComponent }
64
- </ AnimatedImageBackground >
50
+ < >
51
+ { headerImage ? (
52
+ < AnimatedImageBackground
53
+ source = { headerImage }
54
+ style = { [
55
+ { height : imageHeight , width : width * 1.2 } ,
56
+ {
57
+ transform : [
58
+ { scale } ,
59
+ { translateY : translateYUp } ,
60
+ { translateY : translateYDown } ,
61
+ ] ,
62
+ } ,
63
+ ] }
64
+ >
65
+ { ForegroundComponent }
66
+ </ AnimatedImageBackground >
67
+ ) : (
68
+ < Animated . View
69
+ style = { [
70
+ { height : imageHeight , width : width * 1.2 } ,
71
+ {
72
+ transform : [
73
+ { scale } ,
74
+ { translateY : translateYUp } ,
75
+ { translateY : translateYDown } ,
76
+ ] ,
77
+ } ,
78
+ ] }
79
+ >
80
+ { ForegroundComponent }
81
+ </ Animated . View >
82
+ ) }
83
+ </ >
65
84
) : (
66
85
< Animated . Image
67
86
source = { headerImage }
You can’t perform that action at this time.
0 commit comments