provider.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import React from 'react'
  2. // import Expo from 'expo'
  3. import {
  4. StyleSheet,
  5. FlatList,
  6. View,
  7. Image } from 'react-native'
  8. export default class UppyReactNativeFilePicker extends React.Component {
  9. constructor () {
  10. super()
  11. this.state = {
  12. instagram: {
  13. user: 'bla@gmail.com',
  14. items: [
  15. { caption: Date.now(), url: 'http://lorempixel.com/200/200/cats/1' },
  16. { caption: Date.now(), url: 'http://lorempixel.com/200/200/cats/2' },
  17. { caption: Date.now(), url: 'http://lorempixel.com/200/200/cats/3' },
  18. { caption: Date.now(), url: 'http://lorempixel.com/200/200/cats/4' },
  19. { caption: Date.now(), url: 'http://lorempixel.com/200/200/cats/5' },
  20. { caption: Date.now(), url: 'http://lorempixel.com/200/200/' },
  21. { caption: Date.now(), url: 'http://lorempixel.com/200/200/' },
  22. { caption: Date.now(), url: 'http://lorempixel.com/200/200/' },
  23. { caption: Date.now(), url: 'http://lorempixel.com/200/200/' }
  24. ]
  25. }
  26. }
  27. }
  28. renderGrid (items) {
  29. return (
  30. <View style={styles.container}>
  31. <FlatList
  32. data={items}
  33. renderItem={({item}) => (
  34. <View style={{ flex: 1, flexDirection: 'column', margin: 1 }}>
  35. <Image style={styles.item} source={{uri: item.url}} />
  36. </View>
  37. )}
  38. keyExtractor={(item, index) => index.toString()}
  39. numColumns={3}
  40. />
  41. </View>
  42. )
  43. }
  44. renderRow () {
  45. }
  46. render () {
  47. return this.renderGrid(this.state.instagram.items)
  48. }
  49. }
  50. const styles = StyleSheet.create({
  51. container: {
  52. justifyContent: 'center',
  53. flex: 1,
  54. paddingTop: 30
  55. },
  56. item: {
  57. justifyContent: 'center',
  58. alignItems: 'center',
  59. height: 100
  60. }
  61. })