React Native/React Native_error

[React Native - ios/android] ERROR Invariant Violation: requireNativeComponent: "ARTShape" was not found in the UIManager.

bocoder
728x90
반응형

* react-native 0.61.5 버전에서는 바코드 생성이 잘 되었는데, 0.64.2 로 업그레이드 후 에러가 발생함

 

 

바코드 생성을 위해 [react-native-barcode-builder] 모듈을 사용하고 있었는데,

버전이 업그레이드 되면서 autolinking 이 되지 않는 이슈라고 함

 

1. iOS 에서는 Podfile의 아래 부분을 수정해준다.

# ios > Podfile

# before
pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART'

# after
pod 'ReactNativeART', :path => '../node_modules/@react-native-community/art'

* reference : https://github.com/react-native-art/art/issues/54

 

2. android 에서는 아래 코드들을 추가함

 

# android > settings.gradle

include ':react-native-art'
project(':react-native-art').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/art/android')

 

# android > app > build.gradle

dependencies {
   ...
   implementation project(':react-native-art')
}

# android > app > src > main > ... > MainApplication.java

import com.reactnativecommunity.art.ARTPackage;

...

    @Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      
      ...
      
      packages.add(new ARTPackage());
      
      ...
      
      return packages;
    }

* reference : https://www.npmjs.com/package/@react-native-community/art

728x90
반응형