diff options
author | Hailey <me@haileyok.com> | 2024-04-12 15:22:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-12 15:22:09 -0700 |
commit | c3821fdc311fe7ddebede427715892d3a1e53716 (patch) | |
tree | be783cae52ddfeba56c06ceba08773170ca5afe9 /src/view/com/util | |
parent | 6218eb0eeac2ccab33c56fda97a52837edd58694 (diff) | |
download | voidsky-c3821fdc311fe7ddebede427715892d3a1e53716.tar.zst |
Remove vertical scrollbars from views on native (#3429)
* remove vertical scrollbars * add to a few missing lists * gate this change * use `hide_vertical_scroll_indicators` * fix gate lint * fix bool
Diffstat (limited to 'src/view/com/util')
-rw-r--r-- | src/view/com/util/List.tsx | 13 | ||||
-rw-r--r-- | src/view/com/util/Views.jsx | 16 |
2 files changed, 24 insertions, 5 deletions
diff --git a/src/view/com/util/List.tsx b/src/view/com/util/List.tsx index d30a9d805..b3bde2a11 100644 --- a/src/view/com/util/List.tsx +++ b/src/view/com/util/List.tsx @@ -1,11 +1,14 @@ import React, {memo} from 'react' import {FlatListProps, RefreshControl} from 'react-native' -import {FlatList_INTERNAL} from './Views' -import {addStyle} from 'lib/styles' -import {useScrollHandlers} from '#/lib/ScrollContext' import {runOnJS, useSharedValue} from 'react-native-reanimated' + import {useAnimatedScrollHandler} from '#/lib/hooks/useAnimatedScrollHandler_FIXED' import {usePalette} from '#/lib/hooks/usePalette' +import {useScrollHandlers} from '#/lib/ScrollContext' +import {useGate} from 'lib/statsig/statsig' +import {addStyle} from 'lib/styles' +import {isWeb} from 'platform/detection' +import {FlatList_INTERNAL} from './Views' export type ListMethods = FlatList_INTERNAL export type ListProps<ItemT> = Omit< @@ -37,7 +40,8 @@ function ListImpl<ItemT>( const isScrolledDown = useSharedValue(false) const contextScrollHandlers = useScrollHandlers() const pal = usePalette('default') - + const showsVerticalScrollIndicator = + !useGate('hide_vertical_scroll_indicators') || isWeb function handleScrolledDownChange(didScrollDown: boolean) { onScrolledDownChange?.(didScrollDown) } @@ -93,6 +97,7 @@ function ListImpl<ItemT>( scrollEventThrottle={1} style={style} ref={ref} + showsVerticalScrollIndicator={showsVerticalScrollIndicator} /> ) } diff --git a/src/view/com/util/Views.jsx b/src/view/com/util/Views.jsx index 7d6120583..6850f42a4 100644 --- a/src/view/com/util/Views.jsx +++ b/src/view/com/util/Views.jsx @@ -2,8 +2,22 @@ import React from 'react' import {View} from 'react-native' import Animated from 'react-native-reanimated' +import {useGate} from 'lib/statsig/statsig' + export const FlatList_INTERNAL = Animated.FlatList -export const ScrollView = Animated.ScrollView export function CenteredView(props) { return <View {...props} /> } + +export function ScrollView(props) { + const showsVerticalScrollIndicator = !useGate( + 'hide_vertical_scroll_indicators', + ) + + return ( + <Animated.ScrollView + {...props} + showsVerticalScrollIndicator={showsVerticalScrollIndicator} + /> + ) +} |