Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
546 views
in Technique[技术] by (71.8m points)

react-native 依赖库是什么时候添加到 PackageList 里的?

// MainApplication.java
@Override
protected List<ReactPackage> getPackages() {
  @SuppressWarnings("UnnecessaryLocalVariable")
  List<ReactPackage> packages = new PackageList(this).getPackages();
// package com.facebook.react;  PackageList
  public ArrayList<ReactPackage> getPackages() {
    return new ArrayList<>(Arrays.<ReactPackage>asList(
      new MainReactPackage(mConfig),
      new AsyncStoragePackage(),
      new CameraRollPackage(),

请问比如这里的 AsyncStoragePackage 是什么时候被添加到 com.facebook.react.PackageList 里的?

我该如何让他不出现在com.facebook.react.PackageList里,因为我要在 getPackages 里手动添加包


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

如果你的项目 RN 版本大于 0.60,可以在项目根目录下创建文件 react-native.config.js, 然后禁止 async-storage autolink:

module.exports = {
  dependencies: {
    '@react-native-community/async-storage': {
      platforms: {
        android: null, // disable Android platform, other platforms will still autolink if provided
      },
    },
  },
};

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...