Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Sanity check selector swipes

+4 -2
+4 -2
src/view/com/util/ViewSelector.tsx
··· 4 4 import {HorzSwipe} from './gestures/HorzSwipe' 5 5 import {useAnimatedValue} from '../../lib/hooks/useAnimatedValue' 6 6 import {OnScrollCb} from '../../lib/hooks/useOnMainScroll' 7 + import {clamp} from '../../../lib/numbers' 7 8 8 9 const HEADER_ITEM = {_reactKey: '__header__'} 9 10 const SELECTOR_ITEM = {_reactKey: '__selector__'} ··· 46 47 47 48 const onSwipeEnd = (dx: number) => { 48 49 if (dx !== 0) { 49 - setSelectedIndex(selectedIndex + dx) 50 + setSelectedIndex(clamp(selectedIndex + dx, 0, sections.length)) 50 51 } 51 52 } 52 - const onPressSelection = (index: number) => setSelectedIndex(index) 53 + const onPressSelection = (index: number) => 54 + setSelectedIndex(clamp(index, 0, sections.length)) 53 55 useEffect(() => { 54 56 onSelectView?.(selectedIndex) 55 57 }, [selectedIndex])