xref: /MusicFree/src/pages/artistDetail/index.tsx (revision b882a19d884fffa32f7c8cef31652b909dceaa0f)
1import React, {useEffect} from 'react';
2import {StyleSheet} from 'react-native';
3import rpx from '@/utils/rpx';
4import {SafeAreaView} from 'react-native-safe-area-context';
5import StatusBar from '@/components/base/statusBar';
6import MusicBar from '@/components/musicBar';
7import SimpleAppBar from '@/components/base/simpleAppBar';
8import Header from './components/header';
9import Body from './components/body';
10import {useSetAtom} from 'jotai';
11import {initQueryResult, queryResultAtom, scrollToTopAtom} from './store/atoms';
12
13export default function ArtistDetail() {
14    const setQueryResult = useSetAtom(queryResultAtom);
15    const setScrollToTopState = useSetAtom(scrollToTopAtom);
16
17    useEffect(() => {
18        return () => {
19            setQueryResult(initQueryResult);
20            setScrollToTopState(true);
21        };
22    }, []);
23
24    return (
25        <SafeAreaView style={style.wrapper}>
26            <StatusBar />
27            <SimpleAppBar title="作者" />
28            <Header />
29            <Body />
30            <MusicBar />
31        </SafeAreaView>
32    );
33}
34
35const style = StyleSheet.create({
36    wrapper: {
37        width: rpx(750),
38        flex: 1,
39    },
40    body: {
41        flex: 1,
42    },
43});
44