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

feat(windows): Add Windows as a supported platform #103

Merged
merged 3 commits into from
May 26, 2019

Conversation

sbeca
Copy link
Contributor

@sbeca sbeca commented May 23, 2019

Overview

This PR adds Windows as a supported platform.

I started by bringing over the code from the react-native-windows repo and then I implemented the new features that have been added to this repo since it was extracted from the core of React Native.

Test Plan

I tested this PR manually by adding it to the ReactXP Sample Project and combining it with a WIP PR I currently have open at microsoft/reactxp#1092

I have not added any automated tests with this PR because I have struggled to get this repo's automated tests to run on Windows.

README.md Outdated Show resolved Hide resolved
@matt-oakes
Copy link
Collaborator

@sbeca Thanks so much for this. I was looking at the discussion on the ReactXP repo and was going to suggest a PR like this.

I'll take a proper look once I'm done travelling tomorrow. I'll also see why the tests are failing because that seems to be unrelated.

On that note, if you know a good way to test React Native apps on Windows then let me know. It doesn't have to be in this PR, but it would be good to know the options we have.

Thanks again!

Copy link
Collaborator

@matt-oakes matt-oakes left a comment

Choose a reason for hiding this comment

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

Aside from one comment about there ethernet type, this looks good.

You are going to need to add the windows directory to the files array in package.json (here to ensure that the NPM package includes the windows directory.

Don't worry about the failing tests. I think it was just CircleCI having a "moment".

I don't actually have a Windows environment to test on. If someone could confirm that this is working for them, then I'll be happy to release 🎉

{
// If we have a connection that is not a Wifi connection or a Cellular
// connection, then let's fallback and assume it's an Ethernet connection
return NetworkConnectionType.Ethernet;
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are using the other type on Android for when we have an active connection but we don't know what type. Maybe ethernet does make more sense on Windows, but if we could detect that then it would be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've done some more research and come across a more exact way of detecting an Ethernet connection. However, my laptop doesn't have an Ethernet port so I can't fully test it

@sbeca
Copy link
Contributor Author

sbeca commented May 25, 2019

Thanks for the review @matt-oakes, I've just pushed a commit to address the comments.

As Matt can't test this PR, would @mikehardy be able to do so?

@mikehardy
Copy link
Contributor

I have a win10 VM laying around. The network connection on it is a virtual ethernet thing, I can probably give something a whirl. That said, I have done zero react-native-windows work, I'm not even sure where to begin. My base assumption would be "install react-native-windows", then "clone reactxp, carefully pointing it to the branch with the changes / making sure netinfo is pointing to this netinfo branch", right? Not sure if I'll need build tools there or anything, and it may take a day or three, I'm traveling Mon/Tue

@sbeca
Copy link
Contributor Author

sbeca commented May 26, 2019

Getting set up to be able to build React Native apps for Windows can take a little while. I can work on some instructions if need be.

A questions for @matt-oakes though, how much external validation do you want before accepting this PR? I understand that I'm a new contributor to this repo so just accepting anything I write might give you pause. However, if you did merge it as is then I would be happy to be pinged for help with any issues that may arise regarding Windows support.

@matt-oakes
Copy link
Collaborator

@sbeca I'd actually be pretty happy to merge this in as is. The only blocker is the failing tests, but I don't know if that's actually anything to do with this code. I'll take a look at that. Aside from that, this code should not affect any current user at all so I can't see an issue with merging it. I'll keep you in the loop if any bugs come up 👍

@matt-oakes
Copy link
Collaborator

The tests seems to have passed this time (CircleCI must have been having a moment...). I'm going to merge this now and release it as a minor version bump.

If anyone has any issues then please open a new issue 👍

Thanks again to @sbeca for implementing this 🎉

@matt-oakes matt-oakes merged commit cf0fb8f into react-native-netinfo:master May 26, 2019
@sbeca
Copy link
Contributor Author

sbeca commented May 26, 2019

Thank you very much for merging this Matt

@sbeca sbeca deleted the windows-support branch May 26, 2019 04:59
react-native-community-bot pushed a commit that referenced this pull request May 26, 2019
# [3.2.0](v3.1.3...v3.2.0) (2019-05-26)

### Features

* Add Windows support ([#103](#103) by [@sbeca](https://github.com/sbeca)) ([cf0fb8f](cf0fb8f))
@react-native-community-bot
Copy link
Collaborator

🎉 This PR is included in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

4 participants