

React native lists implemented with a stretchy header image
source link: https://reactnativeexample.com/react-native-lists-implemented-with-a-stretchy-header-image/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

React native lists implemented with a stretchy header image
react-native-reanimated-stretchy
react native lists implemented with a stretchy header image
Motive
I am working on a project that was using react-native-stretchy
, but it has type issues and the header component of the SectionList
and FlatList
were unusable due to implementing the image header inside the header component prop.
With react-native-reanimated-stretchy
, the types should work fine, you can use the headerComponent prop, and it uses reanimated for animations
Installation
// npm
npm install react-native-reanimated-stretchy
// yarn
yarn add react-native-reanimated-stretchy
Usage
import * as React from 'react';
import { StyleSheet, View, Text, SafeAreaView } from 'react-native';
import { StretchyScrollView } from 'react-native-reanimated-stretchy';
export default function App() {
return (
<SafeAreaView style={styles.container}>
<StretchyScrollView
imageHeight={200}
contentContainerStyle={styles.content}
imageSource={require('../assets/image.jpg')}
foreground={
<View style={styles.foreground}>
<Text style={styles.txt}>something here</Text>
</View>
}
>
{Array(20)
.fill(0)
.map((_, i) => (
<View style={styles.box} key={i}>
<Text>{i}</Text>
</View>
))}
</StretchyScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
foreground: {
flex: 1,
alignItems: 'center',
justifyContent: 'flex-end',
},
box: {
height: 100,
backgroundColor: 'pink',
justifyContent: 'center',
alignItems: 'center',
margin: 10,
borderRadius: 10,
},
txt: {
fontWeight: 'bold',
fontSize: 24,
color: 'orange',
},
content: {
backgroundColor: 'gray',
},
});
Limitations
paddingTop
ofcontentContainerStyle
will be overriden if passed
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
GitHub
Recommend
-
7
UI Broken UI animation implemented with react native Apr 09, 2021...
-
10
React Native Navigation Search Bar A searcbar for React Native Navigation which collapses the header when focussed. It's that simple! Install npm install react-native-navigation-search-bar --save
-
7
react-native-scrollable-animated-header React Native Animated Header App with ScrollView Animated header is the most common design pattern in today’s apps. Animations are an important part of mobile applications.
-
9
Collapsible header using the React Native Animated APIJune 04, 2021Photo by
-
6
rn-mirror-lists Mirror scroll lists for React Native Installation yarn add rn-mirror-lists Usage import { MirrorLists } from 'rn-mirror-lists'; // ... const data = [ {...
-
7
Videos Implemented Audio and Video Player in React Native Oct 09, 2021...
-
10
Header A header library for react-native. Uses power of reanimated2 Nov 19, 2021 1 min read react-native-header A header library for...
-
6
Header Animation header component for react native Jan 16, 2022 1 min read rn-animation-header animation header component for react n...
-
10
Marquee Simple React Native marquee component,fully implemented using reanimated v2,support to iOS/Android/Web Jan 31, 2022 1 min read @react...
-
7
React Native Animated Header ScrollView A performant animated ScrollView component that: 🔥Animates an image into a navbar header 🔥Supports bounce animation on scroll down 🔥Supports both iOS and Android devic...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK