NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

Popover is misaligned on Android putting it above the trigger

Open Swiftwork opened this issue 2 years ago • 5 comments

Description

Popover is misaligned and placed above trigger on Android.

CodeSandbox/Snack link

https://snack.expo.dev/@swiftwork/popover-misaligned-android

Steps to reproduce

import { Box, NativeBaseProvider, Text, Popover, Pressable } from 'native-base';

export default function App() {
  return (
    <NativeBaseProvider>
      <Box flex={1} justifyContent="center" alignItems="center">
        <Popover
          placement="left"
          trigger={(triggerProps) => (
            <Pressable {...triggerProps}>
              <Text>Trigger</Text>
            </Pressable>
          )}>
          <Popover.Content>
            <Popover.Arrow />
            <Popover.Body>
              <Text>Hello there!</Text>
            </Popover.Body>
          </Popover.Content>
        </Popover>
      </Box>
    </NativeBaseProvider>
  );
}

NativeBase Version

3.4

Platform

  • [X] Android
  • [ ] CRA
  • [ ] Expo
  • [ ] iOS
  • [ ] Next

Other Platform

No response

Additional Information

This might have to do with status bar size not being taken into account during modal placement calculation.

image

Swiftwork avatar Sep 30 '22 16:09 Swiftwork

Hey @Swiftwork, Thanks for reporting the issue. We'll fix it.

ankit-tailor avatar Oct 04 '22 05:10 ankit-tailor

Hello, I am having the same issue unfortunately. Any updates on the fix please?

hirvesh avatar Nov 16 '22 11:11 hirvesh

Bump!!! Have same thing in project I'm working on. Specifically in this case in a modal window.

curtisgibeaut avatar Jun 14 '23 14:06 curtisgibeaut

bump!! mee too

evanoralph avatar Jun 25 '23 13:06 evanoralph

I fixed it with this workaround:

const androidOffsetFix = Platform.OS === 'android' ? 12 : 0

<Popover
  placement='left'
  trigger={(triggerProps) => (
    <Pressable {...triggerProps} p={3}>
      {<InfoIcon size='sm' color='primary.600' />}
    </Pressable>
  )}
>
  <Popover.Content width={250} top={androidOffsetFix} position={'relative'}>
    <Popover.Arrow mt={androidOffsetFix} />
    <Popover.Body>
      <Text>{popoverText}</Text>
    </Popover.Body>
  </Popover.Content>
</Popover>

pinktonio avatar Jan 05 '24 11:01 pinktonio