facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.69k stars 24.3k forks source link

[0.29] - Activity context needed for 3rd party #8601

Closed GantMan closed 8 years ago

GantMan commented 8 years ago

I'm using react-native-maps off of a branch that worked with 0.28.

One of the things it needed for Android, was the Android Activity passed into the constructor, ergo MapsPackage(this)

Now that the packages are moved to an Application context, I'm not exactly sure what to pass the constructor? It won't take the application context, and most things I read say you can't easily get the activity context.

satya164 commented 8 years ago

The plugin needs to be updated to not pass activity reference in the constructor and use getCurrentActivity (it's backward compatible). You should file an issue in the plugin's repo. Check the discussion here - https://github.com/facebook/react-native/commit/49f20f41546e3ba8e7fe43c84c4c701684d0434d

marcshilling commented 8 years ago

For anyone who ends up here trying to get the current activity in a SimpleViewManager, I'm trying to get some traction on this issue: #8661. @satya164's solution only applies to Native Modules, not Native UI Components.