Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unwrap Context in order to retrieve Activity subclass (#59)
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](https://github.com/expo/expo/blame/41458d1de91544c41097818db21e44e9aa84688c/android/expoview/src/main/java/versioned/host/exp/exponent/ReactUnthemedRootView.java#L13)). We now try to unwrap the context if it is not a fragment activity using `getBaseContext` This fixes expo/expo#3191
- Loading branch information