How to access currentActivity and lifecycleowner in Fabric Module? #63
Unanswered
BraveEvidence
asked this question in
Q&A
Replies: 1 comment
-
|
Should I pass Is this correct? I am worried about memory leak |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to create a
Fabricmodule.The code is something like this. I am using
camera-xlib which requires access tolifecycleownerand for some bluetooth permissions I requirecurrentActivityas well.So in
bindToLifecycle, this refers tolifecycleownerIn old architecture we would get
lifecycleownerusing below codebut in the new architecture we can't cast
ContexttoReactContextas that throws errorAlso there is no way to access
currentActivityin aFabricmodule as theconstructortakesContextand not aReactApplicationContext. PassingReactApplicationContextinstead ofContextthrows error as theViewManagerclass requiresThemedReactContextwhich is kind of similar toContextas there is no way to getcurrentActivityorlifecyclefromThemedReactContextI am using this approach to create a fabric module
Beta Was this translation helpful? Give feedback.
All reactions