import { StyleSheet, Text } from 'react-native' import SwipeableFlatList from 'react-native-swipeable-list' import { useState, useEffect } from 'react' import { getList } from '../api' import Note from './Note' import Menu from './Menu' import RemoveNoteButton from './RemoveNoteButton' import { handleRemove } from "../helpers"; const List = ({ session, setSession, showError, setEdit }) => { const [list, setList] = useState() const [loading, setLoading] = useState(true) const fetchNotes = async () => { setLoading(true) try { const response = await getList({ session }) const data = await response.json() setList(data) } catch(e) { showError('Error while fetching notes') } setLoading(false) } useEffect(() => { setLoading(true) fetchNotes() }, []) return ( <>
{ loading || list === undefined ?