import * as React from 'react'; import { Animated, View, StyleSheet, ScrollView, Alert, Platform, } from 'react-native'; import { Button, Appbar } from 'react-native-paper'; import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'; import { RouteProp, ParamListBase } from '@react-navigation/native'; import { createStackNavigator, StackNavigationProp, HeaderBackground, useHeaderHeight, Header, StackHeaderProps, } from '@react-navigation/stack'; import BlurView from '../Shared/BlurView'; import Article from '../Shared/Article'; import Albums from '../Shared/Albums'; type SimpleStackParams = { Article: { author: string }; Albums: undefined; }; type SimpleStackNavigation = StackNavigationProp; const scrollEnabled = Platform.select({ web: true, default: false }); const ArticleScreen = ({ navigation, route, }: { navigation: SimpleStackNavigation; route: RouteProp; }) => { return (
); }; const AlbumsScreen = ({ navigation, }: { navigation: SimpleStackNavigation; }) => { const headerHeight = useHeaderHeight(); return ( ); }; const SimpleStack = createStackNavigator(); type Props = Partial> & { navigation: StackNavigationProp; }; function CustomHeader(props: StackHeaderProps) { const { current, next } = props.scene.progress; const progress = Animated.add(current, next || 0); const opacity = progress.interpolate({ inputRange: [0, 1, 2], outputRange: [0, 1, 0], }); return ( <>
Why hello there, pardner! ); } export default function SimpleStackScreen({ navigation, ...rest }: Props) { navigation.setOptions({ headerShown: false, }); return ( ({ title: `Article by ${route.params?.author}`, header: CustomHeader, headerTintColor: '#fff', headerStyle: { backgroundColor: '#ff005d' }, headerBackTitleVisible: false, headerTitleAlign: 'center', headerBackImage: ({ tintColor }) => ( ), headerRight: ({ tintColor }) => ( Alert.alert( 'Never gonna give you up!', 'Never gonna let you down! Never gonna run around and desert you!' ) } /> ), })} initialParams={{ author: 'Gandalf' }} /> ( ), }} /> ); } const styles = StyleSheet.create({ buttons: { flexDirection: 'row', padding: 8, }, button: { margin: 8, }, banner: { textAlign: 'center', color: 'tomato', backgroundColor: 'papayawhip', padding: 4, }, });