CommonReactNativeActivity.java 1.18 KB
package com.drp.util.react;

import android.os.Bundle;


import com.drp.mobliemall.app.GlobalContext;
import com.drp.util.react.preloadreact.PreLoadReactActivity;

import javax.annotation.Nullable;

/**
 * Created on 2017-08-22.
 *
 * @author 吕浩
 * @since 1.0.0
 */
public class CommonReactNativeActivity extends PreLoadReactActivity {
    /**
     * RN模块名称
     */
    public String componentName;

    /**
     * RN模块版本号
     */
    public String version;

    /**
     * JSBundle路径
     */
    public String path;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        GlobalContext.getInstance().setActivity(this);
        this.componentName = getIntent().getStringExtra("componentName");
        this.path = getIntent().getStringExtra("path");
        this.version = getIntent().getStringExtra("version");
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    protected String getMainComponentName() {
        return componentName;
    }

    @Override
    protected String getJSBundleFile() {
        return path;
    }

    @Nullable
    @Override
    protected String getJSBundleVersion() {
        return version;
    }
}