reload AlgoItem on focus via prop

zio/stable
Ansh Nanda 2023-05-16 16:27:38 -07:00
parent 3f41d3db26
commit 1e54125f7f
2 changed files with 6 additions and 1 deletions

View File

@ -24,11 +24,13 @@ const AlgoItem = observer(
style,
showBottom = true,
onLongPress,
reloadOnFocus = false,
}: {
item: AlgoItemModel
style?: StyleProp<ViewStyle>
showBottom?: boolean
onLongPress?: () => void
reloadOnFocus?: boolean
}) => {
const store = useStores()
const pal = usePalette('default')
@ -36,7 +38,9 @@ const AlgoItem = observer(
// TODO: this is pretty hacky, but it works for now
useFocusEffect(() => {
item.reload()
if (reloadOnFocus) {
item.reload()
}
})
return (

View File

@ -174,6 +174,7 @@ export function PostEmbeds({
<AlgoItem
item={new AlgoItemModel(store, embed.record)}
style={[pal.view, pal.border, styles.extOuter]}
reloadOnFocus={true}
/>
)
}