drawer navigation 에러 해결

'리액트 네이티브를 다루는 기술' 책을 읽고 실습하면서 drawer navigation 라이브러리를 설치 후 에러를 만났습니다. 

 

에러 내용

Error: Failed to create a worklet. Did you forget to add Reanimated Babel plugin in babel.config.js? See installation docs at 
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation#babel-plugin
., js engine: hermes

에러 원인

  • react-native-reanimated 라이브러리의 Babel 플러그인을 설정하지 않았기 때문에 발생하였습니다.

에러 해결 방법

  1. babel.config.js에서 babel 플러그인 추가
// babel.config.js
module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: ['react-native-reanimated/plugin'],
};
  1. yarn cache 삭제
$ yarn cache clean

 


참고 사이트
https://reactnavigation.org/docs/drawer-navigator/
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/
https://stackoverflow.com/questions/67130651/reanimated-2-failed-to-create-a-worklet-m
https://stackoverflow.com/questions/46878638/how-to-clear-react-native-cacheaybe-you-forgot-to-add-reanimateds-ba

댓글