Skip to content

Commit

Permalink
Sync guides
Browse files Browse the repository at this point in the history
  • Loading branch information
charpeni committed Apr 7, 2019
1 parent bc675a5 commit d2a8dbc
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 190 deletions.
290 changes: 145 additions & 145 deletions website/versioned_docs/version-0.5/colors.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.5/communication-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ It is fine to update properties anytime. However, updates have to be performed o
There is no way to update only a few properties at a time. We suggest that you build it into your own wrapper instead.
> **_Note:_** Currently, JS functions `componentWillReceiveProps` and `componentWillUpdateProps` of the top level RN component will not be called after a prop update. However, you can access the new props in `componentWillMount` function.
> **_Note:_** Currently, JS function `componentWillUpdateProps` of the top level RN component will not be called after a prop update. However, you can access the new props in `componentDidMount` function.
### Passing properties from React Native to native
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.5/direct-manipulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ render() {

This is computationally intensive compared to the original example - React needs to re-render the component hierarchy each time the opacity changes, even though other properties of the view and its children haven't changed. Usually this overhead isn't a concern but when performing continuous animations and responding to gestures, judiciously optimizing your components can improve your animations' fidelity.

If you look at the implementation of `setNativeProps` in [NativeMethodsMixin](https://github.com/facebook/react-native/blob/master/Libraries/Renderer/oss/ReactNativeRenderer-prod.js) you will notice that it is a wrapper around `RCTUIManager.updateView` - this is the exact same function call that results from re-rendering - see [receiveComponent in ReactNativeBaseComponent.js](https://github.com/facebook/react/blob/master/src/renderers/native/ReactNativeBaseComponent.js).
If you look at the implementation of `setNativeProps` in [NativeMethodsMixin](https://github.com/facebook/react-native/blob/master/Libraries/Renderer/oss/ReactNativeRenderer-prod.js) you will notice that it is a wrapper around `RCTUIManager.updateView` - this is the exact same function call that results from re-rendering - see [receiveComponent in ReactNativeBaseComponent](https://github.com/facebook/react-native/blob/fb2ec1ea47c53c2e7b873acb1cb46192ac74274e/Libraries/Renderer/oss/ReactNativeRenderer-prod.js#L5793-L5813).

## Composite components and setNativeProps

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,51 +600,23 @@ If you need to access to the `DevSettingsActivity` add to your `AndroidManifest.

This is only used in dev mode when reloading JavaScript from the development server, so you can strip this in release builds if you need to.

### Network Security Config (API level 28+)
### Cleartext Traffic (API level 28+)

> Starting with Android 9 (API level 28), cleartext traffic is disabled by default; this prevents your application from connecting to the React Native packager. These changes add domain rules that specifically allow cleartext traffic to the packager IPs.
> Starting with Android 9 (API level 28), cleartext traffic is disabled by default; this prevents your application from connecting to the React Native packager. The changes below allow cleartext traffic in debug builds.
#### 1. Create the following resource files

`app/src/debug/res/xml/network_security_config.xml`:

```xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- allow cleartext traffic for React Native packager ips in debug -->
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false">10.0.2.2</domain>
<domain includeSubdomains="false">10.0.3.2</domain>
</domain-config>
</network-security-config>
```

`app/src/release/res/xml/network_security_config.xml`:

```xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- deny cleartext traffic for React Native packager ips in release -->
<domain-config cleartextTrafficPermitted="false">
<domain includeSubdomains="false">localhost</domain>
<domain includeSubdomains="false">10.0.2.2</domain>
<domain includeSubdomains="false">10.0.3.2</domain>
</domain-config>
</network-security-config>
```

#### 2. Apply the config to your `AndroidManifest.xml`
#### 1. Apply the `usesCleartextTraffic` option to your Debug `AndroidManifest.xml`

```xml
<!-- ... -->
<application
android:networkSecurityConfig="@xml/network_security_config">
android:usesCleartextTraffic="true" tools:targetApi="28" >
<!-- ... -->
</application>
<!-- ... -->
```

This is not required for Release builds.

To learn more about Network Security Config and the cleartext traffic policy [see this link](https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted).

### Code integration
Expand Down
13 changes: 9 additions & 4 deletions website/versioned_docs/version-0.5/native-modules-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ var ScrollResponderMixin = {
mixins: [Subscribable.Mixin],
componentWillMount: function() {
componentDidMount() {
...
this.addListenerOn(DeviceEventEmitter,
'keyboardWillShow',
Expand All @@ -340,11 +340,16 @@ You can also directly use the `DeviceEventEmitter` module to listen for events.
```javascript
...
componentWillMount: function() {
DeviceEventEmitter.addListener('keyboardWillShow', function(e: Event) {
// handle event.
componentDidMount() {
this.subscription = DeviceEventEmitter.addListener('keyboardWillShow', function(e: Event) {
// handle event
});
}

componentWillUnmount() {
// When you want to stop listening to new events, simply call .remove() on the subscription
this.subscription.remove();
}
...
```

Expand Down
4 changes: 1 addition & 3 deletions website/versioned_docs/version-0.5/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ Sometimes, if we do an action in the same frame that we are adjusting the opacit

```javascript
handleOnPress() {
// Always use TimerMixin with requestAnimationFrame, setTimeout and
// setInterval
this.requestAnimationFrame(() => {
requestAnimationFrame(() => {
this.doExpensiveAction();
});
}
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.5/props.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Greeting extends Component {
export default class LotsOfGreetings extends Component {
render() {
return (
<View style={{alignItems: 'center'}}>
<View style={{alignItems: 'center', top: 50}}>
<Greeting name='Rexxar' />
<Greeting name='Jaina' />
<Greeting name='Valeera' />
Expand Down
2 changes: 2 additions & 0 deletions website/versioned_docs/version-0.5/running-on-device.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ You can now enable Live reloading from the [Developer menu](debugging.md#accessi

You have built a great app using React Native, and you are now itching to release it in the App Store. The process is the same as any other native iOS app, with some additional considerations to take into account.

> If you are using Expo then read the Expo Guide for [Building Standalone Apps](https://docs.expo.io/versions/latest/distribution/building-standalone-apps/).
### 1. Enable App Transport Security

App Transport Security is a security feature introduced in iOS 9 that rejects all HTTP requests that are not sent over HTTPS. This can result in HTTP traffic being blocked, including the developer React Native server. ATS is disabled for `localhost` by default in React Native projects in order to make development easier.
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.5/using-a-scrollview.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ AppRegistry.registerComponent(

ScrollViews can be configured to allow paging through views using swiping gestures by using the `pagingEnabled` props. Swiping horizontally between views can also be implemented on Android using the [ViewPagerAndroid](viewpagerandroid.md) component.

A ScrollView with a single item can be used to allow the user to zoom content. Set up the `maximumZoomScale` and `minimumZoomScale` props and your user will be able to use pinch and expand gestures to zoom in and out.
On iOS a ScrollView with a single item can be used to allow the user to zoom content. Set up the `maximumZoomScale` and `minimumZoomScale` props and your user will be able to use pinch and expand gestures to zoom in and out.

The ScrollView works best to present a small amount of things of a limited size. All the elements and views of a `ScrollView` are rendered, even if they are not currently shown on the screen. If you have a long list of more items than can fit on the screen, you should use a `FlatList` instead. So let's [learn about list views](using-a-listview.md) next.

0 comments on commit d2a8dbc

Please sign in to comment.