Fix whitespace in .patch
files
go to package.json
and remove postinstall
from scripts
"postinstall": "patch-package && rm -f ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json",
this is to stop broken patches from being auto applied after yarn
DO NOT commit this change
do a clean yarn
rm -rf node_modules && yarn
or run the full set command here
this step should NOT produce error, if it does, you might have done something wrong in #1
test your .patch
by git apply
git apply patches/rn-collapsing-tab-bar+0.1.4.patch
this should show a bunch of warnings / errors:
patches/rn-collapsing-tab-bar+0.1.4.patch:51: trailing whitespace.
patches/rn-collapsing-tab-bar+0.1.4.patch:115: trailing whitespace.
patches/rn-collapsing-tab-bar+0.1.4.patch:129: trailing whitespace.
patches/rn-collapsing-tab-bar+0.1.4.patch:149: trailing whitespace.
(isExpanded
patches/rn-collapsing-tab-bar+0.1.4.patch:150: trailing whitespace.
? this.collapsableBarHeight/2
error: patch failed: node_modules/rn-collapsing-tab-bar/index.js:179
error: node_modules/rn-collapsing-tab-bar/index.js: patch does not apply
this step is just to let you understand how bad your patch is... :P
ask git apply
to fix whitespace while applying your .patch
git apply --whitespace=fix patches/rn-collapsing-tab-bar+0.1.4.patch
this should apply your patch and fix any bad whitespace(s):
warning: squelched 5 whitespace errors
warning: 8 lines applied after fixing whitespace errors.
generate your .patch
again
yarn patch-package rn-collapsing-tab-bar
revert changes in step #1 and test
rm -rf node_modules && yarn
if this produce no error then the .patch
file should be good
push changes and be done :)