From 0463d8e9e6531155e4804c970c873f44312e5807 Mon Sep 17 00:00:00 2001 From: Website Deployment Script Date: Tue, 24 May 2016 18:52:39 +0000 Subject: [PATCH] Updated docs for next --- releases/next/docs/platform-specific-code.html | 6 +++--- releases/next/docs/scrollview.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/releases/next/docs/platform-specific-code.html b/releases/next/docs/platform-specific-code.html index ada2cabe8a7..60deafb2394 100644 --- a/releases/next/docs/platform-specific-code.html +++ b/releases/next/docs/platform-specific-code.html @@ -2,12 +2,12 @@ /android/components/ /ios/components/

Another option may be naming the components differently depending on the platform they are going to be used in:

BigButtonIOS.js BigButtonAndroid.js

But React Native provides two alternatives to easily organize your code separating it by platform:

Platform specific extensions #

React Native will detect when a file has a .ios. or .android. extension and load the right file for each platform when requiring them from other components.

For example, you can have these files in your project:

BigButton.ios.js -BigButton.android.js

With this setup, you can just require the files from a different component without paying attention to the platform in which the app will run.

import BigButton from './components/BigButton';

React Native will import the correct component for the running platform.

Platform module #

A module is provided by React Native to detect what is the platform in which the app is running. This piece of functionality can be useful when only small parts of a component are platform specific.

var { Platform } = ReactNative; +BigButton.android.js

With this setup, you can just require the files from a different component without paying attention to the platform in which the app will run.

import BigButton from './components/BigButton';

React Native will import the correct component for the running platform.

Platform module #

A module is provided by React Native to detect what is the platform in which the app is running. This piece of functionality can be useful when only small parts of a component are platform specific.

var { Platform } = React; var styles = StyleSheet.create({ height: (Platform.OS === 'ios') ? 200 : 100, });

Platform.OS will be ios when running in iOS and android when running in an Android device or simulator.

There is also a Platform.select method available, that given an object containing Platform.OS as keys, -returns the value for the platform you are currently running on.

var { Platform } = ReactNative; +returns the value for the platform you are currently running on.

var { Platform } = React; var styles = StyleSheet.create({ container: { @@ -27,7 +27,7 @@ on Android.

Since it accepts any value, you can also use it t android: () => require('ComponentAndroid'), })(); -<Component />;

Detecting Android version #

On Android, the Platform module can be also used to detect which is the version of the Android Platform in which the app is running

var {Platform} = ReactNative; +<Component />;

Detecting Android version #

On Android, the Platform module can be also used to detect which is the version of the Android Platform in which the app is running

var {Platform} = React; if(Platform.Version === 21){ console.log('Running on Lollipop!'); diff --git a/releases/next/docs/scrollview.html b/releases/next/docs/scrollview.html index 08a1a8c7fda..a1dba63ea0d 100644 --- a/releases/next/docs/scrollview.html +++ b/releases/next/docs/scrollview.html @@ -70,7 +70,7 @@ for UIScrollViewDecelerationRateNormal and scrolling while dragging. The default value is false.

iosindicatorStyle enum('default', 'black', 'white') #

The style of the scroll indicators. - default (the default), same as black. - black, scroll indicator is black. This style is good against a white content background. - - white, scroll indicator is white. This style is good against a black content background.

iosmaximumZoomScale number #

The maximum allowed zoom scale. The default value is 1.0.

iosminimumZoomScale number #

The minimum allowed zoom scale. The default value is 1.0.

iosonScrollAnimationEnd function #

Called when a scrolling animation ends.

iosscrollEventThrottle number #

This controls how often the scroll event will be fired while scrolling + - white, scroll indicator is white. This style is good against a black content background.

iosmaximumZoomScale number #

The maximum allowed zoom scale. The default value is 1.0.

iosminimumZoomScale number #

The minimum allowed zoom scale. The default value is 1.0.

iosonRefreshStart function #

Deprecated

Use the refreshControl prop instead.

iosonScrollAnimationEnd function #

Called when a scrolling animation ends.

iosscrollEventThrottle number #

This controls how often the scroll event will be fired while scrolling (as a time interval in ms). A lower number yields better accuracy for code that is tracking the scroll position, but can lead to scroll performance problems due to the volume of information being send over the bridge. @@ -92,7 +92,7 @@ with snapToAlignment.

ioszoomScale number #

The current scale of the scroll view content. The default value is 1.0.

Methods #

scrollTo(y: number | { x?: number, y?: number, animated?: boolean }, x: number, animated: boolean) #

Scrolls to a given x, y offset, either immediately or with a smooth animation.

Syntax:

scrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true})

Note: The weird argument signature is due to the fact that, for historical reasons, +with horizontal={true}.

ioszoomScale number #

The current scale of the scroll view content. The default value is 1.0.

Methods #

endRefreshing() #

Deprecated. Use RefreshControl instead.

scrollTo(y: number | { x?: number, y?: number, animated?: boolean }, x: number, animated: boolean) #

Scrolls to a given x, y offset, either immediately or with a smooth animation.

Syntax:

scrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true})

Note: The weird argument signature is due to the fact that, for historical reasons, the function also accepts separate arguments as as alternative to the options object. This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.

scrollWithoutAnimationTo(y, x) #

Deprecated, do not use.

Examples #

Edit on GitHub
'use strict';