Add compose fab to custom feed screen

zio/stable
Paul Frazee 2023-05-24 18:50:19 -05:00
parent 0a18229784
commit 2ba4d9bfbf
1 changed files with 15 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import React, {useMemo, useRef, useState} from 'react' import React, {useMemo, useRef} from 'react'
import {NativeStackScreenProps} from '@react-navigation/native-stack' import {NativeStackScreenProps} from '@react-navigation/native-stack'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {usePalette} from 'lib/hooks/usePalette' import {usePalette} from 'lib/hooks/usePalette'
@ -25,6 +25,8 @@ import {useSetTitle} from 'lib/hooks/useSetTitle'
import {shareUrl} from 'lib/sharing' import {shareUrl} from 'lib/sharing'
import {toShareUrl} from 'lib/strings/url-helpers' import {toShareUrl} from 'lib/strings/url-helpers'
import {Haptics} from 'lib/haptics' import {Haptics} from 'lib/haptics'
import {ComposeIcon2} from 'lib/icons'
import {FAB} from '../com/util/fab/FAB'
import {LoadLatestBtn} from 'view/com/util/load-latest/LoadLatestBtn' import {LoadLatestBtn} from 'view/com/util/load-latest/LoadLatestBtn'
import {useOnMainScroll} from 'lib/hooks/useOnMainScroll' import {useOnMainScroll} from 'lib/hooks/useOnMainScroll'
@ -102,6 +104,10 @@ export const CustomFeedScreen = withAuthRequired(
resetMainScroll() resetMainScroll()
}, [scrollElRef, resetMainScroll]) }, [scrollElRef, resetMainScroll])
const onPressCompose = React.useCallback(() => {
store.shell.openComposer({})
}, [store])
const renderHeaderBtns = React.useCallback(() => { const renderHeaderBtns = React.useCallback(() => {
return ( return (
<View style={styles.headerBtns}> <View style={styles.headerBtns}>
@ -292,6 +298,14 @@ export const CustomFeedScreen = withAuthRequired(
{isScrolledDown ? ( {isScrolledDown ? (
<LoadLatestBtn onPress={onScrollToTop} label="Scroll to top" /> <LoadLatestBtn onPress={onScrollToTop} label="Scroll to top" />
) : null} ) : null}
<FAB
testID="composeFAB"
onPress={onPressCompose}
icon={<ComposeIcon2 strokeWidth={1.5} size={29} style={s.white} />}
accessibilityRole="button"
accessibilityLabel="Compose post"
accessibilityHint=""
/>
</View> </View>
) )
}), }),