Skip to content

Add Windows support#522

Merged
wonday merged 10 commits into
wonday:masterfrom
JaneaSystems:windows-pr
Dec 8, 2020
Merged

Add Windows support#522
wonday merged 10 commits into
wonday:masterfrom
JaneaSystems:windows-pr

Conversation

@bzoz

@bzoz bzoz commented Dec 2, 2020

Copy link
Copy Markdown
Contributor

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

wonday commented Dec 8, 2020

Copy link
Copy Markdown
Owner

It's great, thank you.

@stmoy stmoy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@jaimecbernardo for FYI

Comment thread README.md
- 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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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.

4 participants