react-native-gesture-handler icon indicating copy to clipboard operation
react-native-gesture-handler copied to clipboard

Add initial Windows implementation.

Open tritao opened this issue 4 years ago • 13 comments

Description

Adds initial support for react-native-windows.

The more advanced customization options for each gesture recognizer were not implemented as part of this initial pass.

They will be implemented later as needed.

Also this implementation is being done on behalf of Microsoft.

For context: https://github.com/microsoft/react-native-windows/issues/4140

Test plan

Testing was done manually via the UWP simulator.

I've attached some screen recordings of the gestures working under the emulator.

These test examples will be added to react-native-gallery too.

Examples

38TEa542N6 D1tfLaonUp fNtRBlb0Ou TpTQSPJjcj wTYVNqT2qY

tritao avatar Mar 18 '21 14:03 tritao

I partially reviewed it but I have limited knowledge about C++ and RN bindings for it.

Thanks for the review, I have addressed your feedback and also fixed some other issues with the fling gesture as well as some edge cases in the end states for some gestures.

Let me know if there is anything else and I'll be glad to fix it.

  1. Why do we have 2 files like RNGestureHandler62.sln, RNGestureHandler63.sln? I'm not familiar with VS, it was autogenerated with two RN versions?

It needs different solutions depending on which react-native-windows version we are using. It's my understanding that the newer versions provide extra MSBuild files which we include for the automatic build setup. These are part of the template we have been using for bootstrapping these modules.

tritao avatar Mar 22 '21 12:03 tritao

Last push was to address a Yarn vs NPM issue on the lock file, should be good to go.

tritao avatar Mar 22 '21 18:03 tritao

Just realized I had missed some comments due to them being hidden by GitHub by default, pushed a fix.

tritao avatar Mar 23 '21 15:03 tritao

I see, it'd be nice to have this automated since I assume this only can be done from a Windows machine.

The solution files should never need to be modified going forward so I don't think this is a big concern. Alternatively, I can just remove the one for 0.62, and we can just leave the one for 0.63+ going forward.

One request from me: could you please avoid force pushing? We already use squash & merge and filtering by new commits is really helpful.

Sure.

tritao avatar Mar 23 '21 18:03 tritao

Update: We want to merge it but I need to test it on my local machine before that. I'm planning to do that in the next week.

jgonet avatar Apr 01 '21 11:04 jgonet

Hi, sorry for the delay. I was unable to run rngallery project so I'm not able to check if your PR is working. Would you mind adding windows specific files and quick instruction to the Example README about generating those files? Also, I think README from windows/ directory should be moved directly into documentation, maybe on the installation page.

Below is a list of compile errors from rngallery, maybe you know why those happen? (I was building via Build > Build rngallery)

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2220	the following warning is treated as an error (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\cxxreact\Instance.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\cxxreact\Instance.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\cxxreact\CxxNativeModule.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\cxxreact\CxxNativeModule.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\cxxreact\NativeToJsBridge.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\cxxreact\NativeToJsBridge.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	MSB4181	The "CompileXaml" task returned false but did not log an error.	ReactCommon	C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets	482	
Error	C2220	the following warning is treated as an error (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\Shared\InstanceManager.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\Shared\InstanceManager.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\Shared\Modules\NetworkingModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\Shared\Modules\NetworkingModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\Shared\Modules\WebSocketModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\Shared\Modules\WebSocketModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\Shared\OInstance.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\Shared\OInstance.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file Modules\Animated\NativeAnimatedModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file Modules\Animated\NativeAnimatedModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file Modules\LinkingManagerModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file Modules\LinkingManagerModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file Modules\LogBoxModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file Modules\LogBoxModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file Modules\TimingModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file Modules\TimingModule.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file Modules\WebSocketModuleUwp.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file Modules\WebSocketModuleUwp.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file ReactHost\ReactContext.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file ReactHost\ReactContext.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	C2220	the following warning is treated as an error (compiling source file ReactHost\ReactInstanceWin.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Warning	C4834	discarding return value of function with 'nodiscard' attribute (compiling source file ReactHost\ReactInstanceWin.cpp)	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native\ReactCommon\runtimeexecutor\ReactCommon\RuntimeExecutor.h	42	
Error	MSB4181	The "CompileXaml" task returned false but did not log an error.	Microsoft.ReactNative	C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets	482	
Error	MSB3030	Could not copy the file "C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\build\ARM\Debug\Microsoft.ReactNative\Generated Files\DevMenuControl.xbf" because it was not found.	RNDeviceInfoCPP	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WindowsXaml\v16.0\8.21\Microsoft.Windows.UI.Xaml.Common.targets	131	
Warning	MSB3088	Could not read state file "ARM\Debug\DateTimePickerWindows.vcxprojAssemblyReference.cache". Attempting to deserialize an empty stream.	DateTimePickerWindows	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets	2182	
Error	MSB3030	Could not copy the file "C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\build\ARM\Debug\Microsoft.ReactNative\Generated Files\DevMenuControl.xbf" because it was not found.	SliderWindows	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WindowsXaml\v16.0\8.21\Microsoft.Windows.UI.Xaml.Common.targets	131	
Error	MSB3030	Could not copy the file "C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\build\ARM\Debug\Microsoft.ReactNative\Generated Files\DevMenuControl.xbf" because it was not found.	DateTimePickerWindows	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WindowsXaml\v16.0\8.21\Microsoft.Windows.UI.Xaml.Common.targets	131	
Error	MSB3030	Could not copy the file "C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\build\ARM\Debug\Microsoft.ReactNative\Generated Files\DevMenuControl.xbf" because it was not found.	Clipboard	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WindowsXaml\v16.0\8.21\Microsoft.Windows.UI.Xaml.Common.targets	131	
Error	MSB3030	Could not copy the file "C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\build\ARM\Debug\Microsoft.ReactNative\Generated Files\DevMenuControl.xbf" because it was not found.	CheckboxWindows	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WindowsXaml\v16.0\8.21\Microsoft.Windows.UI.Xaml.Common.targets	131	
Error	MSB3030	Could not copy the file "C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\build\ARM\Debug\Microsoft.ReactNative\Generated Files\DevMenuControl.xbf" because it was not found.	ReactNativePicker	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WindowsXaml\v16.0\8.21\Microsoft.Windows.UI.Xaml.Common.targets	131	
Error	C1070	mismatched #if/#endif pair in file 'C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\@terrylinla\react-native-sketch-canvas\windows\RNSketchCanvas\Generated Files\winrt\impl\Windows.UI.Xaml.Controls.2.h'	RNSketchCanvas	C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\@terrylinla\react-native-sketch-canvas\windows\RNSketchCanvas\Generated Files\winrt\impl\Windows.UI.Xaml.Controls.2.h	59	
Error	MSB4181	The "CompileXaml" task returned false but did not log an error.	RNSketchCanvas	C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets	482	
Error	MSB3030	Could not copy the file "C:\Users\jgonet\Documents\Projects\react-native-gallery\node_modules\react-native-windows\build\ARM\Debug\Microsoft.ReactNative\Generated Files\DevMenuControl.xbf" because it was not found.	RNCConfig	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WindowsXaml\v16.0\8.21\Microsoft.Windows.UI.Xaml.Common.targets	131	
Error	MIDL2011	[msg]unresolved type declaration [context]: Windows.UI.Xaml.Controls.Page [ RuntimeClass 'rngallery.MainPage'  ]	rngallery	C:\Users\jgonet\Documents\Projects\react-native-gallery\windows\rngallery\MainPage.idl	5	

jgonet avatar Apr 20 '21 16:04 jgonet

I am not sure about those errors, but it seems like it is related to RNSketchCanvas. I also noticed you are compiling for ARM based on the output paths, that could be the issue.

Would you mind adding windows specific files and quick instruction to the Example README about generating those files?

Could you elaborate on this? I am not sure which files you refer to.

By the way, for testing the PR, you need to launch the gallery example inside the UWP Simulator. You can switch to it as a device target in VS.

tritao avatar Apr 22 '21 10:04 tritao

@jakub-gonet I can try to help you get past the build errors with gallery. A couple of things to check....

  • After you cloned the repo, did you run yarn at the root of the repo?
  • When you open rngallery.sln in VS are you able to see the other projects loaded such as Microsoft.ReactNative or CheckboxWindows in addition to the rngallery project?
  • Make sure you are building x86 or x64 as RNW no longer support ARM

chiaramooney avatar Jul 01 '21 21:07 chiaramooney

I'm having some difficulty testing this on my local windows machine. I'm testing it through the example page in RNGallery - the solution is building fine and the examples are rendering as expected, however they don't seem to respond to touch interaction at all. I tried testing both on local machine and through the Simulator with no luck.

@tritao Any ideas as to what might be going on? Were you able to get this working in RNGallery?

agniuks avatar Jul 01 '21 21:07 agniuks

Did you change the touch interaction modes in the Simulator side toolbar?

It's expected that it won't do anything on local machine with mouse pointing device.

You need to use the Simulator and select appropriate tool for each different gesture handler, see which ones I used for each on the screenshots.

tritao avatar Jul 02 '21 08:07 tritao

Did you change the touch interaction modes in the Simulator side toolbar?

It's expected that it won't do anything on local machine with mouse pointing device.

You need to use the Simulator and select appropriate tool for each different gesture handler, see which ones I used for each on the screenshots.

@tritao I did and still nothing. Also tried on my local machine that has a touch screen but that didn't seem to work either.

agniuks avatar Jul 02 '21 21:07 agniuks

I spent more time checking this and couldn't get it to work.

Errors I'm getting in VS:

  1. "One or more projects in the solution were not loaded correctly. Please see the Output Window for details."
  2. Ouput window:
      C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Common\Common.vcxproj : error  : The project file could not be loaded. Could not find a part of the path 'C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Common\Common.vcxproj'.  C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Common\Common.vcxproj
    
    
      C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Folly\Folly.vcxproj : error  : The project file could not be loaded. Could not find a part of the path 'C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Folly\Folly.vcxproj'.  C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Folly\Folly.vcxproj
    
    
      C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\JSI\Universal\JSI.Universal.vcxproj : error  : The project file could not be loaded. Could not find a part of the path 'C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\JSI\Universal\JSI.Universal.vcxproj'.  C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\JSI\Universal\JSI.Universal.vcxproj
    
    
      C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems : error  : Project "C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems" could not be found.
    
      C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Chakra\Chakra.vcxitems : error  : Project "C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Chakra\Chakra.vcxitems" could not be found.
    
      C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj : error  : The project file could not be loaded. Could not find a part of the path 'C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj'.  C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj
    
    
      C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Mso\Mso.vcxitems : error  : Project "C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Mso\Mso.vcxitems" could not be found.
    
      C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\ReactCommon\ReactCommon.vcxproj : error  : The project file could not be loaded. Could not find a part of the path 'C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\ReactCommon\ReactCommon.vcxproj'.  C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\ReactCommon\ReactCommon.vcxproj
    
    
      C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems : error  : Project "C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems" could not be found.
    
      C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Shared\Shared.vcxitems : error  : Project "C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Shared\Shared.vcxitems" could not be found.
    
    C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-	windows\include\Include.vcxitems : error  : Project "C:\Users\jgonet\Documents\Projects\react-native-	gesture-handler\windows\node_modules\react-native-windows\include\Include.vcxitems" could not be found.
    

Things I tried:

  1. Reinstalling dependencies needed by RNW:
    $ iex (New-Object System.Net.WebClient).DownloadString('https://aka.ms/rnw-deps.ps1')
    Cannot use file stream for [C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.5\Microsoft.NETCore.App.deps.json]: Invalid argument
    A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.5'.
    Checking Free space on C: > 15 GB                 Failed (warn)
    Checking Installed memory >= 16 GB                Failed (warn)
    Checking Windows version > 10.0.16299.0                      OK
    Checking Developer mode is on                                OK
    Checking Long path support is enabled                        OK
    Checking Choco                                               OK
    Checking git                                                 OK
    Checking Compilers, build tools, SDKs and Visual Studio      OK
    Checking NodeJS lts installed                                OK
    Checking Chrome                                              OK
    Checking Yarn                                                OK
    Checking .net core 3.1                                       OK
    All mandatory requirements met
    
  2. yarn add -D [email protected] in the windows/ directory (README in windows/ directory is a bit unclear where this command should be run. Note that RNW wasn't installed there.
  3. Errors are from missing windows/node_modules/react-native-windows/ dir so I copied it there and got a little bit further with errors below. I think this may be related to RN being in node_modules in the root of the repo and not in windows/node_modules, but I didn't investigate that further.
    Severity	Code	Description	Project	File	Line	Suppression State
    Error	MSB4181	The "CompileXaml" task returned false but did not log an error.	RNGestureHandler	C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets	482	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\cxxreact\CxxNativeModule.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\cxxreact\JSBundleType.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\cxxreact\Instance.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\cxxreact\JSExecutor.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\cxxreact\JSIndexedRAMBundle.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\cxxreact\ModuleRegistry.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\cxxreact\NativeToJsBridge.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\cxxreact\RAMBundleRegistry.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\jsi\jsi\JSIDynamic.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\jsiexecutor\jsireact\JSIExecutor.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\jsiexecutor\jsireact\JSINativeModules.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\turbomodule\core\TurboCxxModule.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\turbomodule\core\TurboModuleUtils.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	C1083	Cannot open include file: 'folly/portability/Config.h': No such file or directory (compiling source file C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\build\x64\Debug\ReactCommon\react-native-patched\ReactCommon\turbomodule\samples\SampleTurboCxxModule.cpp)	ReactCommon	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\node_modules\.folly\folly-2020.09.14.00\folly\CPortability.h	22	
    Error	MSB4181	The "CompileXaml" task returned false but did not log an error.	ReactCommon	C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets	482	
    Error	LNK1104	cannot open file 'C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\target\x64\Debug\ReactCommon\ReactCommon.lib'	Microsoft.ReactNative	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\node_modules\react-native-windows\Microsoft.ReactNative\LINK	1	
    Error	C2065	'handlerKind': undeclared identifier	RNGestureHandler	C:\Users\jgonet\Documents\Projects\react-native-gesture-handler\windows\RNGestureHandler\RNGestureHandler\RNGestureHandlerModule.cpp	76	
    

  1. If RNW doesn't support the ARM arch, please remove it from solutions.
  2. I don't think we need RN@62 solution so feel free to remove it.
  3. Windows should be runnable from examples/Example directory so we can test it on existing examples. How we can achieve that?
  4. Installation instructions should be updated since it's not that straightforward to set up and run Windows examples.
  5. We shouldn't need to test it by running against Gallery app.

jgonet avatar Aug 11 '21 11:08 jgonet

Facing similar issues. One thing I had to do was change:

<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>

To:

<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(SolutionDir), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>

This is a patch that we've had to do on quite a few Microsoft react-native-windows library implementations. Wondering if there is a reason you are using MSBuildThisFileDirectory over SolutionDir.

After fixing that, the error is now:

node_modules\react-native-gesture-handler\windows\RNGestureHandler\RNGestureHandler\RNGestureHandlerModule.cpp(76,21): error C2065: 'handlerKind': undeclared identifier

jeanmaried avatar May 24 '22 20:05 jeanmaried