From a288f1d894410cc885de8526fb079959c39ffadc Mon Sep 17 00:00:00 2001
From: Travis CI
Merges existing value with input value, assuming they are stringified json.
Not supported by all native implementations.
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.
Gets all keys known to the system, for all callers, libraries, etc.
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']])
multiSet and multiMerge take arrays of key-value array pairs that match -the output of multiGet, e.g.
multiSet([['k1', 'val1'], ['k2', 'val2']], cb);
Delete all the keys in the keys array.
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']])
multiSet and multiMerge take arrays of key-value array pairs that match +the output of multiGet, e.g.
multiSet([['k1', 'val1'], ['k2', 'val2']], cb);
Delete all the keys in the keys array.
Merges existing values with input values, assuming they are stringified json.
Not supported by all native implementations.
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
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.
PixelRatio class gives access to the device pixel density.
Some examples: -- PixelRatio.get() === 2 -- iPhone 4, 4S -- iPhone 5, 5c, 5s -- iPhone 6
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
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}} /> -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).