Fix profile layout shift (#1690)

zio/stable
dan 2023-10-13 15:25:16 +01:00 committed by GitHub
parent 2a1edab6d4
commit eba9f8a166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 13 deletions

View File

@ -144,8 +144,6 @@ export function Selector({
items: string[]
onSelect?: (index: number) => void
}) {
const [height, setHeight] = useState(0)
const pal = usePalette('default')
const borderColor = useColorSchemeStyle(
{borderColor: colors.black},
@ -160,22 +158,13 @@ export function Selector({
<View
style={{
width: '100%',
position: 'relative',
overflow: 'hidden',
height,
backgroundColor: pal.colors.background,
}}>
<ScrollView
testID="selector"
horizontal
showsHorizontalScrollIndicator={false}
style={{position: 'absolute'}}>
<View
style={[pal.view, styles.outer]}
onLayout={e => {
const {height: layoutHeight} = e.nativeEvent.layout
setHeight(layoutHeight || 60)
}}>
showsHorizontalScrollIndicator={false}>
<View style={[pal.view, styles.outer]}>
{items.map((item, i) => {
const selected = i === selectedIndex
return (