You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to consume changed/forked RN-GH? (Android Package Name Problem) #1250
Hey there,
Following situation: I'm currently reinitialising our react-native-windows app and have to make a few changes to RNGH in order for it (and react-navigation) to work on RN-Windows (see #1081).
So I forked the repository, changed the mentioned files and commited. Then I consume the forked git repository from github and it works fine on Windows.
If I try to build the android app, the gradle build aborts with PackageList.java:15: error: cannot find symbol import com.swmansion.gesturehandler.RNGestureHandlerPackage; because the .react after .gesturehandler is missing in the auto-generated PackageList.
Code
No code needed.
Repro steps:
Fork repository (or directly consume the github repo)
I was able to resolve this by switching back to consuming the official release and adding a postinstall script (as mentioned in #1081).
You can create yourself a script at project root, mine is called webToWindowsRNGH.js:
constfs=require("fs");functioncallback(err){if(err){throwerr;}console.log("Successfull!");}["./node_modules/react-native-gesture-handler/GestureHandlerButton.web.js","./node_modules/react-native-gesture-handler/PlatformConstants.web.js","./node_modules/react-native-gesture-handler/RNGestureHandlerModule.web.js"].forEach((inputPath)=>{constsplits=inputPath.split("./node_modules/react-native-gesture-handler/");constnewFileName=splits[1].replace(".web.js",".windows.js");constoutputPath="./node_modules/react-native-gesture-handler/"+newFileName;console.log(`Trying to copy ${inputPath} to ${outputPath}`);fs.copyFile(inputPath,outputPath,callback);});
After that, adapt the package.json and add the postinstall script: "postinstall": "node ./webToWindowsRNGH"
@jakub-gonet I guess that'd be the appropriate way if I'd also edit the files content, but here I just needed to duplicate the .web.js version with .windows.js as file ending.
Activity
creambyemute commentedon Dec 1, 2020
I was able to resolve this by switching back to consuming the official release and adding a postinstall script (as mentioned in #1081).
You can create yourself a script at project root, mine is called
webToWindowsRNGH.js:After that, adapt the package.json and add the postinstall script:
"postinstall": "node ./webToWindowsRNGH"jgonet commentedon Dec 1, 2020
You can also edit files directly in node_modules and use patch-package to apply those changes after npm / yarn install.
creambyemute commentedon Dec 1, 2020
@jakub-gonet I guess that'd be the appropriate way if I'd also edit the files content, but here I just needed to duplicate the
.web.jsversion with.windows.jsas file ending.