mirror of
https://github.com/status-im/react-native-camera-kit.git
synced 2025-02-28 15:40:47 +00:00
Example for Android with selection state
This commit is contained in:
parent
fb571a7442
commit
4b2465d30c
@ -58,13 +58,21 @@ export default class GalleryScreenNative extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
album: this.props.albumName
|
album: this.props.albumName,
|
||||||
|
uris: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onTapImage(event) {
|
||||||
|
if(_.includes(this.state.uris, event.uri)) {
|
||||||
|
const index = this.state.uris.indexOf(event.uri);
|
||||||
|
this.setState({uris: [...this.state.uris.slice(0, index - 1), ...this.state.uris.slice(index + 1)]});
|
||||||
|
} else {
|
||||||
|
this.setState({uris: [...this.state.uris, event.uri]});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
console.log('IN RENDER!');
|
|
||||||
console.log(CameraKitGalleryView);
|
|
||||||
return (
|
return (
|
||||||
<CameraKitGalleryView
|
<CameraKitGalleryView
|
||||||
ref={(gallery) => {
|
ref={(gallery) => {
|
||||||
@ -74,9 +82,10 @@ export default class GalleryScreenNative extends Component {
|
|||||||
albumName={this.state.album}
|
albumName={this.state.album}
|
||||||
minimumInteritemSpacing={10}
|
minimumInteritemSpacing={10}
|
||||||
minimumLineSpacing={10}
|
minimumLineSpacing={10}
|
||||||
|
columnCount={3}
|
||||||
|
selectedUris={this.state.uris}
|
||||||
|
onTapImage={this.onTapImage.bind(this)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user