Uh oh!
There was an error while loading. Please reload this page.
DialogModule supports only FragmentActivity - #23365
Conversation
dulmandakh
commented
Feb 11, 2019
@mdvacca could you please look at test failure? |
Assuming DialogModule would only be used by new RN apps is a wrong assumption. Casting |
dulmandakh
commented
Feb 11, 2019
@hey99xx changed to use AppCompatActivity, but DialogModuleTest is failing. I have very little experience with Java tests. Could you please help with this? |
I still think this PR is an issue. In my company we have a |
dulmandakh
commented
Feb 11, 2019
@hey99xx I think that it's safe to drop plain Activity support |
hey99xx
commented
Feb 11, 2019
While you could obviously cast to I think the intention behind allowing multiple fragment types was beneficial to integrating RN with brownfield apps, I don't know why you'd want to drop that now. |
dulmandakh
commented
Feb 11, 2019
@hey99xx Google recommends to extend AppCompatActivity for Android apps, and thought that it's better to drop support for plain Activity. Thanks for you suggestions, I don't have experience with brownfield apps. Now, it uses FragmentActivity. |
dulmandakh
commented
Feb 11, 2019
@hey99xx I'll be requesting your review when I make such changes. Thank you |
hey99xx
commented
Feb 11, 2019
Btw I think some of RN widgets are not ready to extend from AppCompat classes in couple line changes, they cause runtime issues on old Android versions. I've described what goes wrong in #22885 and made a comment in one of your other PRs. |
@hey99xx I saw the issue, and though that it would be best to have only FragmentActivity and it's subclasses supported, then remove plain Activity support. Therefore, change how contexts works. Otherwise, we'll have duplicate code to support both FragmentActivity and plain Activity which doubles error surface. Please correct me if wrong. |
dulmandakh
commented
Feb 11, 2019
Also found that DialogFragment is deprecated in API 28, and recommends to use DialogFragment from Support Library, which this PR does. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@mdvacca has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
mdvacca
commented
Feb 11, 2019
The land failed because there is a test that is using activity and can not be casted to FragmentActivity: |
mdvacca
commented
Feb 11, 2019
cpojer
commented
Feb 11, 2019
@mdvacca how many people do you think this will be breaking for? If the answer is at most ~8%, then I'd say let's ship this change now and ask them to upgrade. |
cpojer
commented
Feb 12, 2019
@mdvacca if it works at FB, let's land it and move forward. We need to do this eventually anyway. |
cpojer
commented
Mar 18, 2019
@dulmandakh can you rebase this? |
cpojer
commented
Mar 19, 2019
@dulmandakh seems like this is failing android CI. Can you fix? |
cpojer
commented
Apr 8, 2019
Let's see if this works. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
cpojer
commented
Apr 26, 2019
@dulmandakh we are getting |
dulmandakh
commented
Apr 26, 2019
yep, it's AndroidX now. I'll rebase and fix the issue. Almost forgot this PR 😄 |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
react-native-bot
commented
Apr 26, 2019
This pull request was successfully merged by @dulmandakh in 243070a. When will my fix make it into a release? | Upcoming Releases |
Summary: This sync includes the following changes: - **[dd4950c](react/react@dd4950c90 )**: [Flight] Implement useId hook ([#24172](react/react#24172)) //<Josh Story>// - **[26a5b3c](react/react@26a5b3c7f )**: Explicitly set `highWaterMark` to 0 for `ReadableStream` ([#24641](react/react#24641)) //<Josh Larson>// - **[aec5759](react/react@aec575914 )**: [Fizz] Send errors down to client ([#24551](react/react#24551)) //<Josh Story>// - **[a276638](react/react@a2766387e )**: [Fizz] Improve text separator byte efficiency ([#24630](react/react#24630)) //<Josh Story>// - **[f786053](react/react@f7860538a )**: Fix typo in useSyncExternalStore main entry point error ([#24631](react/react#24631)) //<François Chalifour>// - **[1bed207](react/react@1bed20731 )**: Add a module map option to the Webpack Flight Client ([#24629](react/react#24629)) //<Sebastian Markbåge>// - **[b2763d3](react/react@b2763d3ea )**: Move hydration code out of normal Suspense path ([#24532](react/react#24532)) //<Andrew Clark>// - **[357a613](react/react@357a61324 )**: [DevTools][Transition Tracing] Added support for Suspense Boundaries ([#23365](react/react#23365)) //<Luna Ruan>// - **[2c8a145](react/react@2c8a1452b )**: Fix ignored setState in Safari when iframe is touched ([#24459](react/react#24459)) //<dan>// - **[6266263](react/react@62662633d )**: Remove enableFlipOffscreenUnhideOrder ([#24545](react/react#24545)) //<Ricky>// - **[34da5aa](react/react@34da5aa69 )**: Only treat updates to lazy as a new mount in legacy mode ([#24530](react/react#24530)) //<Ricky>// - **[46a6d77](react/react@46a6d77e3 )**: Unify JSResourceReference Interfaces ([#24507](react/react#24507)) //<Timothy Yung>// - **[6cbf0f7](react/react@6cbf0f7fa )**: Fork ReactSymbols ([#24484](react/react#24484)) //<Ricky>// - **[a10a9a6](react/react@a10a9a6b5 )**: Add test for hiding children after layout destroy ([#24483](react/react#24483)) //<Ricky>// - **[b4eb0ad](react/react@b4eb0ad71 )**: Do not replay erroring beginWork with invokeGuardedCallback when suspended or previously errored ([#24480](react/react#24480)) //<Josh Story>// - **[99eef9e](react/react@99eef9e2d )**: Hide children of Offscreen after destroy effects ([#24446](react/react#24446)) //<Ricky>// - **[ce13860](react/react@ce1386028 )**: Remove enablePersistentOffscreenHostContainer flag ([#24460](react/react#24460)) //<Andrew Clark>// - **[72b7462](react/react@72b7462fe )**: Bump local package.json versions for 18.1 release ([#24447](react/react#24447)) //<Andrew Clark>// - **[22edb9f](react/react@22edb9f77 )**: React `version` field should match package.json ([#24445](react/react#24445)) //<Andrew Clark>// - **[6bf3dee](react/react@6bf3deef5 )**: Upgrade react-shallow-renderer to support react 18 ([#24442](react/react#24442)) //<Michael サイトー 中村 Bashurov>// Changelog: [General][Changed] - React Native sync for revisions bd4784c...d300ceb jest_e2e[run_all_tests] Reviewed By: cortinico, kacieb Differential Revision: D36874368 fbshipit-source-id: c0ee015f4ef2fa56e57f7a1f6bc37dd05c949877
Summary
Now RN has only ReactActivity which extends AppCompatActivity, subclass of FragmentActivity, therefore no need to check if activity is FragmentActivity or not. This PR changes DialogModule to work only with FragmentActivity.
Also DialogFragment from Android is deprecated in API 28, and recommends to use DialogFragment from Support Library. Excerpt from DialogFragment documentation.
BREAKING CHANGE: Brown field apps must extend FragmentActivity or its subclasses.
Changelog
[Android] [Changed] - DialogModule supports only FragmentActivity
Test Plan
CI is green, and works as usual.