diff --git a/lib/src/components/BottomBar.js b/lib/src/BottomBar.js similarity index 85% rename from lib/src/components/BottomBar.js rename to lib/src/BottomBar.js index b58e571..49354bb 100644 --- a/lib/src/components/BottomBar.js +++ b/lib/src/BottomBar.js @@ -1,10 +1,11 @@ import React, { Component } from "react"; import { View } from "react-native"; -// Other Components -import Shape from "./Shape"; -import BottomIcons from "./BottomIcons"; -// Styles -import styles from "./styles/BottomBar.style"; +/** + * ? Local Imports + */ +import styles from "./BottomBar.style"; +import Shape from "./components/Shape/Shape"; +import BottomIcons from "./components/BottomIcons/BottomIcons"; export default class BottomBar extends Component { renderTabBar = () => { @@ -38,6 +39,7 @@ export default class BottomBar extends Component { secondIconComponent={secondIconComponent} thirdIconComponent={thirdIconComponent} fourthIconComponent={fourthIconComponent} + {...this.props} /> ); diff --git a/lib/src/components/styles/BottomBar.style.js b/lib/src/BottomBar.style.js similarity index 100% rename from lib/src/components/styles/BottomBar.style.js rename to lib/src/BottomBar.style.js diff --git a/lib/src/components/BottomIcons.js b/lib/src/components/BottomIcons.js deleted file mode 100644 index c47228a..0000000 --- a/lib/src/components/BottomIcons.js +++ /dev/null @@ -1,64 +0,0 @@ -import React, { Component } from "react"; -import { View } from "react-native"; -// Components -import styles from "./styles/BottomIcons.style"; -import MiniButton from "./MiniButton"; -import MainIconButton from "./MainIconButton"; - -export default class BottomIcons extends Component { - render() { - const { - mainIcon, - mainIconColor, - mainIconGradient, - mainIconComponent, - mainIconOnPress, - miniButtonsColor, - firstIconComponent, - secondIconComponent, - thirdIconComponent, - fourthIconComponent - } = this.props; - - return ( - - - {firstIconComponent || ( - - )} - {secondIconComponent || ( - - )} - - {mainIconComponent || ( - - )} - - {thirdIconComponent || ( - - )} - {fourthIconComponent || ( - - )} - - - ); - } -} diff --git a/lib/src/components/BottomIcons/BottomIcons.js b/lib/src/components/BottomIcons/BottomIcons.js new file mode 100644 index 0000000..e238f10 --- /dev/null +++ b/lib/src/components/BottomIcons/BottomIcons.js @@ -0,0 +1,82 @@ +import React, { Component } from "react"; +import { View } from "react-native"; +/** + * ? Local Imports + */ +import styles from "./BottomIcons.style"; +import MiniButton from "../MiniButton/MiniButton"; +import MainIconButtonStyle from "../MainIconButton/MainIconButton.style"; +import MainIconButton from "../MainIconButton/MainIconButton"; + +export default class BottomIcons extends Component { + render() { + const { + mainIcon, + mainIconColor, + mainIconOnPress, + mainIconGradient, + disableFourthIcon, + miniButtonsColor, + disableFirstIcon, + disableThirdIcon, + disableSecondIcon, + mainIconComponent, + firstIconComponent, + thirdIconComponent, + fourthIconComponent, + secondIconComponent + } = this.props; + + return ( + + + {!disableFirstIcon && + (firstIconComponent || ( + + ))} + {!disableSecondIcon && + (secondIconComponent || ( + + ))} + + {mainIconComponent || ( + + )} + + {!disableThirdIcon && + (thirdIconComponent || ( + + ))} + {!disableFourthIcon && + (fourthIconComponent || ( + + ))} + + + ); + } +} + +BottomIcons.defaultProps = { + disableFirstIcon: false, + disableSecondIcon: false, + disableThirdIcon: false, + disableFourthIcon: false +}; diff --git a/lib/src/components/styles/BottomIcons.style.js b/lib/src/components/BottomIcons/BottomIcons.style.js similarity index 60% rename from lib/src/components/styles/BottomIcons.style.js rename to lib/src/components/BottomIcons/BottomIcons.style.js index 5a8e711..4079018 100644 --- a/lib/src/components/styles/BottomIcons.style.js +++ b/lib/src/components/BottomIcons/BottomIcons.style.js @@ -1,5 +1,5 @@ -import { Dimensions, Platform } from "react-native"; -import colors from "./common/colors"; +import { Platform } from "react-native"; +import colors from "../styles/colors"; import { isIPhoneXFamily, ScreenWidth @@ -85,45 +85,6 @@ export default { alignSelf: "flex-end" } }) - }, - mainIconStyle: { - container: { - ...Platform.select({ - ios: { - bottom: 15, - alignItems: "center", - justifyContent: "center" - }, - android: { - bottom: 5, - alignItems: "center", - justifyContent: "center" - } - }) - }, - button: { - ...Platform.select({ - ios: { - width: 70, - height: 70, - borderRadius: 35, - position: "absolute", - shadowColor: colors.theme.light.shadowColor, - shadowOffset: { width: 2, height: 3 }, - shadowOpacity: 0.3, - shadowRadius: 3 - }, - android: { - width: 70, - height: 70, - borderRadius: 35, - position: "relative", - alignItems: "center", - justifyContent: "center", - backgroundColor: colors.theme.light.primary - } - }) - } } } }; diff --git a/lib/src/components/MainIconButton.js b/lib/src/components/MainIconButton/MainIconButton.js similarity index 61% rename from lib/src/components/MainIconButton.js rename to lib/src/components/MainIconButton/MainIconButton.js index efe60ab..55ebae7 100644 --- a/lib/src/components/MainIconButton.js +++ b/lib/src/components/MainIconButton/MainIconButton.js @@ -1,28 +1,14 @@ import React, { Component } from "react"; -import { Platform, View, TouchableOpacity } from "react-native"; +import { View, TouchableOpacity } from "react-native"; import LinearGradient from "react-native-linear-gradient"; import Icon from "react-native-dynamic-vector-icons"; -import colors from "./styles/common/colors"; -import { defaultShadowStyle } from "./styles/common/shared.style"; -import BottomIconsStyle from "./styles/BottomIcons.style"; +/** + * ? Local Imports + */ +import colors from "../styles/colors"; +import styles from "./MainIconButton.style"; +import { defaultShadowStyle } from "../styles/shared.style"; -const styles = { - container: { - position: "relative", - alignItems: "center", - justifyContent: "center", - elevation: 5, - shadowRadius: 3, - shadowOpacity: 0.3, - shadowColor: "#000", - shadowOffset: { width: 0, height: 2 } - }, - iconContainer: { - alignItems: "center", - justifyContent: "center", - marginTop: Platform.OS === "ios" ? 15 : 0 - } -}; const blueGradient = ["rgba(156, 180, 249, 1.0)", "rgba(108, 136, 246, 1.0)"]; export default class MainIconButton extends Component { @@ -39,13 +25,10 @@ export default class MainIconButton extends Component { return ( {mainIcon || ( diff --git a/lib/src/components/MainIconButton/MainIconButton.style.js b/lib/src/components/MainIconButton/MainIconButton.style.js new file mode 100644 index 0000000..2a6e84b --- /dev/null +++ b/lib/src/components/MainIconButton/MainIconButton.style.js @@ -0,0 +1,59 @@ +import { Platform } from "react-native"; +import colors from "../styles/colors"; + +export default { + mainIconStyle: { + container: { + ...Platform.select({ + ios: { + bottom: 15, + alignItems: "center", + justifyContent: "center" + }, + android: { + bottom: 5, + alignItems: "center", + justifyContent: "center" + } + }) + }, + button: { + ...Platform.select({ + ios: { + width: 70, + height: 70, + borderRadius: 35, + position: "absolute", + shadowColor: colors.theme.light.shadowColor, + shadowOffset: { width: 2, height: 3 }, + shadowOpacity: 0.3, + shadowRadius: 3 + }, + android: { + width: 70, + height: 70, + borderRadius: 35, + position: "relative", + alignItems: "center", + justifyContent: "center", + backgroundColor: colors.theme.light.primary + } + }) + } + }, + container: { + position: "relative", + alignItems: "center", + justifyContent: "center", + elevation: 5, + shadowRadius: 3, + shadowOpacity: 0.3, + shadowColor: "#000", + shadowOffset: { width: 0, height: 2 } + }, + iconContainer: { + alignItems: "center", + justifyContent: "center", + marginTop: Platform.OS === "ios" ? 15 : 0 + } +}; diff --git a/lib/src/components/MiniButton.js b/lib/src/components/MiniButton/MiniButton.js similarity index 80% rename from lib/src/components/MiniButton.js rename to lib/src/components/MiniButton/MiniButton.js index c025426..11c013c 100644 --- a/lib/src/components/MiniButton.js +++ b/lib/src/components/MiniButton/MiniButton.js @@ -1,9 +1,12 @@ import React, { Component } from "react"; import { TouchableOpacity, View } from "react-native"; import Icon from "react-native-dynamic-vector-icons"; -import styles from "./styles/MiniButton.style"; -import colors from "./styles/common/colors"; -import { shadowStyle } from "./styles/common/shared.style"; +/** + * ? Local Imports + */ +import colors from "../styles/colors"; +import styles from "./MiniButton.style"; +import { shadowStyle } from "../styles/shared.style"; export default class MiniButton extends Component { render() { diff --git a/lib/src/components/styles/MiniButton.style.js b/lib/src/components/MiniButton/MiniButton.style.js similarity index 100% rename from lib/src/components/styles/MiniButton.style.js rename to lib/src/components/MiniButton/MiniButton.style.js diff --git a/lib/src/components/Shape.js b/lib/src/components/Shape/Shape.js similarity index 69% rename from lib/src/components/Shape.js rename to lib/src/components/Shape/Shape.js index 6883762..5fb4779 100644 --- a/lib/src/components/Shape.js +++ b/lib/src/components/Shape/Shape.js @@ -1,20 +1,18 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { View, Platform } from "react-native"; -import { _shapeStyle, _shadowStyle } from "./styles/Shape.style"; +import { View } from "react-native"; import Androw from "react-native-androw"; +/** + * ? Local Imports + */ +import { _shapeStyle, _shadowStyle } from "./Shape.style"; class Shape extends Component { render() { const { shapeStyle, shapeColor, shapeShadowColor } = this.props; return ( - + ); } diff --git a/lib/src/components/styles/Shape.style.js b/lib/src/components/Shape/Shape.style.js similarity index 96% rename from lib/src/components/styles/Shape.style.js rename to lib/src/components/Shape/Shape.style.js index 8bee3f1..d401239 100644 --- a/lib/src/components/styles/Shape.style.js +++ b/lib/src/components/Shape/Shape.style.js @@ -24,13 +24,13 @@ export function _shapeStyle(backgroundColor) { export function _shadowStyle(shadowColor) { return { ...Platform.select({ - ios:{ + ios: { shadowRadius: 3, shadowOpacity: 0.3, shadowColor: shadowColor, shadowOffset: { width: 0, height: 2 } }, - android:{ + android: { shadowColor: shadowColor, shadowOffset: { width: 0, @@ -40,9 +40,5 @@ export function _shadowStyle(shadowColor) { shadowRadius: 50 } }) - }; } - - - diff --git a/lib/src/components/styles/common/colors.js b/lib/src/components/styles/colors.js similarity index 100% rename from lib/src/components/styles/common/colors.js rename to lib/src/components/styles/colors.js diff --git a/lib/src/components/styles/common/shared.style.js b/lib/src/components/styles/shared.style.js similarity index 100% rename from lib/src/components/styles/common/shared.style.js rename to lib/src/components/styles/shared.style.js diff --git a/package.json b/package.json index 7bfda48..dc79a22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-bottom-bar", - "version": "0.2.2", + "version": "0.3.0", "description": "Fully customizable BottomBar for React Native.", "keywords": [ "react-native",