Tabs

Como utilizar

import { Tab } from '@superlogica/design-system-mobile'
import * as React from 'react';
import { View } from 'react-native';
import { Tab } from '@superlogica/design-system-mobile';
const Page = () => <View style={{ flex: 1, backgroundColor: #ddd; }} />;
const YourApp = () => {
const routes = {
first: Page,
second: Page,
third: Page,
};
const config = [
{
key: 'first',
title: 'First'
},
{
key: 'second',
title: 'Second'
},
{
key: 'third',
title: 'Third',
counter: '5'
}
];
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Tab
scrollEnabled
scenes={routes}
config={config}
initialTab={1}
tabBarPosition="top"
/>
</View>
)
}
export default YourApp;

Props

PropTipoDefaultDescrição
scenesobject{}Objeto com name da rota (first) e screen (Page) a ser renderizada na tab selecionada.
Ex:{first: Page, second: Page}
configarray[]Objeto para definir o title, counter e ordem de exibição de cada tab.
Ex. [{key: 'first',title: 'Home',counter: '5'}, {}...]
sizestringmdDefine o tamanho do componente (md ou lg)
tabBarPositionstringtopDefine a posição da barra de navegação das Tabs (top ou bottom)
lazyboolfalseFaz a animação na transição das screens mais suave
initialTabnumber0Define a tab a ser renderizada inicialmente
scrollEnabledboolfalseHabilita o scroll na barra de navegação das Tabs
onIndexChangefunc() => {}Função chamada quando houver mudança no index das Tabs