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

Note: usage of ReactFragmentActivity was supposed to be removed in RN 0.57 #7

Closed
jamsch opened this issue Sep 13, 2018 · 18 comments
Closed

Comments

@jamsch
Copy link

jamsch commented Sep 13, 2018

I see that the library uses and relies on ReactFragmentActivity.
https://github.com/kmagiera/react-native-screens/blob/70c022c6282dfefd2d7edec5e3b382bdcb0d3a04/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java#L45

On React Native master though, this should have been removed by 0.57
https://github.com/facebook/react-native/blob/7f1fcb67e57769cfe8521756fe4c4a6e5cb64de0/ReactAndroid/src/main/java/com/facebook/react/ReactFragmentActivity.java#L23

@jamsch jamsch changed the title Note: usage of ReactFragmentActivity was supposed to be deprecated in RN 0.57 Note: usage of ReactFragmentActivity was supposed to be removed in RN 0.57 Sep 13, 2018
@ritz078
Copy link

ritz078 commented Sep 13, 2018

I am actually getting that error on RN 0.56.0

react-navigation - 2.14.0
react-native-screens- alpha.9

@Bunkerbewohner
Copy link

I have the same problem. The MainActivity generated by current React Native derives from ReactActivity.

@kmagiera
Copy link
Member

Hey! Seems to be still available in 0.57 -> https://github.com/facebook/react-native/blob/0.57-stable/ReactAndroid/src/main/java/com/facebook/react/ReactFragmentActivity.java

In fact, there is another great PR by @dulmandakh here facebook/react-native#20602 which makes the default ReactActivity extend AppCompatActivity. This will make it possible for Android apps to use Screens without any need to change the baseclass to ReactFragmentActivity because AppComparActivity already extends FragmentActivity.

TLDR: ReactFragmentActivity won't go away until teh default ReactActivity provides enough functionality for screens to work. In the worst case scenario you will have to change ReactFragmentActivity back to ReactActivity when upgrading to 0.58 (or when fragment activity will be ditched)

@kelset
Copy link
Contributor

kelset commented Sep 21, 2018

👋 @kmagiera - I just tested locally react-native-screens and I'm actually getting the red screen of death with the error message reported above (In order to use RNScreen components your app's activity need to extend ReactFragmentActivity or ReactCompatActivity).

Not sure what may be causing this; you should be able to repro by simply using this test proj I'm using -> https://github.com/kelset/test-react-nav-with-screens.

On iOS everything works fine.

@ritz078
Copy link

ritz078 commented Sep 21, 2018

@kelset Replace ReactActivity with ReactFragmentActivity in https://github.com/kelset/test-react-nav-with-screens/blob/3e4b4a3d1142809189a79bdad3694e82fdafab97/android/app/src/main/java/com/testnavigation/MainActivity.java#L5

@kelset
Copy link
Contributor

kelset commented Sep 21, 2018

@ritz078 thanks it fixed it! 🤗

@ice-chillios
Copy link
Contributor

@kmagiera This probably can be closed :)

@kmagiera
Copy link
Member

I updated the readme to include an information about that

@noahtallen
Copy link

According to ReactFragmentActivity.java it will be removed in 0.59. In fact, this recently merged PR removes all of the overriden methods from ReactFragmentActivity and makes ReactActivity extend FragmentActivity. It doesn't look like it has been released yet, though. So I'm guessing react-native-screens will need to take advantage of that once it's out :)

@kmagiera
Copy link
Member

Thanks for pointing that out @noahtallen

I was aware that such a change was planned but wasn't following the updates on it. I'll make sure to update docs and glad to hear about this change as it will mean the configuration of screens is going to be simplified.

@fbartho
Copy link

fbartho commented Mar 19, 2019

@noahtallen / @kmagiera -- For somebody using React-Native 59, what are the current in-progress instructions regarding how to use react-native-screens?

Do I need to do anything to MainActivity? -- Even using react-native 0.59.1 (Which has FragmentActivity as a parent class of ReactActivity) it still reports that onCreate is not a method in the super class.

@fbartho
Copy link

fbartho commented Mar 19, 2019

Currently, when I enable useScreens() on react-native 0.59.0 and 0.59.1 -- without changing the base class of my MainActivity, buttons on some screens are not tappable.

(I'm using react-navigation)

Does anybody have a workaround that helps fix this? -- I'm happy to file a new Issue if that would be more helpful @kmagiera

@anhtuank7c
Copy link

ReactFragmentActivity is deprecated but still available in RN 0.59.5.
Just wonder when do we could use ReactActivity instead

@ghost
Copy link

ghost commented May 3, 2019

For now it's working well with RN 0.59.5 and ReactActivity (facebook/react-native#22662).

@jhoanborges
Copy link

I get an error when i change ReactActivity to ReactFragmentActivity. I'm using "react-native": "^0.59.8", it says 'com.facebook.react.ReactFragmentActivity' is deprecated. Although the performance was increased even using ReactActivity.

@dulmandakh
Copy link
Contributor

dulmandakh commented Jul 4, 2019 via email

@jhoanborges
Copy link

@dulmandakh thank you. This should be added to the documentation.

@dulmandakh
Copy link
Contributor

dulmandakh commented Jul 4, 2019 via email

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