1- import { Fragment , type FC } from "react" ;
2- import { Dimensions , StyleSheet } from "react-native" ;
3- import QRCode from "react-native-qrcode-svg" ;
4- import { useSharedValue } from "react-native-reanimated" ;
1+ import { type FC } from "react" ;
2+ import { Dimensions } from "react-native" ;
3+ import Animated , { useSharedValue } from "react-native-reanimated" ;
54import Carousel from "react-native-reanimated-carousel" ;
65import { useSafeAreaInsets } from "react-native-safe-area-context" ;
76
8- import { useCharacter , useNote } from "@crossbell/indexer" ;
9- import { HeaderHeightContext } from "@react-navigation/elements" ;
7+ import { useCharacter } from "@crossbell/indexer" ;
108import { Canvas , LinearGradient , Rect , vec } from "@shopify/react-native-skia" ;
11- import type { NoteEntity } from "crossbell" ;
129import { Image } from "expo-image" ;
1310import moment from "moment" ;
14- import { SizableText , Spacer , Stack , Text , Theme , View , XStack , YStack } from "tamagui" ;
11+ import { SizableText , Spacer , Stack , Text , XStack , YStack } from "tamagui" ;
1512
1613import { Avatar } from "@/components/Avatar" ;
1714import { CarouselPagination } from "@/components/CarouselPagination" ;
1815import { bgs } from "@/constants/bgs" ;
19- import { useCoverImage } from "@/hooks/use-cover-image" ;
2016import { useThemeStore } from "@/hooks/use-theme-store" ;
21- import { useGetPage } from "@/queries/page" ;
2217import type { ExpandedNote } from "@/types/crossbell" ;
2318import { withCompressedImage } from "@/utils/get-compressed-image-url" ;
24- import { getNoteSlug } from "@/utils/get-slug" ;
2519import { toGateway } from "@/utils/ipfs-parser" ;
2620import { isShortNotes } from "@/utils/is-short-notes" ;
2721
22+ import { I18nSwitcher } from "./I18nSwitcher" ;
23+
2824interface Props {
2925 isCapturing : boolean
3026 headerContainerHeight : number
3127 postUri ?: string
32- note : NoteEntity
28+ note : ExpandedNote
3329 characterId : number
3430 placeholderCoverImageIndex : number
3531 coverImage : string
@@ -67,25 +63,24 @@ export const Header: FC<Props> = (props) => {
6763 ? attachments . map ( attachment => withCompressedImage ( toGateway ( attachment . address ) , "high" ) ) . filter ( Boolean )
6864 : [ coverImage ] ;
6965
70- const userinfoEle = (
71- < Stack minHeight = { 28 } >
72- {
73- character ?. data && (
74- < XStack alignItems = "center" gap = { "$2" } marginBottom = { "$1" } >
75- < Avatar character = { character . data } useDefault size = { 26 } />
76- < XStack alignItems = "center" gap = "$4" >
77- < SizableText size = "$3" color = { "$color" } >
78- { character . data ?. metadata ?. content ?. name || character . data ?. handle }
79- </ SizableText >
80- < SizableText size = "$3" color = { "#929190" } >
81- { moment ( note ?. createdAt ) . format ( "YYYY-MM-DD" ) }
82- </ SizableText >
83- </ XStack >
66+ const userinfoEle = ( < XStack minHeight = { 28 } justifyContent = "space-between" alignItems = "center" >
67+ { character ?. data && (
68+ < XStack animation = { "quick" } enterStyle = { { opacity : 0 } } opacity = { 1 } justifyContent = "space-between" alignItems = "center" flex = { 1 } >
69+ < XStack alignItems = "center" gap = { "$2" } marginBottom = { "$1" } >
70+ < Avatar character = { character . data } useDefault size = { 26 } />
71+ < XStack alignItems = "center" gap = "$4" >
72+ < SizableText size = "$3" color = { "$color" } >
73+ { character . data ?. metadata ?. content ?. name || character . data ?. handle }
74+ </ SizableText >
75+ < SizableText size = "$3" color = { "#929190" } >
76+ { moment ( note ?. createdAt ) . format ( "YYYY-MM-DD" ) }
77+ </ SizableText >
8478 </ XStack >
85- )
86- }
87- </ Stack >
88- ) ;
79+ </ XStack >
80+ < I18nSwitcher note = { note } />
81+ </ XStack >
82+ ) }
83+ </ XStack > ) ;
8984
9085 return (
9186 < YStack backgroundColor = { isDarkMode ? "black" : "white" } marginBottom = { isShort ? 0 : 50 } paddingTop = { isShort ? top : 0 } >
@@ -111,7 +106,7 @@ export const Header: FC<Props> = (props) => {
111106 {
112107 isShort
113108 ? (
114- < YStack paddingHorizontal = "$2" paddingTop = "$2" >
109+ < YStack paddingHorizontal = "$2" paddingTop = "$2" flex = { 1 } >
115110 {
116111 data . length > 1 && (
117112 < Stack alignItems = "center" paddingVertical = "$3" >
@@ -136,7 +131,7 @@ export const Header: FC<Props> = (props) => {
136131 </ YStack >
137132 )
138133 : (
139- < YStack gap = "$4" position = "absolute" bottom = { - 40 } paddingHorizontal = "$2" >
134+ < YStack gap = "$4" position = "absolute" bottom = { - 40 } paddingHorizontal = "$2" flex = { 1 } width = { "100%" } paddingRight = "$3" >
140135 < Text fontSize = { 24 } fontWeight = { "700" } numberOfLines = { 2 } color = "white" > { noteTitle } </ Text >
141136 { userinfoEle }
142137 </ YStack >
0 commit comments