tooot/src/stacks/Shared/Hashtag.tsx

39 lines
759 B
TypeScript

import React from 'react'
import { useDispatch } from 'react-redux'
import { useFocusEffect } from '@react-navigation/native'
import Timeline from 'src/stacks/common/Timeline'
import { reset } from 'src/stacks/common/timelineSlice'
// Show remote hashtag? Only when private, show local version?
export interface Props {
route: {
params: {
hashtag: string
}
}
}
const Hashtag: React.FC<Props> = ({
route: {
params: { hashtag }
}
}) => {
const dispatch = useDispatch()
useFocusEffect(
React.useCallback(() => {
// Do something when the screen is focused
return () => {
dispatch(reset('Hashtag'))
}
}, [])
)
return <Timeline page='Hashtag' hashtag={hashtag} />
}
export default Hashtag