Created
September 29, 2020 13:47
-
-
Save erandirjunior/fb5efb3b27fa86ad3a2a93d7c17494f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from 'react'; | |
import { Alert } from 'react-native'; | |
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; | |
import api from '~/services/api'; | |
import { useDispatch, useSelector } from 'react-redux'; | |
import { storeRequest } from '~/store/modules/store/actions'; | |
import ContainerMain from '~/components/ContainerMain'; | |
// import {Text} from "~/components/Button/styles"; | |
import { FlatList, Text, Button } from 'react-native'; | |
const Store = () => { | |
const dispatch = useDispatch(); | |
let stores = [] | |
let names = [] | |
const fetchData = async () => { | |
api.get("/establishments?name=&street&state=&city=") | |
.then(resp => { | |
stores = resp.data | |
alert('aqui') | |
}) | |
} | |
useEffect(() => { | |
fetchData() | |
}, [dispatch, stores, names]); | |
return ( | |
<ContainerMain> | |
{ | |
stores.map((item, index) => ( | |
<Text> | |
{item.name} | |
</Text> | |
)) | |
} | |
<FlatList | |
data={names} | |
renderItem={({item}) => <Text>{item.key}</Text>} | |
/> | |
<Text>aqui</Text> | |
</ContainerMain> | |
); | |
}; | |
Store.navigationOptions = () => ({ | |
title: 'Lojas', | |
tabBarIcon: ({ color }) => <Icon name="store" size={28} color={color} />, | |
}); | |
export default Store; |
IgorDePaula
commented
Sep 29, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment