Open blaemmle opened 2 years ago
Same occured to me with versions react-native: 0.70.0-rc.4 react-native-windows: 0.70.0-preview.2 react-native-pdf: 6.6.2 react-native-blob-util: 0.16.2
Firstly make sure that the NuGet package Microsoft.UI.Xaml version 2.7.1 is installed and referenced by the project RCTPdf via Visual Studio Solution Explorer. Version 2.8 is apparently too fresh.
Insert to yourProject\windows\yourProject\App.cpp
PackageProviders().Append(winrt::RCTPdf::ReactPackageProvider());
PackageProviders().Append(winrt::ReactNativeBlobUtil::ReactPackageProvider());
before
InitializeComponent();
Append to yourProject\windows\yourProject\pch.h
#include <winrt/RCTPdf.h>
#include <winrt/ReactNativeBlobUtil.h>
Append to yourProject\node_modules\react-native-pdf\windows\RCTPdf\pch.h
#include <winrt/Microsoft.UI.Xaml.Controls.h>
#include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h>
Clean solution and start the build :)
@stefan-helmhagen Thanks that helped! Editing files in node_modules is not a good practice because it will be overwritten. Thats why I opened a PR to get this into the Library.
Can you confirm that my PR #684 fixes the Issue for you as well?
Of course you can create a react-native.config.js and specify includes in a cppHeaders property. I suppose, the max you can do is nesting header files.
Anyway, in my experience it is inevitable to patch a package a node_modules sooner or later due to bugs in the compiler chain.
Same occured to me with versions react-native: 0.70.0-rc.4 react-native-windows: 0.70.0-preview.2 react-native-pdf: 6.6.2 react-native-blob-util: 0.16.2
Firstly make sure that the NuGet package Microsoft.UI.Xaml version 2.7.1 is installed and referenced by the project RCTPdf via Visual Studio Solution Explorer. Version 2.8 is apparently too fresh.
Insert to yourProject\windows\yourProject\App.cpp
PackageProviders().Append(winrt::RCTPdf::ReactPackageProvider()); PackageProviders().Append(winrt::ReactNativeBlobUtil::ReactPackageProvider());
before
InitializeComponent();
Append to yourProject\windows\yourProject\pch.h
#include <winrt/RCTPdf.h> #include <winrt/ReactNativeBlobUtil.h>
Append to yourProject\node_modules\react-native-pdf\windows\RCTPdf\pch.h
#include <winrt/Microsoft.UI.Xaml.Controls.h> #include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h>
Clean solution and start the build :)
It works for me. Thank you Used Visual Studio 2022 react-native: 0.70.3 react-native-windows: 0.70.3 react-native-pdf: 6.6.2
After made changes in package, I also made a rebuild RCTPdf project.
What
react-native
version are you using? 0.68.2What
react-native-pdf
version are you using? 6.6.2What platform does your issue occur on? (android/ios/both) Windows
Describe your issue as precisely as possible : Windows build is failing with the following error. Downgrading to 6.5.0 didnt helped. The Package is also auto linked during first install try.
C:\Development\Repos\application\node_modules\react-native-pdf\windows\RCTPdf\Generated Files\XamlTypeInfo.g.cpp(221,39): error C2039: 'UI': is not a member of 'winrt::Microsoft' [C:\Development\Repos\application\node_modules\react-native-pdf\windows\RCTPdf\RCTPdf.vcxproj]. Check your build configuration.
Hello, I hope that I just missed a detail while setting up the package in Windows. Let me know if you need further details! Thanks in advance!