patch-package icon indicating copy to clipboard operation
patch-package copied to clipboard

Failed to apply patch for package react-native at path node_modules/react-native

Open yding-aptos-com opened this issue 1 year ago • 1 comments

The "Use of bitwise '|' with boolean operands" error is fixed in React Native 0.69+. But we are currently using react-native 0.63.5, we have to apply the following patch to fix the issue in node_modules when buiding circle-CI:

react-native+0.63.5.patch:

@@ -24,6 +24,28 @@ index c17c76d..9d5aaaf 100644 } } } diff --git a/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp b/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp index d916a45..1c7207a 100644 --- a/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp +++ b/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp @@ -2282,7 +2282,7 @@ static float YGDistributeFreeSpaceSecondPass( depth, generationCount); node->setLayoutHadOverflow(

  •    node->getLayout().hadOverflow() |
    
  •    node->getLayout().hadOverflow() ||
       currentRelativeChild->getLayout().hadOverflow());
    

    } return deltaFreeSpace; @@ -3043,7 +3043,7 @@ static void YGNodelayoutImpl( }

    node->setLayoutHadOverflow(

  •    node->getLayout().hadOverflow() |
    
  •    node->getLayout().hadOverflow() ||
       (collectedFlexItemsValues.remainingFreeSpace < 0));
    
    // STEP 6: MAIN-AXIS JUSTIFICATION & CROSS-AXIS SIZE DETERMINATION diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env new file mode 100644 index 0000000..361f5fb

=======================

But when this patch is being applied in circle-CI build, I kept getting the following error:

ERROR Failed to apply patch for package react-native at path

node_modules/react-native

This error was caused because patch-package cannot apply the following patch file:

patches/react-native+0.63.5.patch

Try removing node_modules and trying again. If that doesn't work, maybe there was an accidental change made to the patch file? Try recreating it by manually editing the appropriate files and running:

patch-package react-native

If that doesn't work, then it's a bug in patch-package, so please submit a bug report. Thanks!

https://github.com/ds300/patch-package/issues

yding-aptos-com avatar May 08 '24 23:05 yding-aptos-com

I am facing fame issue in react-native-0.73.8 for replacing this line in "react-native/third-party-podspecs/boost.podspec" file

spec.source = { :http => 'https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2', :sha256 => 'f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41' }

but in react native 0.68.2 i have same patch and it's woking.

diff --git a/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp b/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp index 9986279..20389d4 100644 --- a/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp +++ b/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp @@ -2229,7 +2229,7 @@ static float YGDistributeFreeSpaceSecondPass( depth, generationCount); node->setLayoutHadOverflow(

  •    node->getLayout().hadOverflow() |
    
  •    node->getLayout().hadOverflow() ||
       currentRelativeChild->getLayout().hadOverflow());
    
    } return deltaFreeSpace; diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env new file mode 100644 index 0000000..361f5fb --- /dev/null +++ b/node_modules/react-native/scripts/.packager.env @@ -0,0 +1 @@ +export RCT_METRO_PORT=8081

TheScalion avatar May 29 '24 07:05 TheScalion