Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SafeAreaView doesn't work with this library #11

Closed
alisherakb opened this issue Jan 24, 2019 · 10 comments
Closed

SafeAreaView doesn't work with this library #11

alisherakb opened this issue Jan 24, 2019 · 10 comments

Comments

@alisherakb
Copy link

alisherakb commented Jan 24, 2019

Hi,

I'm using SafeAreaView from react-navigation and when I'm trying to add custom transition using this library the SafeAreaView is not taking into account on iOS devices.

Please help.

@plmok61
Copy link
Owner

plmok61 commented Jan 24, 2019

@alisherakb Can you please be a little more specific about what is exactly not working? Adding a screenshot would be helpful.

@alisherakb
Copy link
Author

alisherakb commented Jan 24, 2019

@plmok61
Here is my code:

import { SafeAreaView } from 'react-navigation';

<SafeAreaView style={{ flex: 1 }}>
   <View />
</SafeAreaView>

SafeAreaView sets automatic margins to container in order to properly show content on all devices.

But when I'm using this library, this component doesn't work and thus margins is not set.
Here is the pics:
customtransition

nocustomtransition

@plmok61
Copy link
Owner

plmok61 commented Jan 24, 2019

@alisherakb I believe this might be an issue with react-navigation itself. Is this the same issue?
react-navigation/react-navigation#3055

If so, try using forceInset. You can read about it here:
https://reactnavigation.org/docs/en/handling-iphonex.html

Please let me know if this fixes the issue and I will add an example to the README.

@alisherakb
Copy link
Author

@plmok61
The issue is not the same. Because SafeAreaView works perfectly if I remove this line transitionConfig: (nav) => handleCustomTransition(nav)

I also tried to set:
<SafeAreaView forceInset={'always'}>
But it doesn't work...

Any ideas what can cause a problem using the custom transition?

@plmok61
Copy link
Owner

plmok61 commented Jan 24, 2019

I will have to play around with this tonight and possibly over the weekend. Thanks for opening this issue.

@alisherakb
Copy link
Author

@plmok61 I would be very grateful. Looking forward.

@plmok61
Copy link
Owner

plmok61 commented Jan 25, 2019

@alisherakb can you show me your navigationOptions for this screen in the photo and StackNavigatorConfig ?

@plmok61
Copy link
Owner

plmok61 commented Jan 25, 2019

@alisherakb I might have figured it out.

Instead of: forceInset={'always'}

Try: forceInset={{ top: 'always', bottom: 'always' }}

@alisherakb
Copy link
Author

forceInset={{ top: 'always', bottom: 'always' }}

Thank you very much! You saved me.

@plmok61
Copy link
Owner

plmok61 commented Jan 25, 2019

Re-opening so I remember to add an example to the README for how to deal with this since react-navigation doesn't seem to explain it well.

@plmok61 plmok61 reopened this Jan 25, 2019
@plmok61 plmok61 closed this as completed Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants