diff --git a/.gitignore b/.gitignore index f7532d7d..29141ba8 100644 --- a/.gitignore +++ b/.gitignore @@ -72,4 +72,5 @@ localnotes.txt .yarn/cache ios/*.cer ios/croma.app.*.zip -.yarn/install-state.gz \ No newline at end of file +.yarn/install-state.gz +.vscode/settings.json \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 3c35d6f1..9e26dfee 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1 @@ -{ - "i18n-ally.localesPaths": [ - "locales" - ] -} \ No newline at end of file +{} \ No newline at end of file diff --git a/screens/PalettesScreen.js b/screens/PalettesScreen.js index 416f09e7..26ae0e02 100644 --- a/screens/PalettesScreen.js +++ b/screens/PalettesScreen.js @@ -1,7 +1,13 @@ -import React, { useEffect, useLayoutEffect, useState } from 'react'; -import { ScrollView, StyleSheet, ActivityIndicator } from 'react-native'; +import React, { useEffect, useState } from 'react'; +import { + ScrollView, + StyleSheet, + ActivityIndicator, + View, + TouchableOpacity, + Alert, Text +} from 'react-native'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; -import Icon from 'react-native-vector-icons/Ionicons'; import Color from 'pigment/full'; import { PalettePreviewCard } from '../components/PalettePreviewCard'; import { logEvent, notifyMessage } from '../libs/Helpers'; @@ -109,72 +115,133 @@ const styles = StyleSheet.create({ } }); +// Custom button for the vertical three-dots menu +function ThreeDotsButton({ onPress }) { + return ( + + + + ); +} + +// Custom Tab Bar Component +function CustomTabBar({ state, descriptors, navigation }) { + return ( + + {state.routes.map((route, index) => { + const { options } = descriptors[route.key]; + const label = + options.tabBarLabel !== undefined + ? options.tabBarLabel + : options.title !== undefined + ? options.title + : route.name; + + const isFocused = state.index === index; + + const onPress = () => { + if (route.name === 'ThreeDotsMenu') { + // Handle Three Dots Menu Press + Alert.alert('Menu', 'Three dots menu pressed!'); + } else { + const event = navigation.emit({ + type: 'tabPress', + target: route.key, + canPreventDefault: true + }); + + if (!isFocused && !event.defaultPrevented) { + navigation.navigate(route.name); + } + } + }; + + // Special case for the Three Dots Menu + if (route.name === 'ThreeDotsMenu') { + return ; + } + + return ( + + + {label} + + ); + })} + + ); +} + const Tab = createBottomTabNavigator(); export default function PalettesTabNavigator({ navigation, route }) { const hexColor = route.params.hexColor; - useLayoutEffect(() => { - navigation.setOptions({ title: hexColor }); - }, [hexColor, navigation]); return ( - ({ - headerShown: false, - tabBarIcon: ({ focused, color, size }) => { - if (route.name === 'Color Theory') { - return ( - - ); - } else if (route.name === 'AI') { - return ( - - ); + + } // Use the custom tab bar + screenOptions={{ + headerShown: false, + tabBarStyle: { + backgroundColor: '#ffffff', + borderTopWidth: 0, + elevation: 10, + shadowColor: '#000', + shadowOffset: { width: 0, height: 5 }, + shadowOpacity: 0.1, + shadowRadius: 10, + paddingBottom: 10, + paddingTop: 10, + height: 60 + }, + tabBarActiveTintColor: Colors.primary, + tabBarInactiveTintColor: Colors.gray, + tabBarLabelStyle: { + fontSize: 12, + fontWeight: '600' } - }, - tabBarStyle: { - backgroundColor: '#ffffff', - borderTopWidth: 0, - elevation: 10, - shadowColor: '#000', - shadowOffset: { width: 0, height: 5 }, - shadowOpacity: 0.1, - shadowRadius: 10, - paddingBottom: 10, - paddingTop: 10, - height: 60 - }, - tabBarActiveTintColor: Colors.primary, - tabBarInactiveTintColor: Colors.gray, - tabBarLabelStyle: { - fontSize: 12, // Slightly larger font size for better readability - fontWeight: '600' // Bold text for the labels - } - })}> - - - + }}> + + + + + ); }