Adds a composer prompt on the home screen to invite users to post (#9464)

* Add a composer prompt on home

* Added image upload button

* Feed composer buttons

* Feed composer styles

* Add client events, auto-open gallery when button is pressed

* Add feature gate

* Move gate check to last

* Small style cleanups

---------

Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
Alex Benzer
2025-12-04 15:39:56 -08:00
committed by GitHub
parent 55eb6c5628
commit bc39b553f9
10 changed files with 308 additions and 2 deletions
+14 -1
View File
@@ -1,4 +1,4 @@
import {useCallback} from 'react'
import {useCallback, useEffect, useRef} from 'react'
import {Keyboard} from 'react-native'
import {type ImagePickerAsset} from 'expo-image-picker'
import {msg, plural} from '@lingui/macro'
@@ -31,6 +31,10 @@ export type SelectMediaButtonProps = {
assets: ImagePickerAsset[]
errors: string[]
}) => void
/**
* If true, automatically open the media picker when the component mounts.
*/
autoOpen?: boolean
}
/**
@@ -358,12 +362,14 @@ export function SelectMediaButton({
allowedAssetTypes,
selectedAssetsCount,
onSelectAssets,
autoOpen,
}: SelectMediaButtonProps) {
const {_} = useLingui()
const {requestPhotoAccessIfNeeded} = usePhotoLibraryPermission()
const {requestVideoAccessIfNeeded} = useVideoLibraryPermission()
const sheetWrapper = useSheetWrapper()
const t = useTheme()
const hasAutoOpened = useRef(false)
const selectionCountRemaining = MAX_IMAGES - selectedAssetsCount
@@ -460,6 +466,13 @@ export function SelectMediaButton({
selectionCountRemaining,
])
useEffect(() => {
if (autoOpen && !hasAutoOpened.current && !disabled) {
hasAutoOpened.current = true
onPressSelectMedia()
}
}, [autoOpen, disabled, onPressSelectMedia])
return (
<Button
testID="openMediaBtn"