FlatList

Build a photo gallery

Photo gallery

// https://dev.to/vinodchauhan7/react-hooks-with-async-await-1n9g
// https://medium.com/react-native-development/how-to-use-the-flatlist-component-react-native-basics-92c482816fe6
// http://www.reactnativeexpress.com/flatlist
// https://hackernoon.com/how-to-highlight-and-multi-select-items-in-a-flatlist-component-react-native-1ca416dec4bc
// https://stackoverflow.com/questions/59486602/react-native-flatlist-delete-item
// https://snack.expo.io/@spencercarli/react-native-flatlist-grid
import React, {useState, useEffect} from 'react';
import {View, Text} from 'react-native';
import {connect} from 'react-redux';

import MultiColumnGallery from '../../Components/Gallery/MultiColumnGallery';
import useAsyncHook from '../../Hooks/useAsyncHook';

const ReportsUploadScreen = ({captures}) => {
  // const [search, setSearch] = useState('');
  // const [query, setQuery] = useState('');
  // const [result, loading] = useAsyncHook(query);

  // useEffect(() => {
  //   setQuery('cars');
  // }, []);

  // console.log('loading', loading);
  // if (loading === false) {
  //   return (
  //     <View style={{flex: 1}}>
  //       <Text>Ready to search</Text>
  //     </View>
  //   );
  // }
  // if (loading === 'null') {
  //   return (
  //     <View style={{flex: 1}}>
  //       <Text>No results</Text>
  //     </View>
  //   );
  // }
  return (
    <View style={{flex: 1}}>
      <MultiColumnGallery data={captures} />
    </View>
  );
};

const mapStateToProps = state => ({
  captures: state.reportCaptures,
});

export default connect(mapStateToProps)(ReportsUploadScreen);

Last updated

Was this helpful?