Cameraroll Method
name |
function |
Saveimagewithtag |
Save pictures to albums |
Getphotos |
Get pictures from albums |
Example
' Use strict ';
var React = require (' react-native ');
var {cameraroll, Image, Sliderios, StyleSheet, Switchios, Text, View, touchableopacity} = React;
var Camerarollview = require ('./camerarollview.ios ');
var Assetscaledimageexampleview = require ('./assetscaledimageexample ');
var camera_roll_view = ' Camera_roll_view '; var camerarollexample = React.createclass ({getinitialstate () {return {grouptypes: ' Savedphotos ', SLI
Dervalue:1, Bigimages:true,};
}, Render () {return (<View> <switchios Onvaluechange={this._onswitchchange} Value={this.state.bigimages}/> <text>{(this.state.bigImages? ' Big ': ' Small ') + ' Images '}</text> <sliderios value={this.state.slidervalue} onvalu
Echange={this._onsliderchange}/> <text>{' Group Type: ' + this.state.grouptypes}</text> <camerarollview Ref={camEra_roll_view} batchsize={20} grouptypes={this.state.grouptypes} Renderimage={this._renderim
Age}/> </View>); }, Loadasset (asset) {This.props.navigator.push ({title: ' Camera roll Image ', Component:assetscaledimag
Eexampleview, Backbuttontitle: ' Back ', Passprops: {asset:asset},});
}, _renderimage (asset) {var imageSize = this.state.bigImages? 150:75;
var imagestyle = [Styles.image, {width:imagesize, height:imagesize}];
var location = Asset.node.location.longitude?
Json.stringify (asset.node.location): ' Unknown location '; Return (<touchableopacity onpress={this.loadAsset.bind (this, asset)}> <view Key={asset} style=
{styles.row}> <image source={asset.node.image} Style={imagestyle}/> <view style={styles.info}> <text Style={styles.url}>{asset.node.Image.uri}</text> <Text>{location}</Text> <text>{asset.node.group_name}<
;/text> <text>{new Date (asset.node.timestamp). toString ()}</text> </View>
</View> </TouchableOpacity>);
}, _onsliderchange (value) {var options = cameraroll.grouptypesoptions;
var index = Math.floor (value * options.length * 0.99);
var grouptypes = Options[index];
if (grouptypes!== this.state.groupTypes) {this.setstate ({grouptypes:grouptypes});
}}, _onswitchchange (value) {this.refs[camera_roll_view].rendererchanged ();
This.setstate ({bigimages:value});
}
}); var styles = Stylesheet.create ({row: {flexdirection: ' Row ', Flex:1,}, url: {fontsize:9, margin
Bottom:14,}, Image: {Margin:4,}, Info: {flex:1,},});
Exports.title = ' Camera roll '; exports.description = ' Example component that uses cameRaroll to list user\ ' s photos ';
Exports.examples = [{title: ' Photos ', Render (): reactelement {return <camerarollexample/>;}
}
];
effect