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

Unwrap Context in order to retrieve Activity subclass #59

Merged
merged 1 commit into from
Jan 15, 2019

Conversation

kmagiera
Copy link
Member

This fixes crash on Expo client which is wrapping Activity prior to passing it as a context to the root view.

After my recent change in the logic on how we access main activity we know extract the reference to it using getContext from the root view. Previously we were using getTopLevelActivity which wasn't working well in the cases where other non-react-native activities were transitioning in or out. The new approach however turned out not to be the best as for example expo client does not pass activity instance as a context directly to the root view. Instead the activity class is wrapped in ContextThemeWrapper (see it here).

We now try to unwrap the context if it is not a fragment activity using getBaseContext

This fixes expo/expo#3191

This fixes crash on Expo client which is wrapping Activity prior to passing it as a context to the root view.
@kmagiera kmagiera merged commit c741acf into master Jan 15, 2019
@kmagiera kmagiera deleted the fix_expo_client branch January 15, 2019 15:29
tsapeta added a commit to expo/expo that referenced this pull request Jan 16, 2019
# Why

Fixes #3191 

# How

Applied changes from software-mansion/react-native-screens#59 

# Test Plan

Apps in SDK32 can now be launched without red screen of death.
tsapeta added a commit to expo/expo that referenced this pull request Jan 17, 2019
# Why

Fixes #3191 

# How

Applied changes from software-mansion/react-native-screens#59 

# Test Plan

Apps in SDK32 can now be launched without red screen of death.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Latest Android Expo Client (2.10.3) crashes when using RNScreens
1 participant