react-native-unimodules icon indicating copy to clipboard operation
react-native-unimodules copied to clipboard

ModuleRegistryAdapter constructor expects param inside PackageList.java

Open sunilloharshoreline1 opened this issue 4 years ago • 0 comments
trafficstars

PackageList.java inside package com.facebook.react (which is auto-generated) has method getPackages() which calls ModuleRegistryAdapter() which expects a parameter. But this file somehow doesn't get generated properly.

public ArrayList<ReactPackage> getPackages() { return new ArrayList<>(Arrays.<ReactPackage>asList( new MainReactPackage(mConfig), new NetInfoPackage(), new ModuleRegistryAdapter(), new RNAWSCognitoPackage(), new RNGestureHandlerPackage(), new MapsPackage(), new ReanimatedPackage(), new SafeAreaContextPackage(), new RNScreensPackage() )); }

I m using React Native version: 0.63.0, "@unimodules/core": "^5.7.0", i.e. 5.3.0 "@unimodules/react-native-adapter": "^5.7.0", i.e. 5.4.0 "react-native-unimodules": "^0.12.0", i.e. 0.12.0

As mentioned here : https://gist.github.com/mczernek/9de9e184abc430e9e3508d26738c8a14/revisions I have made changes in MainApplication.java :

package com.shorelineiot.reactnat; import android.app.Application;

import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.soloader.SoLoader; import com.shorelineiot.reactnat.generated.BasePackageList;

import org.unimodules.adapters.react.ModuleRegistryAdapter; import org.unimodules.adapters.react.ReactModuleRegistryProvider;

import java.util.Arrays; import java.util.List;

public class MainApplication extends Application implements ReactApplication { private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), Arrays.asList());

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

@Override
protected List getPackages() {
  @SuppressWarnings("UnnecessaryLocalVariable")
  List packages = new PackageList(this).getPackages();

// Add unimodules List unimodules = Arrays.asList( new ModuleRegistryAdapter(mModuleRegistryProvider) ); packages.addAll(unimodules); return packages; }

@Override
protected String getJSMainModuleName() {
  return "index";
}

};

@Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; }

@Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); } }

sunilloharshoreline1 avatar Dec 23 '20 04:12 sunilloharshoreline1