@dormakaba/digital-reactnative-client
Version:
dormakaba digital react components and utils
29 lines (25 loc) • 696 B
JavaScript
import React from 'react';
import { Button, Text, colors } from '@dormakaba/digital-reactnative-visual';
import { getCurrentRouteName, navigate } from './Navigator';
export function NavButton({ label, route, matches }) {
const checkMatches = matches || [route];
const active = checkMatches.indexOf(getCurrentRouteName()) > -1;
const NavBtn = (
<Button
secondary
block
containerStyle={{
alignItems: 'flex-start',
backgroundColor: colors.white,
borderColor: colors.white,
height: 44,
}}
onPress={() => {
navigate(route);
}}
>
<Text bold={active}>{label}</Text>
</Button>
);
return NavBtn;
}