Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactNative - How to get activity instance starting from version 0.29

I am writing my own ViewManager which does need to get activity instance. Before version 0.29 it was straight forward, but after [email protected] breaking changes I can't find a way to do it.

Thank you.

like image 804
Alberto Dallaporta Avatar asked Jul 29 '16 12:07

Alberto Dallaporta


1 Answers

Next React Native version will have the reactContext.getCurrentActivity() method exposed publicly rather than just being available when extending ReactContextBaseJavaModule.

Relevant commit: https://github.com/facebook/react-native/commit/760656461197605ee26769ed73989f78e4753038

Update: I've just confirmed that this change will be cherry-picked into 0.31 and will land in few days.

like image 103
Mike Grabowski Avatar answered Nov 19 '22 08:11

Mike Grabowski