Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows support #522

Merged
merged 10 commits into from Dec 8, 2020
Merged

Add Windows support #522

merged 10 commits into from Dec 8, 2020

Conversation

bzoz
Copy link
Contributor

@bzoz bzoz commented Dec 2, 2020

Adds basic Windows implementation for the module, with some limitations:

  • As rn-fetch-blob does not yet support Windows (a Windows PR was open recently), source support is limited to only PDFs bundled with the app - using ms-appx:// URI prefix, or from the filesystem using file:// prefix.
  • No tests are provided.
  • Not all props are supported: all affecting rn-fetch-blob and style, enablePaging and onPageSingleTap
  • No tableContents in onLoadComplete
  • the PDF is rendered to images: it is not possible to copy text from it, nor clicking links
  • moving the viewport with keyboard only works, when the control was activated using the tab key

The example app was updated to RN 0.63 and works on Windows:
image

Edit:

  • added enablePaging support
  • added onPageSingleTap support
  • added style support

@wonday wonday merged commit a75a6ee into wonday:master Dec 8, 2020
@wonday
Copy link
Owner

wonday commented Dec 8, 2020

It's great, thank you.

Copy link

@stmoy stmoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaimecbernardo for FYI

- Open your solution in Visual Studio 2019 (eg. `windows\yourapp.sln`)
- Right-click Solution icon in Solution Explorer > Add > Existing Project...
- Add `node_modules\@react-native-community\progress-view\windows\progress-view\progress-view.vcxproj`
- If running RNW 0.62: add `node_modules\react-native-pdf\windows\RCTPdf\RCTPdf.vcxproj`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bzoz @jaimecbernardo - Why is this a 0.62 note? It looks like this is required even in 0.63?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This action isn't needed for RNW 0.63 for RCTPdf, since auto-linking does it.
Adding the #include "winrt/RCTPdf.h" line is still needed, though, due to the existing XAML component or there'll be an error on XamlTypeInfo.g.cpp.

Manual linking is still needed for the @react-native-community/progress-view module though.

#include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h>

#include "winrt/RCTPdf.h"
#include "winrt/progress_view.h"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is different from the docs, which specify "progress-view" instead of "progress_view"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the heads-up. Will submit a PR to fix this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's PR open already: #532

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants