expo / config-plugins

Out-of-tree Expo config plugins for packages that haven't adopted the config plugin system yet.
445 stars 95 forks source link

WIP :construction: (react-native-batch) create the expo plugin for Batch #26

Closed Spoutnik97 closed 2 years ago

Spoutnik97 commented 2 years ago

Hi @EvanBacon ! I saw you develop lots of plugins, so maybe you could help me to finish this one please ? I posted my problem : https://forums.expo.dev/t/custom-plugin-for-react-native-batch-needs-google-services-json/59627

EvanBacon commented 2 years ago

This repo is for out-of-tree plugins with the intention of eventually getting them upstreamed. Upstreaming plugins can be tricky and much larger packages, but it looks like react-native-batch and react-native-batch-push both have one weekly download, it might be better to publish this plugin directly inside the upstream package/repo.

Spoutnik97 commented 2 years ago

Thank you @EvanBacon for your proofreading. Indeed, I had not finished my PR. Now it works well! I followed your advice to create a new pull request on the Batch repository.

I have a last question : currently I have to create a react-ntaive.config.js file at the root of my project to add the following lines:

  "react-native-batch": {
      platforms: {
        android: {
          packageInstance: "new RNBatchPackage(this.getApplication())",
        },
      },
    },

How do you implement this in the plugin ? Do I have to create a new mod for the MainApplication and insert packages.add(new RNBatchPackage(this.getApplication())) into

 @Override
    protected List<ReactPackage> getPackages() {
      List<ReactPackage> packages = new PackageList(this).getPackages();
      packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
      return packages;
    }

Do you see a better way to add this package ?

EvanBacon commented 2 years ago

@Spoutnik97 modifying the react-native.config.js should not be done inside of a config plugin. Config plugins should be used for files inside of the ios and android folders. Instead you should document that modifying the RNConfig is an extra step required for setup.

EvanBacon commented 2 years ago

I followed your advice to create a new pull request on the Batch repository.

Closing as this PR appears to have moved.