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

deprecate ReactFragmentActivity #19741

Closed

Conversation

dulmandakh
Copy link
Contributor

@dulmandakh dulmandakh commented Jun 15, 2018

Android Support Library page says https://developer.android.com/topic/libraries/support-library/

Caution: Starting with Support Library release 26.0.0 (July 2017), the minimum supported API level across most support libraries has increased to Android 4.0 (API level 14) for most library packages. For more information, see Version Support and Package Names in this document.

android.support.v4.app.FragmentActivity is used to support Fragments on Android API versions below 11. Now, we support only API version 14 and above, it's ok to remove ReactFragmentActivity that extends FragmentActivity.

Once ReactFragmentActivity removed, we can remove some codes that use android.support.v4 to work support ReactFragmentActivity on unsupported Android versions.

CI is failing for unknown reasons: https://circleci.com/gh/dulmandakh/react-native/278

Received 'killed' signal

Test Plan

Everything will build and work just fine, except showing _ ReactFragmentActivity_ as deprecated

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 15, 2018
@react-native-bot react-native-bot added ✅Test Plan Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. labels Jun 15, 2018
@dulmandakh
Copy link
Contributor Author

dulmandakh commented Jun 15, 2018

@hramos what do you think about this PR? I think this will give developers to change their code, then cleanup RN codebase to remove outdated Android versions.

@hramos
Copy link
Contributor

hramos commented Jun 15, 2018

SGTM

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Jun 15, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@dulmandakh dulmandakh deleted the deprecate-reactfragmentactivity branch June 21, 2018 01:40
macdoum1 pushed a commit to macdoum1/react-native that referenced this pull request Jun 28, 2018
Summary:
Android Support Library page says https://developer.android.com/topic/libraries/support-library/
> Caution: Starting with Support Library release 26.0.0 (July 2017), the minimum supported API level across most support libraries has increased to Android 4.0 (API level 14) for most library packages. For more information, see Version Support and Package Names in this document.

_android.support.v4.app.FragmentActivity_ is used to support **Fragment**s on Android API versions below 11. Now, we support only API version 14 and above, it's ok to remove _ReactFragmentActivity_ that extends _FragmentActivity_.

Once ReactFragmentActivity removed, we can remove some codes that use _android.support.v4_ to work support _ReactFragmentActivity_ on **unsupported** Android versions.

CI is failing for unknown reasons: https://circleci.com/gh/dulmandakh/react-native/278
> Received 'killed' signal

Everything will build and work just fine, except showing _ ReactFragmentActivity_ as deprecated
Closes facebook#19741

Differential Revision: D8454968

Pulled By: hramos

fbshipit-source-id: e5f901438ef764163af013fe854904a28c73070a
hramos pushed a commit that referenced this pull request Jul 4, 2018
Summary:
Android Support Library page says https://developer.android.com/topic/libraries/support-library/
> Caution: Starting with Support Library release 26.0.0 (July 2017), the minimum supported API level across most support libraries has increased to Android 4.0 (API level 14) for most library packages. For more information, see Version Support and Package Names in this document.

_android.support.v4.app.FragmentActivity_ is used to support **Fragment**s on Android API versions below 11. Now, we support only API version 14 and above, it's ok to remove _ReactFragmentActivity_ that extends _FragmentActivity_.

Once ReactFragmentActivity removed, we can remove some codes that use _android.support.v4_ to work support _ReactFragmentActivity_ on **unsupported** Android versions.

CI is failing for unknown reasons: https://circleci.com/gh/dulmandakh/react-native/278
> Received 'killed' signal

Everything will build and work just fine, except showing _ ReactFragmentActivity_ as deprecated
Closes #19741

Differential Revision: D8454968

Pulled By: hramos

fbshipit-source-id: e5f901438ef764163af013fe854904a28c73070a
@kmagiera
Copy link
Contributor

kmagiera commented Aug 3, 2018

I don't think this is the right approach. It is still recommended by android team to use classes from support library instead of relying on the corresponding classes from SDK. It makes it more future proof and avoid compatibility related problems when new methods gets added.

For source please see this paragraph on the link you cited: https://developer.android.com/topic/libraries/support-library/
screen shot 2018-08-03 at 12 37 09

Also note that android is deprecating a number of methods that's been a part of SDK and recommend to use corresponding methods from the support library. For example getFragmentManager is marked as deprecated as of API 28 (which is the most recent API version) and it is recommended that FragmentManager.getSupportFragmentManager is used instead that is a part of support-v4 lib. Source: https://developer.android.com/reference/android/app/Activity.html#getFragmentManager()
screen shot 2018-08-03 at 12 41 34

If we remove ReactFragmentActivity that would prevent browfield RN apps from using fragments in android 28 and above.

My suggestion is to actually follow the android team recommendation I posted in first paragraph and change ReactActivity to extend android.support.v4.app.ActivityCompat instead of plain android.app.Activity. Then we can leave ReactFragmentActivity as deprecated but instead of removing it in the near future we should just change it to extend ReactActivity directly and became an empty class. Note that such a change will have no effect on that class consumers as ActivityCompat extends FragmentActivity.

@hramos
Copy link
Contributor

hramos commented Aug 3, 2018

Sounds good. @dulmandakh do you think you can follow @kmagiera's suggestion above and send a PR?

@dulmandakh
Copy link
Contributor Author

@kmagiera got it, @hramos will create a PR shortly.

@dulmandakh
Copy link
Contributor Author

@hramos @kmagiera made some quick changes, and it seems that it requires more work than expected. I'll try to make it work tomorrow.

@dulmandakh
Copy link
Contributor Author

@kmagiera here is the PR to that incorporated your suggestions #19950

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved. Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants