mirror of
https://github.com/status-im/react-native-camera-kit.git
synced 2025-02-28 15:40:47 +00:00
Android GalleryView in example
This commit is contained in:
parent
1a3218c809
commit
a03f68d4d3
@ -18,7 +18,7 @@ import {
|
|||||||
//CameraKitCamera,
|
//CameraKitCamera,
|
||||||
} from 'react-native-camera-kit';
|
} from 'react-native-camera-kit';
|
||||||
|
|
||||||
//import GalleryScreen from './GalleryScreen';
|
import GalleryScreen from './GalleryScreen';
|
||||||
|
|
||||||
export default class AlbumsScreen extends Component {
|
export default class AlbumsScreen extends Component {
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ export default class AlbumsScreen extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
//if (this.state.albumName) {
|
if (this.state.albumName) {
|
||||||
// const albumName = this.state.albumName;
|
const albumName = this.state.albumName;
|
||||||
// return <GalleryScreen albumName={albumName}/>;
|
return <GalleryScreen albumName={albumName}/>;
|
||||||
//}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
|
117
example/GalleryScreen.android.js
Normal file
117
example/GalleryScreen.android.js
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
import React, {Component} from 'react';
|
||||||
|
import {
|
||||||
|
AppRegistry,
|
||||||
|
StyleSheet,
|
||||||
|
Text,
|
||||||
|
View,
|
||||||
|
ListView,
|
||||||
|
TouchableOpacity,
|
||||||
|
Image,
|
||||||
|
Dimensions
|
||||||
|
} from 'react-native';
|
||||||
|
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
import {
|
||||||
|
CameraKitGalleryView
|
||||||
|
} from 'react-native-camera-kit';
|
||||||
|
|
||||||
|
var groupByEveryN = require('groupByEveryN');
|
||||||
|
const ds = new ListView.DataSource({
|
||||||
|
rowHasChanged: (r1, r2) => r1 !== r2
|
||||||
|
});
|
||||||
|
|
||||||
|
const size = Math.floor((Dimensions.get('window').width) / 3);
|
||||||
|
const innerSize = size - 6;
|
||||||
|
|
||||||
|
export default class GalleryScreenNative extends Component {
|
||||||
|
|
||||||
|
static navigatorButtons = {
|
||||||
|
rightButtons: [
|
||||||
|
{
|
||||||
|
title: 'Done',
|
||||||
|
id: 'navBarDone'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
async onNavigatorEvent(event) {
|
||||||
|
if (event.type === 'NavBarButtonPress') {
|
||||||
|
if (event.id === 'navBarDone') {
|
||||||
|
const selected = await this.gallery.getSelectedImages();
|
||||||
|
|
||||||
|
this.props.navigator.push({
|
||||||
|
screen: 'media.PreviewScreen',
|
||||||
|
title: 'Preview',
|
||||||
|
backButtonTitle: 'Albums',
|
||||||
|
passProps: {
|
||||||
|
imagesData: selected.selectedImages
|
||||||
|
},
|
||||||
|
navigatorStyle: {
|
||||||
|
navBarHidden: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
album: this.props.albumName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
console.log('IN RENDER!');
|
||||||
|
console.log(CameraKitGalleryView);
|
||||||
|
return (
|
||||||
|
<CameraKitGalleryView
|
||||||
|
ref={(gallery) => {
|
||||||
|
this.gallery = gallery;
|
||||||
|
}}
|
||||||
|
style={{flex:1}}
|
||||||
|
albumName={this.state.album}
|
||||||
|
minimumInteritemSpacing={10}
|
||||||
|
minimumLineSpacing={10}
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
backgroundColor: '#F5FCFF',
|
||||||
|
marginTop: 20
|
||||||
|
},
|
||||||
|
listView: {
|
||||||
|
//flex:1,
|
||||||
|
//flexDirection:'column',
|
||||||
|
paddingTop: 0,
|
||||||
|
margin: 8,
|
||||||
|
backgroundColor: '#D6DAC2',
|
||||||
|
|
||||||
|
},
|
||||||
|
row: {
|
||||||
|
flexDirection: 'column',
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
image: {
|
||||||
|
width: innerSize,
|
||||||
|
height: innerSize,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center'
|
||||||
|
},
|
||||||
|
rowContainer: {
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user