Home > Enterprise >  how to patch a node_module file in react native
how to patch a node_module file in react native

Time:10-25

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?

CodePudding user response:

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
  • Related