diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-03-17 15:17:28 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2023-03-17 15:17:28 -0500 |
commit | b711a49df9525eb94d30dd16d4c7840177f195ac (patch) | |
tree | b5015b85d437c7bf8446906a604ffda4bb2ed507 /src/view/com/util/TabBar.tsx | |
parent | 201c21df6d2f4851174443584d856e98554ce993 (diff) | |
download | voidsky-b711a49df9525eb94d30dd16d4c7840177f195ac.tar.zst |
Add soft reset on tap selected in tab bar
Diffstat (limited to 'src/view/com/util/TabBar.tsx')
-rw-r--r-- | src/view/com/util/TabBar.tsx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/view/com/util/TabBar.tsx b/src/view/com/util/TabBar.tsx index d3fe54830..67c9276c6 100644 --- a/src/view/com/util/TabBar.tsx +++ b/src/view/com/util/TabBar.tsx @@ -21,6 +21,7 @@ export function TabBar({ indicatorPosition = 'bottom', indicatorColor, onSelect, + onPressSelected, }: { selectedPage: number items: string[] @@ -29,6 +30,7 @@ export function TabBar({ indicatorPosition?: 'top' | 'bottom' indicatorColor?: string onSelect?: (index: number) => void + onPressSelected?: () => void }) { const pal = usePalette('default') const [itemLayouts, setItemLayouts] = useState<Layout[]>( @@ -80,6 +82,9 @@ export function TabBar({ const onPressItem = (index: number) => { onSelect?.(index) + if (index === selectedPage) { + onPressSelected?.() + } } return ( |