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 #138

Merged
merged 21 commits into from
May 22, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ A toolbox for your React Native app localization.
<br>
[![Platform - Android](https://img.shields.io/badge/platform-Android-3ddc84.svg?style=flat&logo=android)](https://www.android.com)
[![Platform - iOS](https://img.shields.io/badge/platform-iOS-000.svg?style=flat&logo=apple)](https://developer.apple.com/ios)
[![Platform - Windows](https://img.shields.io/badge/platform-Windows-0067b8.svg?style=flat&logo=windows)](https://www.microsoft.com/en-us/windows)
namrog84 marked this conversation as resolved.
Show resolved Hide resolved
[![Platform - Web](https://img.shields.io/badge/platform-Web-1977f2.svg?style=flat&logo=html5&logoColor=fff)](https://developer.mozilla.org)

<img width="400" height="auto" center src="https://github.com/zoontek/react-native-localize/blob/master/docs/screenshot.png?raw=true" />
Expand Down Expand Up @@ -91,6 +92,12 @@ public class MainApplication extends Application implements ReactApplication {
}
```

### Windows Support

Because this RNW package targets React Native 0.63.0+, you probably won't need to link it manually. Otherwise if it's not the case, follow these additional instructions. You also need to manual link the module on Windows when using React Native Windows prior to 0.63:
namrog84 marked this conversation as resolved.
Show resolved Hide resolved

For more information about autolinking and manual linking. Follow the [official guide](https://microsoft.github.io/react-native-windows/docs/native-modules-autolinking)

</details>

## Web support
Expand Down
17 changes: 17 additions & 0 deletions android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
namrog84 marked this conversation as resolved.
Show resolved Hide resolved
<projectDescription>
<name>android</name>
<comment>Project android created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
17 changes: 17 additions & 0 deletions example/android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>RNLocalizeExample</name>
<comment>Project android_ created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
23 changes: 23 additions & 0 deletions example/android/app/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app</name>
<comment>Project app created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions example/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@

const path = require('path');
const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
resolver: {
blacklistRE: blacklist([
// This stops "react-native run-windows" from causing the metro server to crash if its already running
new RegExp(
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
),
// This prevents "react-native run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip
/.*\.ProjectImports\.zip/,
]),
},
transformer: {
getTransformOptions: async () => ({
transform: {
Expand Down
6 changes: 4 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "0.0.1",
"private": true,
"scripts": {
"clean-modules": "rm -rf ./node_modules/react-native-localize/{example,node_modules}",
"clean": "rm -rf ./node_modules ./ios/Pods",
"clean-modules": "rimraf ./node_modules/react-native-localize/{example,node_modules}",
"clean": "rimraf ./node_modules ./ios/Pods",
"postinstall": "yarn clean-modules && yarn pod-update",
"pod-update": "cd ./ios && pod update && cd ..",
"start-metro": "react-native start",
Expand All @@ -18,6 +18,7 @@
"react-dom": "16.13.1",
"react-native": "0.63.3",
"react-native-fs": "2.16.6",
"react-native-windows": "0.63.26",
"react-native-localize": "file:../",
"react-native-web": "0.14.8"
},
Expand All @@ -26,6 +27,7 @@
"@babel/runtime": "^7.12.5",
"babel-loader": "^8.2.1",
"metro-react-native-babel-preset": "^0.59.0",
"rimraf": "^3.0.2",
namrog84 marked this conversation as resolved.
Show resolved Hide resolved
"webpack": "^5.4.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0"
Expand Down
2 changes: 2 additions & 0 deletions example/src/AsyncExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ const styles = StyleSheet.create({
textDecorationLine: "underline",
fontWeight: "500",
marginBottom: 8,
color: "black",
},
value: {
textAlign: "left",
color: "black",
namrog84 marked this conversation as resolved.
Show resolved Hide resolved
},
});
2 changes: 2 additions & 0 deletions example/src/SyncExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ const styles = StyleSheet.create({
textDecorationLine: "underline",
fontWeight: "500",
marginBottom: 8,
color: "black",
},
value: {
textAlign: "left",
color: "black",
},
});
93 changes: 93 additions & 0 deletions example/windows/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
*AppPackages*
*BundleArtifacts*

#OS junk files
[Tt]humbs.db
*.DS_Store

#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
*.opensdf
*.opendb
*.unsuccessfulbuild
ipch/
[Oo]bj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

#MonoDevelop
*.pidb
*.userprefs

#Tooling
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*
*.sass-cache

#Project files
[Bb]uild/

#Subversion files
.svn

# Office Temp Files
~$*

# vim Temp Files
*~

#NuGet
packages/
*.nupkg

#ncrunch
*ncrunch*
*crunch*.local.xml

# visual studio database projects
*.dbmdl

#Test files
*.testsettings

#Other files
*.DotSettings
.vs/
*project.lock.json

#Files generated by the VS build
**/Generated Files/**

msbuild.binlog
Loading