Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to patch a node_module file in react native

Tags:

react-native

I trying to upgrade to react native 0.70, but I'm getting some issues with some libraries, so I need to modify some source codes. for example: In this file node_modules/react-native-webengage/react-native-webengage.podspec changing

  s.source_files   = 'ios/*.{h,m}'

  s.dependency 'WebEngage'
  s.dependency 'React-Core'
end

to

  s.source_files   = 'ios/*.{h,m}'

  s.dependency 'WebEngage/XCFramework'
  s.dependency 'React-Core'
end

what is the best approach to do it without replacing the files?

like image 288
MShokry Avatar asked Sep 08 '25 16:09

MShokry


1 Answers

Patch package works perfectly with React Native https://github.com/ds300/patch-package

  1. Follow instructions for patch-package from site above
  2. Change the files you need (even from the native side)
  3. Run yarn patch-package react-native-webengage
  4. Add a patch to your git
like image 149
Kirill Novikov Avatar answered Sep 10 '25 06:09

Kirill Novikov