-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Android][0.29] No longer possible to access Activity from SimpleViewManager #8661
Comments
Have you tried 49f20f4#commitcomment-18177294 ? |
Yeah, that's me discussing the issue in those comments also 😛 . After that discussion went nowhere, I decided to open this issue. |
@marcshilling yes, but you didn't reply if |
It didn't. |
Reviewed By: astreet Differential Revision: D3328342 fbshipit-source-id: af4e825d0b7c2d3d4490094a939e97cc527dd242
hi . this is my workaround to solve this problem . hope it will help u now. we can use getPackages(Activity activity) |
@InnerPeace080 you should send a pull request so we can get this in core! |
+1 I also cannot access Activity any longer, I need it in the constructor phase in order to get a SplashScreen working. Calling
|
@nickjanssen that's actually different from the issue being discussed here. You are extending This issue is regarding |
@foghina any thoughts on this? Seems like something super useful to get fixed. |
Having
As long as we properly document |
Summary: Addresses facebook#8661 Closes facebook#9071 Differential Revision: D3641285 Pulled By: foghina fbshipit-source-id: dede86743efddc33b6ead053e805770fc213685c
This is fixed in |
In |
@lschmierer correct |
So, what to do in this case? Is there any way to create the |
I'm not sure. What I'm doing is creating a placeholder object: @Override
protected FrameLayout createViewInstance(ThemedReactContext context) {
mFrameLayout = new FrameLayout(context);
return mFrameLayout;
} And then actually doing the work of adding the activity-dependent view to the FrameLayout later on when props change. |
Thank you, this seems to be a decent woraround! |
Hmm, that's a bug IMO. It happens because we call |
|
Summary: Addresses facebook#8661 Closes facebook#9071 Differential Revision: D3641285 Pulled By: foghina fbshipit-source-id: dede86743efddc33b6ead053e805770fc213685c
Summary: Addresses facebook#8661 Closes facebook#9071 Differential Revision: D3641285 Pulled By: foghina fbshipit-source-id: dede86743efddc33b6ead053e805770fc213685c
According to the 0.29.0 upgrade docs, it's now very easy to extend
ReactContextBaseJavaModule
and usegetCurrentActivity
to get the activity reference in native Android modules. However, it no longer appears to be possible to get access to the current activity from native Android UI Components.Continuing a discussion started here, I need access to the activity so that I can create a
FragmentManager
to add aFragment
to theFrameLayout
being vended fromSimpleViewManager
. There was a suggestion thatReactContext.getCurrentActivity()
be made public, which seems like a bad idea, but I can't think of another way.The text was updated successfully, but these errors were encountered: