How to get the MainActivity (ReactActivity) from within the ReactNativeHost within the ReactApplication
<p>This question only refers to <code>react-native 0.29</code> and onwards: </p>

<p>Theres a module I'm using which requires me to pass the main activity to its constructor. </p>

<p>Up until react-native 29 I used to pass it like so:</p>

<pre><code>@Override
protected List&lt;ReactPackage&gt; getPackages() {
    return Arrays.&lt;ReactPackage&gt;asList(
            new MainReactPackage(),
            new OrientationPackage(this), //&lt;-------
    );
}
</code></pre>

<p>but now this part of the code has to be moved within <code>MainApplication</code> and I no longer know how to access the MainActivity from that part of the code..</p>

<p>This is how my <code>MainApplication.java</code> file looks now:</p>

<pre><code>public class PlaceAVoteApplication extends Application implements ReactApplication{


    private static CallbackManager mCallbackManager = new CallbackManager.Factory().create();

    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
        @Override
        protected boolean getUseDeveloperSupport() {
            return BuildConfig.DEBUG;
        }

        /**
         * A list of packages used by the app. If the app uses additional views
         * or modules besides the default ones, add more packages here.
         */
        @Override
        protected List&lt;ReactPackage&gt; getPackages() {
            return Arrays.&lt;ReactPackage&gt;asList(
                    new MainReactPackage(),
                    new OrientationPackage(this), //&lt;-- Error here because this is not the MainActivity


            );
        }
    };

    @Override
    public ReactNativeHost getReactNativeHost() {
        return mReactNativeHost;
    }
}
</code></pre>

<p>Any suggestions please?</p>