Guest User

Untitled

a guest
May 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. async getCameraRoll() {
  2. let allPhotos = [];
  3. let has_next_page = true;
  4. let end_cursor = undefined;
  5. let photos;
  6.  
  7. do {
  8. photos = await CameraRoll.getPhotos({
  9. first: 20,
  10. after: end_cursor === undefined ? null : end_cursor
  11. });
  12. if (photos.page_info.has_next_page !== true) has_next_page = false;
  13. end_cursor = photos.page_info.end_cursor;
  14. allPhotos = allPhotos.concat(photos.edges);
  15. } while (has_next_page === true);
  16. this.setState({ photos: allPhotos });
  17. }
  18.  
  19. <ScrollView contentContainerStyle={styles.scrollContainer}>
  20. {this.state.photos.map((image, i) => {
  21. let uri = image.node.image.uri;
  22. return (
  23. <TouchableOpacity
  24. activeOpacity={1}
  25. style={styles.imageWrapper}
  26. key={i}
  27. onPress={() =>
  28. this.props.navigator.push({
  29. screen: "watiz.ImageSelection",
  30. navigatorStyle: {
  31. navBarHidden: true
  32. },
  33. passProps: { uri, previousScreen: "watiz.Gallery" }
  34. })
  35. }
  36. underlayColor="transparent"
  37. >
  38. <Image style={styles.image} source={{ uri: uri }} />
  39. </TouchableOpacity>
  40. );
  41. })}
  42. </ScrollView>
Add Comment
Please, Sign In to add comment