UNPKG

kia-ml

Version:

Kia

52 lines (50 loc) 1.87 kB
import * as React from "react"; import { Text, TouchableOpacity } from "react-native"; import { KiaIcon } from "../../icon/icon"; import { color, spacing } from "../../../theme"; import { useNavigation } from '@react-navigation/native'; const componentView = { flex: 1, justifyContent: "center", alignItems: "center" }; const baseText = { paddingHorizontal: spacing[3], marginTop: spacing[2] }; const baseTextActive = { paddingHorizontal: spacing[3], marginTop: spacing[2], color: color.primary }; const config = { home: { icon: (filled = false) => filled ? "https://kia-icons.s3.ap-south-1.amazonaws.com/home_filled.png" : "https://kia-icons.s3.ap-south-1.amazonaws.com/home.png", text: "Home" }, explore: { icon: (filled = false) => filled ? "https://kia-icons.s3.ap-south-1.amazonaws.com/explore_filled.png" : "https://kia-icons.s3.ap-south-1.amazonaws.com/explore.png", text: "Explore" }, bookmarks: { icon: (filled = false) => filled ? "https://kia-icons.s3.ap-south-1.amazonaws.com/bookmark_filled.png" : "https://kia-icons.s3.ap-south-1.amazonaws.com/bookmark.png", text: "Bookmarks" }, create: { icon: (filled = false) => filled ? "https://kia-icons.s3.ap-south-1.amazonaws.com/add_filled.png" : "https://kia-icons.s3.ap-south-1.amazonaws.com/add_b.png", text: "Create" } }; export function BottomNavComponent(props) { const navigation = useNavigation(); const nav = () => navigation.navigate(props.type); return /*#__PURE__*/React.createElement(TouchableOpacity, { onPress: nav, style: componentView }, /*#__PURE__*/React.createElement(KiaIcon, { src: config[props.type].icon(props.active) }), /*#__PURE__*/React.createElement(Text, { style: props.active ? baseTextActive : baseText }, config[props.type].text)); } //# sourceMappingURL=bottom-nav-component.js.map