I am encoding my own Android module with React Native 0.46, and I am unable to get the current instance of activity from the module.
I have a class extending ReactContextBaseJavaModule that contains the built-in getCurrentActivity () method. However, every time I call this method, I get zero.
I think this is because I call it in my module constructor, which runs at the beginning of the Android application, perhaps before the Activity instance is created?
If you guys know a clean way to access the current Activity instance from the module (without having to store the Activity instance at some point and, if possible, pass it on), I will be happy!
source share