Skip to content

Instantly share code, notes, and snippets.

@vicovictor
Created October 16, 2025 06:38
Show Gist options
  • Save vicovictor/cdf1d105d1de0a1184c425489c134227 to your computer and use it in GitHub Desktop.
Save vicovictor/cdf1d105d1de0a1184c425489c134227 to your computer and use it in GitHub Desktop.
React Native Expo Inverted FlatList with snack header transparent
import { View, FlatList, Text, StyleSheet } from 'react-native';
import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
const dummyData = Array.from({ length: 100 }, (_, i) => ({
id: String(i + 1),
text: `This is line ${i + 1} of dummy text content`,
}));
export default function HomeScreen() {
return (
<>
<Stack.Screen
options={{
headerShown: true,
headerTransparent: true,
headerTitle: 'Messages',
headerLargeTitle: true,
headerBlurEffect: 'regular',
}}
/>
<View style={styles.container}>
<FlatList
data={dummyData}
keyExtractor={(item) => item.id}
inverted
contentContainerStyle={styles.listContent}
renderItem={({ item }) => (
<View style={styles.messageItem}>
<Text style={styles.messageText}>{item.text}</Text>
</View>
)}
/>
<StatusBar style="dark" />
</View>
</>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f5f5f5',
},
listContent: {
paddingTop: 110,
paddingHorizontal: 16,
paddingBottom: 20,
},
messageItem: {
backgroundColor: '#fff',
padding: 16,
marginVertical: 6,
borderRadius: 12,
shadowColor: '#000',
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.1,
shadowRadius: 2,
elevation: 2,
},
messageText: {
fontSize: 16,
color: '#333',
lineHeight: 22,
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment