NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

<Select /> renders below modals on iOS

Open FezVrasta opened this issue 4 years ago • 30 comments

Before reporting this bug, please...

  1. Check the latest documentation: https://docs.nativebase.io/
  2. Check for existing open/closed issues for a possible duplicate before creating a new issue: https://github.com/GeekyAnts/NativeBase/issues
  3. Use the latest NativeBase release: https://github.com/GeekyAnts/NativeBase/releases
  4. Check examples from NativeBase KitchenSink https://github.com/GeekyAnts/NativeBase-KitchenSink
  5. For discussion purpose make use of NativeBase discord: https://discord.gg/TSgCw2UPmb

Describe the bug

If I click to open a <Select /> rendered inside an iOS modal, the select is rendered below the modal.

To Reproduce Steps to reproduce the behaviour:

As description.

Expected behaviour

The Select should float above the modal.

CodeSandBox/Snack link

Screenshots

Platform

  • NativeBase version [e.g. 3.0.1] latest
  • Device: [e.g. iPhone6] any
  • OS: [e.g. iOS8.1] iOS 15
  • Browser [e.g. stock browser, safari] N/A
  • Browser version [e.g. 22] N/A
  • React Native version [e.g. sdk-42]
  • Expo sdk version [e.g. 41] 42
  • node [e.g. 14.16.1] 14.17.4
  • yarn or npm [e.g. 6.1] Yarn 3.0.2

Additional information

  1. Add any other context about the problem here.
  2. Is the bug present in both iOS and Android or in any one of them?
  3. If you want your issue to be looked at quicker, please attach a snack reproducible with your issue. Makes it easier for us!

FezVrasta avatar Oct 02 '21 17:10 FezVrasta

@FezVrasta are you using Modal component from NativeBase? React Native's built in modal always appears on top of any View. Let us know if the Modal from NativeBase works as expected.

I'm using the one from React navigation, I suppose it's the Native one. I'll try with yours

FezVrasta avatar Oct 14 '21 09:10 FezVrasta

Okay sure, with React Navigation can you try putting the NativeBaseProvider above the NavigationContainer?

Hey everyone, I have the same issue, even after move NavigationContainer into NativeBaseProvider

<NativeBaseProvider>
  <NavigationContainer>
    ...
  </NavigationContainer>
</NativeBaseProvider>

But I got the same result FezVrasta mentioned

cruzlutor avatar Oct 17 '21 16:10 cruzlutor

@cruzlutor are you using native StackNavigator?

Yes, I'm using NativeStackNavigator instead StackNavigator, However, after the switch to StackNavigator it made the trick. Do you know why StackNavigator works and NativeStackNavigator doesn't?

cruzlutor avatar Oct 18 '21 14:10 cruzlutor

The Modal components in NativeBase uses a JavaScript portal implementation and it doesn't render on top of the Native Stack Navigator screens. We're actively looking into this issue. I'll update once we come up with a solution. Current hacky solution to make it work would be to wrap each screen with a NativeBaseProvider.

Any updates on this? Or any workarounds I can try?

rananajam1 avatar Nov 09 '21 06:11 rananajam1

I'm running into this too.

OneHatRepo avatar Nov 10 '21 22:11 OneHatRepo

I had the same issue while using Select and Popover (NativeBase v3.2.2). The only solution that worked for me was to replace @react-navigation/native-stack with @react-navigation/stack.

eneax avatar Nov 16 '21 10:11 eneax

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 02 '22 04:02 stale[bot]

Don't close this issue. This is an automatic message by Fresh - a bot against stale bots.

FezVrasta avatar Feb 03 '22 01:02 FezVrasta

I have the same issue, using 3.3.5

mchambaud avatar Feb 04 '22 17:02 mchambaud

The issue occurs due to multiple overlay components. We're working on it. Hope to fix this in the coming release.

surajahmed avatar Feb 11 '22 08:02 surajahmed

I have the same issue, using 3.3.7

mcatal avatar Feb 22 '22 10:02 mcatal

i am having the same issue with 3.2.2

sjonchhe avatar Mar 25 '22 10:03 sjonchhe

still same 3.4.1

mcatal avatar Apr 13 '22 05:04 mcatal

We're working on this. Hope to fix this in the coming release. Thanks for your patience.

surajahmed avatar Apr 20 '22 09:04 surajahmed

Would be helpful to mention this restriction in the docs for the time being. Would have saved me an hour or so. Probably the same for others.

uschtwill avatar Jun 18 '22 14:06 uschtwill

ANy update on this yet i am still facing same issue>

asurion-ashutosh avatar Jun 24 '22 16:06 asurion-ashutosh

any update ??

GunturThunder avatar Jul 25 '22 02:07 GunturThunder

Any update? same issue

matheussss1 avatar Jul 25 '22 13:07 matheussss1

We've been working on some workaround. This issue is coming from our internal Overlay component. We've to change our component render pattern to solve this issue. This may take some time.

Thanks for your patience.

surajahmed avatar Aug 03 '22 06:08 surajahmed

Thanks @surajahmed.

Same here. any suggestion or workaround for the time being?

cguagenti avatar Aug 19 '22 10:08 cguagenti

FIX: upgrade to version 3.4.6 (or higher)

Replace import { Modal } from "react-native";
with import { Modal } from 'native-base';

Select should now render above modal on iOS. https://docs.nativebase.io/select

olamigokayphils avatar Aug 19 '22 22:08 olamigokayphils

this is still happening and I am on 3.4.20 Is any one else still having this? or can you guys confirm at least if this is working for you now? I have spent days on this and planning to completely take off the nativebase unfortunately.

byberkan avatar Nov 07 '22 06:11 byberkan

@byberkan I managed to get it working when using the "presentation" prop for Stack Navigator Screen Options but couldn't get it working for general purposes (it seemed very on-off and sometimes it would work). In the end, we changed the design to get around this.

Edit: You need to be on 3.4.6

rileyy29 avatar Nov 07 '22 08:11 rileyy29

FIX: upgrade to version 3.4.6 (or higher)

Replace import { Modal } from "react-native"; with import { Modal } from 'native-base';

Select should now render above modal on iOS. https://docs.nativebase.io/select

this is working perfectly

Thanks @olamigokayphils

mcanikhilprajapati avatar Nov 09 '22 12:11 mcanikhilprajapati

Hi, same probleme here. When using createNativeStackNavigator (react-navigation ) and having one of my screen with presentation option prop set to "modal", the select displays behind the screen modal.

habaieba avatar Nov 23 '22 13:11 habaieba

Hi, same probleme here. When using createNativeStackNavigator (react-navigation ) and having one of my screen with presentation option prop set to "modal", the select displays behind the screen modal.

Does this solve your issue? It solved mine which was kind of the same as yours: https://github.com/GeekyAnts/NativeBase/issues/4864#issuecomment-1240632661

eblancperso avatar Nov 26 '22 18:11 eblancperso