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

RN 0.58 + Android target SDK 27 = Problem with orientation locker #55

Closed
radeno opened this issue Mar 1, 2019 · 6 comments
Closed

RN 0.58 + Android target SDK 27 = Problem with orientation locker #55

radeno opened this issue Mar 1, 2019 · 6 comments

Comments

@radeno
Copy link

radeno commented Mar 1, 2019

Hi,

its looks like that Android by SDK 27 and up change ability to locking screen which are not fullscreen.
It is only issue when target SDK is set to 27, which is default in RN 0.58. But when is compiled with target SDK 26 it works.
Error:
Issue: java.lang.IllegalStateException: Only fullscreen activities can request orientation

Any hints how to fix it without any complex solution ? Maybe add oneliner into AndroidManifest.xml ?

Same issues in different repositories
Instabug/Instabug-Android#68
ParkSangGwon/TedPermission#63

@radeno
Copy link
Author

radeno commented Mar 1, 2019

I have digging down and this is problem just with RN 0.58 branch. Because combination target SDK 27 and ReactActivity extending from Activity.

RN 0.59 extending from AppCompatActivity which will fix it.
More about issue in this link: https://stackoverflow.com/questions/49124073/how-to-restrict-screen-orientation-to-portrait-in-android-sdk-27

@radeno radeno changed the title RN >=0.58 - Android SDK >= 27 - Problem with orientation locker RN 0.58 + Android target SDK 27 = Problem with orientation locker Mar 1, 2019
@radeno
Copy link
Author

radeno commented Mar 1, 2019

Simple working fix is disabling translucent feature
in file android/app/src/main/res/values/styles.xml replace:

<item name="android:windowIsTranslucent">true</item>

to

<item name="android:windowIsTranslucent">false</item>

Maybe this can be noticed in Readme file.

It is bug just for Android 8.0.

@wonday
Copy link
Owner

wonday commented Mar 12, 2019

I had add this notice to readme.

@asfreng-returns
Copy link

Im having the same issue with RN 0.59.0 and SDK 28

@wonday wonday closed this as completed Jul 2, 2019
@ggunti
Copy link

ggunti commented Jun 7, 2020

I don't think that the version of react-native matters, I get the error also with RN 0.61.5 on android 8. I'll try @radeno solution.

@wilau2
Copy link

wilau2 commented Jun 29, 2020

Android 8 is the problem here.

The problem with @radeno solution is that it breaks the https://github.com/crazycodeboy/react-native-splash-screen that requires <item name="android:windowIsTranslucent">true</item> to be nice and smooth.

By making this fix, your splashscreen will have a white flash instead of being nice and smooth.

I'll test a couple of solutions from this thread and see if I can get something to work for android 8 with splashscreen.

https://stackoverflow.com/questions/48072438/java-lang-illegalstateexception-only-fullscreen-opaque-activities-can-request-o

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

5 participants