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