Skip to content

Commit

Permalink
Update Docusaurus to 1.3.0 (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
yangshun authored and hramos committed Jun 25, 2018
1 parent 5995e3d commit 7d3e9e1
Show file tree
Hide file tree
Showing 11 changed files with 2,335 additions and 156 deletions.
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ There are many ways to contribute to React Native, and many of them do not invol
* Read through the [React Native docs](http://facebook.github.io/react-native/). If you find anything that is confusing or can be improved, you can make edits by clicking "Edit" at the top of most docs.
* Browse [Stack Overflow](https://stackoverflow.com/questions/tagged/react-native) and answer questions. This will help you get familiarized with common pitfalls or misunderstandings, which can be useful when contributing updates to the documentation.
* Take a look at the [features requested](https://react-native.canny.io/feature-requests) by others in the community and consider opening a pull request if you see something you want to work on.
* Before opening your pull request, make sure you have fully tested your changes. Test your changes locally and by running the various tests provided.
* For information on how to build the React Native project locally with your changes, make sure to read through the [Building React Native from source guide](https://facebook.github.io/react-native/docs/building-from-source.html).
* Before opening your pull request, make sure you have fully tested your changes. Test your changes locally and by running the various tests provided.
* For information on how to build the React Native project locally with your changes, make sure to read through the [Building React Native from source guide](https://facebook.github.io/react-native/docs/building-from-source.html).
* Check out the [Testing your changes guide](https://facebook.github.io/react-native/docs/testing.html) to find out about the numerous tests which has been provided to help ensure that any new changes wont cause a regression.

Contributions are very welcome. If you think you need help planning your contribution, please hop into [#react-native](https://discord.gg/0ZcbPKXt5bZjGY5n) and let people know you're looking for a mentor.
Expand Down
100 changes: 50 additions & 50 deletions docs/removing-default-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,63 @@ By default, some permissions are added to your Android APK.

The default permissions that get added are:

* android.permission.INTERNET - Required for debug mode.
* android.permission.SYSTEM_ALERT_WINDOW - Required for debug mode.
* android.permission.READ_PHONE_STATE - Not required for debug or production.
* android.permission.WRITE_EXTERNAL_STORAGE - Not required for debug or production.
* android.permission.READ_EXTERNAL_STORAGE - Not required for debug or production.
* android.permission.INTERNET - Required for debug mode.
* android.permission.SYSTEM_ALERT_WINDOW - Required for debug mode.
* android.permission.READ_PHONE_STATE - Not required for debug or production.
* android.permission.WRITE_EXTERNAL_STORAGE - Not required for debug or production.
* android.permission.READ_EXTERNAL_STORAGE - Not required for debug or production.

1. Let's start by removing `READ_PHONE_STATE`, `WRITE_EXTERNAL_STORAGE`, and `READ_EXTERNAL_STORAGE` from both production and debug APKs, as it is not required in either. These storage permissions are still not needed if `AsyncStorage` module is in use, so it is safe to remove from both production and debug.
2. Open your `android/app/src/main/AndroidManifest.xml` file.
3. Even though these three permissions are not listed in the manifest they get added in. We add the three permissions with `tools:node="remove"` attribute, to make sure it gets removed during build. Note that the package identifier will be different, for below it is "com.myapp" because the project was created with `react-native init myapp`.
```diff
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myappid"
+ xmlns:tools="http://schemas.android.com/tools"
>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+ <uses-permission tools:node="remove" android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission tools:node="remove" android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission tools:node="remove" android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
```

```diff
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myappid"
+ xmlns:tools="http://schemas.android.com/tools"
>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+ <uses-permission tools:node="remove" android:name="android.permission.READ_PHONE_STATE" />
+ <uses-permission tools:node="remove" android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission tools:node="remove" android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>

</manifest>
```

4. Now let's remove `SYSTEM_ALERT_WINDOW` from the production APK only.
5. Go to the `android/app/src/` directory. Create a new directory inside this directory, called `release`. (path: `android/app/src/release/`)
6. Inside this `android/app/src/release/` directory create a `AndroidManifest.xml` file. (path: `android/app/src/release/AndroidManifest.xml`)
7. Inside this file paste the following conents. Note, make sure to update your package identifier from "com.myapp" to what yours is.

```diff
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission tools:node="remove" android:name="android.permission.SYSTEM_ALERT_WINDOW" />
</manifest>
```
```diff
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission tools:node="remove" android:name="android.permission.SYSTEM_ALERT_WINDOW" />

</manifest>
```

That's it. We did not remove the `INTERNET` permission as pretty much all apps use it. Now whenever you create a production APK all these 4 permissions will be removed. When you create a debug APK (`react-native run-android`) it will install the APK with only the three permissions removed, and `SYSTEM_ALERT_WINDOW` will remain.
2 changes: 1 addition & 1 deletion website/core/RemarkablePlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function ReactNativeWebPlayer(md) {
return (
'<div class="web-player">' +
htmlForCodeBlock(sampleCode) +
`<iframe style="margin-top: 4" width="880" height="${
`<iframe style="margin-top: 4" width="100%" height="${
parseParams(paramsString).platform === 'android' ? '425' : '420'
}" data-src="//cdn.rawgit.com/dabbott/react-native-web-player/gh-v${WEB_PLAYER_VERSION}/index.html${hash}" frame-border="0"></iframe>` +
`</div>` +
Expand Down
1 change: 1 addition & 0 deletions website/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"props": "Props",
"pushnotificationios": "PushNotificationIOS",
"refreshcontrol": "RefreshControl",
"removing-default-permissions": "Removing Default Permissions",
"running-on-device": "Running On Device",
"running-on-simulator-ios": "Running On Simulator",
"safeareaview": "SafeAreaView",
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"*.{js,json,css,md}": ["prettier --write", "git add"]
},
"dependencies": {
"docusaurus": "^1.0.15",
"docusaurus": "^1.3.0",
"highlight.js": "^9.12.0",
"remarkable": "^1.7.1"
},
Expand Down
3 changes: 2 additions & 1 deletion website/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const siteConfig = {
theme: "solarized-dark"
},
gaTrackingId: "UA-41298772-2",
scripts: ["https://snack.expo.io/embed.js", baseUrl + "js/codeblocks.js"]
scripts: ["https://snack.expo.io/embed.js", baseUrl + "js/codeblocks.js"],
cleanUrl: true
};

module.exports = siteConfig;
4 changes: 4 additions & 0 deletions website/static/css/codeblocks.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/** React Native Web Player **/
.web-player {
margin-bottom: 1em;
}

.web-player > iframe {
display: none;
}
Expand Down
6 changes: 2 additions & 4 deletions website/static/css/hero.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@
background: #2d2d2d;
padding: 50px 0;
color: #fdf3e7;
font-weight: 300;
text-align: center;
text-align: center;
}

.hero .text {
font-size: 300%;
text-align: center;
height: 44px;
}

.hero .minitext {
Expand All @@ -67,7 +65,7 @@
}

.buttons-unit a {
color:white;
color: white;
}

.buttons-unit .button {
Expand Down
3 changes: 0 additions & 3 deletions website/static/css/react-native.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ body {

a {
color: $secondaryColor;
text-decoration: none !important;
}

input#search_input_react {
Expand Down Expand Up @@ -147,7 +146,6 @@ code {

p {
font-size: 18px;
line-height: 1.4;
}

.big-button {
Expand Down Expand Up @@ -202,7 +200,6 @@ p {

.hljs {
line-height: 20px;
border-left: 4px solid #05a5d1;
background-color: rgba(5, 165, 209, 0.05);
}

Expand Down
4 changes: 3 additions & 1 deletion website/static/css/tabs.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.toggler {
margin-bottom: 1em;
}
.toggler li {
display: inline-block;
position: relative;
Expand Down Expand Up @@ -48,4 +51,3 @@
text-decoration: none !important;
color: $secondaryColor;
}

Loading

0 comments on commit 7d3e9e1

Please sign in to comment.