Push ReactContext logic in derived classes#44026
Closed
fabriziocucci wants to merge 1 commit intofacebook:mainfrom
Closed
Push ReactContext logic in derived classes#44026fabriziocucci wants to merge 1 commit intofacebook:mainfrom
fabriziocucci wants to merge 1 commit intofacebook:mainfrom
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D55964787 |
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D55964787 |
86e3f10 to
afba36b
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D55964787 |
afba36b to
688f0ed
Compare
Summary: Pull Request resolved: facebook#44026 Changelog: [Android][Removed] Delete ReactContext.initializeWithInstance(). ReactContext now no longer contains legacy react instance methods. Please use BridgeReactInstance instead. Yet another attempt to land this (last one was D55505416). Copy-pasting below the amazing summary from RSNara. ## Context Prior, ReactContext used to implement bridge logic. For bridgeless mode, we created BridgelessReactContext < ReactContext ## Problem This could lead to failures: we could call bridge methods in bridgeless mode. ## Changes Primary change: - Make all the react instance methods inside ReactContext abstract. Secondary changes: Implement react instance methods in concrete subclasses: - **New:** BridgeReactContext: By delegating to CatalystInstance - **New:** ThemedReactContext: By delegating to inner ReactContext - **Unchanged:** BridgelessReactContext: By delegating to ReactHost ## Auxiliary changes This fixes ThemedReactContext in bridgeless mode. **Problem:** Prior, ThemedReactContext's react instance methods did not work in bridgeless mode: ThemedReactContext wasn't initialized in bridgeless mode, so all those methods had undefined behaviour. **Solution:** ThemedReactContext now implements all react instance methods, by just forwarding to the initialized ReactContext it decorates (which has an instance). NOTE: Intentionally not converting `BridgeReactContext` to Kotlin to minimize the risk of these changes. Reviewed By: RSNara Differential Revision: D55964787
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D55964787 |
688f0ed to
9430b39
Compare
Base commit: 77efd19 |
Contributor
|
This pull request has been merged in 05ef779. |
|
This pull request was successfully merged by @fabriziocucci in 05ef779. When will my fix make it into a release? | How to file a pick request? |
Contributor
|
This pull request has been reverted by 7131f94. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Changelog: [Android][Removed] Delete ReactContext.initializeWithInstance(). ReactContext now no longer contains legacy react instance methods. Please use BridgeReactInstance instead.
Yet another attempt to land this (last one was D55505416).
Copy-pasting below the amazing summary from RSNara.
Context
Prior, ReactContext used to implement bridge logic.
For bridgeless mode, we created BridgelessReactContext < ReactContext
Problem
This could lead to failures: we could call bridge methods in bridgeless mode.
Changes
Primary change:
Secondary changes: Implement react instance methods in concrete subclasses:
Auxiliary changes
This fixes ThemedReactContext in bridgeless mode.
Problem: Prior, ThemedReactContext's react instance methods did not work in bridgeless mode: ThemedReactContext wasn't initialized in bridgeless mode, so all those methods had undefined behaviour.
Solution: ThemedReactContext now implements all react instance methods, by just forwarding to the initialized ReactContext it decorates (which has an instance).
NOTE: Intentionally not converting
BridgeReactContextto Kotlin to minimize the risk of these changes.Differential Revision: D55964787