From a288f1d894410cc885de8526fb079959c39ffadc Mon Sep 17 00:00:00 2001 From: Travis CI Date: Mon, 16 Mar 2015 16:30:01 +0000 Subject: [PATCH] update website --- docs/asyncstorage.html | 4 ++-- docs/cameraroll.html | 14 +++++++------- docs/pixelratio.html | 20 ++++++++++---------- docs/stylesheet.html | 38 +++++++++++++++++++------------------- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/docs/asyncstorage.html b/docs/asyncstorage.html index d3b18acad82..7ebbe5db822 100644 --- a/docs/asyncstorage.html +++ b/docs/asyncstorage.html @@ -7,8 +7,8 @@ there is any.

static removeItem(key: string, callback: ?(error: ?Error) => void) #

static mergeItem(key: string, value: string, callback: ?(error: ?Error) => void) #

Merges existing value with input value, assuming they are stringified json.

Not supported by all native implementations.

static clear(callback: ?(error: ?Error) => void) #

Erases all AsyncStorage for all clients, libraries, etc. You probably don't want to call this - use removeItem or multiRemove to clear only your own keys instead.

static getAllKeys(callback: (error: ?Error) => void) #

Gets all keys known to the system, for all callers, libraries, etc.

static multiGet(keys: Array<string>, callback: (errors: ?Array<Error>, result: ?Array<Array<string>>) => void) #

multiGet invokes callback with an array of key-value pair arrays that -matches the input format of multiSet.

multiGet(['k1', 'k2'], cb) -> cb([['k1', 'val1'], ['k2', 'val2']])

static multiSet(keyValuePairs: Array<Array<string>>, callback: ?(errors: ?Array<Error>) => void) #

multiSet and multiMerge take arrays of key-value array pairs that match -the output of multiGet, e.g.

multiSet([['k1', 'val1'], ['k2', 'val2']], cb);

static multiRemove(keys: Array<string>, callback: ?(errors: ?Array<Error>) => void) #

Delete all the keys in the keys array.

static multiMerge(keyValuePairs: Array<Array<string>>, callback: ?(errors: ?Array<Error>) => void) #

Merges existing values with input values, assuming they are stringified +matches the input format of multiSet.

multiGet(['k1', 'k2'], cb) -> cb([['k1', 'val1'], ['k2', 'val2']])

static multiSet(keyValuePairs: Array<Array<string>>, callback: ?(errors: ?Array<Error>) => void) #

multiSet and multiMerge take arrays of key-value array pairs that match +the output of multiGet, e.g.

multiSet([['k1', 'val1'], ['k2', 'val2']], cb);

static multiRemove(keys: Array<string>, callback: ?(errors: ?Array<Error>) => void) #

Delete all the keys in the keys array.

static multiMerge(keyValuePairs: Array<Array<string>>, callback: ?(errors: ?Array<Error>) => void) #

Merges existing values with input values, assuming they are stringified json.

Not supported by all native implementations.

Next →

CameraRoll

Methods #

static saveImageWithTag(tag: string, successCallback, errorCallback) #

Saves the image with tag tag to the camera roll.

@param {string} tag - Can be any of the three kinds of tags we accept: -1. URL -2. assets-library tag -3. tag returned from storing an image in memory

static getPhotos(params: object, callback: function, errorCallback: function) #

Invokes callback with photo identifier objects from the local camera -roll of the device matching shape defined by getPhotosReturnChecker.

@param {object} params - See getPhotosParamChecker. -@param {function} callback - Invoked with arg of shape defined by -getPhotosReturnChecker on success. -@param {function} errorCallback - Invoked with error message on error.

© 2015 Facebook Inc.

PixelRatio

PixelRatio class gives access to the device pixel density.

Some examples: -- PixelRatio.get() === 2 -- iPhone 4, 4S -- iPhone 5, 5c, 5s -- iPhone 6

  • PixelRatio.get() === 3
  • iPhone 6 plus

There are a few use cases for using PixelRatio:

== Displaying a line that's as thin as the device permits

A width of 1 is actually pretty thick on an iPhone 4+, we can do one that's + - PixelRatio.get() === 2 + - iPhone 4, 4S + - iPhone 5, 5c, 5s + - iPhone 6

  • PixelRatio.get() === 3
    • iPhone 6 plus

There are a few use cases for using PixelRatio:

== Displaying a line that's as thin as the device permits

A width of 1 is actually pretty thick on an iPhone 4+, we can do one that's thinner using a width of 1 / PixelRatio.get(). It's a technique that works -on all the devices independent of their pixel density.

style={{ borderWidth: 1 / PixelRatio.get() }}

== Fetching a correctly sized image

You should get a higher resolution image if you are on a high pixel density +on all the devices independent of their pixel density.

style={{ borderWidth: 1 / PixelRatio.get() }}

== Fetching a correctly sized image

You should get a higher resolution image if you are on a high pixel density device. A good rule of thumb is to multiply the size of the image you display -by the pixel ratio.

var image = getImage({ -width: 200 PixelRatio.get(), -height: 100 PixelRatio.get() -});

<Image source={image} style={{width: 200, height: 100}} /> -

Methods #

static get() #

static startDetecting() #

© 2015 Facebook Inc.

StyleSheet

A StyleSheet is an abstraction similar to CSS StyleSheets

Create a new StyleSheet:

var styles = StyleSheet.create({ -container: { -borderRadius: 4, -borderWidth: 0.5, -borderColor: '#d6d7da', -}, -title: { -fontSize: 19, -fontWeight: 'bold', -}, -activeTitle: { -color: 'red', -}, + container: { + borderRadius: 4, + borderWidth: 0.5, + borderColor: '#d6d7da', + }, + title: { + fontSize: 19, + fontWeight: 'bold', + }, + activeTitle: { + color: 'red', + }, })

Use a StyleSheet:

<View style={styles.container}> -<Text style={[styles.title, this.props.isActive && styles.activeTitle]} /> + <Text style={[styles.title, this.props.isActive && styles.activeTitle]} /> </View>

Code quality: -- By moving styles away from the render function, you're making the code -code easier to understand. -- Naming the styles is a good way to add meaning to the low level components -in the render function.

Performance: -- Making a stylesheet from a style object makes it possible to refer to it + - By moving styles away from the render function, you're making the code + code easier to understand. + - Naming the styles is a good way to add meaning to the low level components + in the render function.

Performance: + - Making a stylesheet from a style object makes it possible to refer to it by ID instead of creating a new style object every time. -- It also allows to send the style only once through the bridge. All + - It also allows to send the style only once through the bridge. All subsequent uses are going to refer an id (not implemented yet).

Methods #

static create(obj) #

static validateStyleProp(prop, style, caller) #

static validateStyle(name, styles) #

static addValidStylePropTypes(stylePropTypes) #

© 2015 Facebook Inc.