始终违规:requireNativeComponent:在UIManager中找不到“ ISvgImage”

时间:2019-10-10 17:36:06

标签: react-native

  

不变违规:requireNativeComponent:未找到“ ISvgImage”   在UIManager中

enter image description here

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

我通过以下方式解决了与RNCViewPager相关的类似问题(在UIManager中未找到RNCViewPager):

我在settings.gradle

中添加了以下内容
include ':@react-native-community_viewpager'
project(':@react-native-community_viewpager').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/viewpager/android')

然后我将以下内容添加到app/build.gradle

implementation project(':@react-native-community_viewpager')

然后我用导入更新了Android Application class

import com.reactnativecommunity.viewpager.RNCViewPagerPackage;

,然后将其添加到RN软件包列表中:

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

        @Override
        protected List<ReactPackage> getPackages() {
            return Arrays.asList(
                    new MainReactPackage(),
                    new MapsPackage(),
                    new Interactable(),
                    new LocationServicesPackage(),
                    new AnalyticsPackage(),
                    new ConfigPackage(),
                    new BlurViewPackage(),
                    new RNI18nPackage(),
                    new NavigationPackage(),
                    new RemoteConfigPackage(),
                    new LottiePackage(),
                    new ReanimatedPackage(),
                    new GeolocationPackage(),
                    new NetInfoPackage(),
                    new RNCViewPagerPackage()
            );
        }
    };

完整的堆栈跟踪和详细信息在这里:

https://github.com/facebook/react-native/issues/27557