Skip to content

Commit

Permalink
add Loading && mergeOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei committed Jul 14, 2020
1 parent d153432 commit 4a9397b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/screens/Pokemons.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import React from 'react';
import { View, Text, SafeAreaView } from 'react-native';
import { View, SafeAreaView, ActivityIndicator } from 'react-native';
import { Navigation } from 'react-native-navigation';
import { useSelector } from 'react-redux';

import PokemonList from '../components/PokemonList';
import { THEME } from '../utils/theme';

const Index = ({ componentId }) => {
const { root, pokemons } = useSelector(state => state);
const { root } = useSelector(state => state);

Navigation.mergeOptions(componentId, {
topBar: { visible: false },
});

return (
<SafeAreaView>
<PokemonList cId={componentId} />

{root?.isLoading && (
<View style={{ backgroundColor: 'cyan' }}>
<Text>Carregando</Text>
<View style={{ width: '100%', justifyContent: 'center' }}>
<ActivityIndicator size="large" color={THEME.fire.bg} />
</View>
)}

<PokemonList data={pokemons} cId={componentId} />
</SafeAreaView>
);
};
Expand Down

0 comments on commit 4a9397b

Please sign in to comment.