gallery view: added method for modifying the content offset of the collection view

This commit is contained in:
Artal Druk 2017-05-14 14:54:08 +03:00
parent 1c74b2cf53
commit 03fac3591a
3 changed files with 18 additions and 0 deletions

View File

@ -568,6 +568,16 @@ RCT_EXPORT_METHOD(refreshGalleryView:(NSArray*)selectedImages
resolve(@YES);
}
RCT_EXPORT_METHOD(modifyGalleryViewContentOffset:(NSDictionary*)params) {
CGPoint newOffset = self.galleryView.collectionView.contentOffset;
if(params[@"x"] != nil) {
newOffset.x += [params[@"x"] floatValue];
}
if(params[@"y"] != nil) {
newOffset.y += [params[@"y"] floatValue];
}
[self.galleryView.collectionView setContentOffset:newOffset];
}
#pragma mark - Static functions

View File

@ -27,6 +27,10 @@ export default class CameraKitGalleryView extends Component {
return true;
}
modifyGalleryViewContentOffset (offset) {
//do nothing. compatability with ios
}
render() {
const transformedProps = {...this.props};
transformedProps.albumName = this.props.albumName ? this.props.albumName : ALL_PHOTOS;

View File

@ -55,4 +55,8 @@ export default class CameraKitGalleryView extends Component {
const isSuccess = await GalleryViewManager.refreshGalleryView(selectedImages);
return isSuccess;
}
modifyGalleryViewContentOffset (offset) {
GalleryViewManager.modifyGalleryViewContentOffset(offset);
}
}