[React Native - android] boolean com.swmansion.reanimated.layout...

[React Native - android] boolean com.swmansion.reanimated.layout...

* React Navigation - Drawer Navigation 설치 시 오류

yarn add @react-navigation/drawer yarn add react-native-gesture-handler react-native-reanimated

* Reference : https://reactnavigation.org/docs/drawer-navigator/

# pakage.json

... "dependencies": { "@react-navigation/drawer": "^6.1.8", "react-native-gesture-handler": "^2.1.0", "react-native-reanimated": "^2.3.1", ... } ...

* Drawer Navigation 사용을 위해 가이드 처럼 설치하고 나면 아래와 같은 오류가 발생한다.

* Error message

Attempt to invoke interface method 'boolean com.swmansion.reanimated.layout animation.nativemethodsholder.isLayoutAnimationEnabled()' on a null object reference

android

* 해결 방안

# android > app > build.gradle

project.ext.react = [ enableHermes: true // <- here | clean and rebuild if changing ]

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

import com.facebook.react.bridge.JSIModulePackage; // <- add import com.swmansion.reanimated.ReanimatedJSIModulePackage; // <- add ... private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { ... @Override protected String getJSMainModuleName() { return "index"; } @Override protected JSIModulePackage getJSIModulePackage() { return new ReanimatedJSIModulePackage(); // <- add } }; ...

* Reference : https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/#android

반응형

from http://bocoder.tistory.com/66 by ccl(A) rewrite - 2021-12-28 20:00:52