PeterBaumler
Cadet 1st Year
- Registriert
- Sep. 2023
- Beiträge
- 13
Hallo ich habe dieses Problem hier (siehe Foto) ich habe eine doppelte Homebar am oberen Rand des Bildschirms deshalb wollte ich fragen ob mir möglicherweise jemand helfen kann diese wegzubekommen ich brauche nur eine die oben Home anzeigt.
Das ist meine App.js:
import React from 'react';
import { NavigationContainer } from '@React-navigation/native';
import { createStackNavigator } from '@React-navigation/stack';
import { createBottomTabNavigator } from '@React-navigation/bottom-tabs';
import { FontAwesome5 } from '@expo/vector-icons';
import HomeScreen from './Screens/HomeScreen';
import StatisticsScreen from './Screens/StatisticsScreen';
import InformationScreen from './Screens/InformationScreen';
import SettingsScreen from './Screens/SettingsScreen';
import SelectionScreen from './Screens/SelectionScreen';
import QuantityScreen from './Screens/QuantityScreen';
const Tab = createBottomTabNavigator();
const Stack = createStackNavigator();
const HomeStack = createStackNavigator();
const HomeStackScreen = () => (
<HomeStack.Navigator>
<HomeStack.Screen name="Home" component={HomeScreen} />
<HomeStack.Screen name="Selection" component={SelectionScreen} />
<HomeStack.Screen name="Quantity" component={QuantityScreen} />
</HomeStack.Navigator>
);
const App = () => {
return (
<NavigationContainer>
<Tab.Navigator
initialRouteName="HomeStack" // Ändere den initialRouteName auf "HomeStack"
screenOptions={({ route }) => ({
tabBarActiveTintColor: 'blue',
tabBarInactiveTintColor: 'gray',
tabBarLabelStyle: {
fontSize: 14,
},
tabBarIcon: ({ color, size }) => {
let iconName;
if (route.name === 'HomeStack') { // Ändere den Namen hier entsprechend
iconName = 'home';
} else if (route.name === 'Statistics') {
iconName = 'chart-bar';
} else if (route.name === 'Information') {
iconName = 'info-circle';
} else if (route.name === 'Settings') {
iconName = 'cog';
}
return <FontAwesome5 name={iconName} color={color} size={size} />;
},
})}
<Tab.Screen
name="Home" // Ändere den Namen hier entsprechend
component={HomeStackScreen} // Verwende den HomeStackScreen als Komponente
options={{ tabBarLabel: 'Home' }}
/>
<Tab.Screen
name="Statistics"
component={StatisticsScreen}
options={{ tabBarLabel: 'Statistiken' }}
/>
<Tab.Screen
name="Information"
component={InformationScreen}
options={{ tabBarLabel: 'Informationen' }}
/>
<Tab.Screen
name="Settings"
component={SettingsScreen}
options={{ tabBarLabel: 'Einstellungen' }}
/>
</Tab.Navigator>
</NavigationContainer>
);
};
export default App;
Das ist meine App.js:
import React from 'react';
import { NavigationContainer } from '@React-navigation/native';
import { createStackNavigator } from '@React-navigation/stack';
import { createBottomTabNavigator } from '@React-navigation/bottom-tabs';
import { FontAwesome5 } from '@expo/vector-icons';
import HomeScreen from './Screens/HomeScreen';
import StatisticsScreen from './Screens/StatisticsScreen';
import InformationScreen from './Screens/InformationScreen';
import SettingsScreen from './Screens/SettingsScreen';
import SelectionScreen from './Screens/SelectionScreen';
import QuantityScreen from './Screens/QuantityScreen';
const Tab = createBottomTabNavigator();
const Stack = createStackNavigator();
const HomeStack = createStackNavigator();
const HomeStackScreen = () => (
<HomeStack.Navigator>
<HomeStack.Screen name="Home" component={HomeScreen} />
<HomeStack.Screen name="Selection" component={SelectionScreen} />
<HomeStack.Screen name="Quantity" component={QuantityScreen} />
</HomeStack.Navigator>
);
const App = () => {
return (
<NavigationContainer>
<Tab.Navigator
initialRouteName="HomeStack" // Ändere den initialRouteName auf "HomeStack"
screenOptions={({ route }) => ({
tabBarActiveTintColor: 'blue',
tabBarInactiveTintColor: 'gray',
tabBarLabelStyle: {
fontSize: 14,
},
tabBarIcon: ({ color, size }) => {
let iconName;
if (route.name === 'HomeStack') { // Ändere den Namen hier entsprechend
iconName = 'home';
} else if (route.name === 'Statistics') {
iconName = 'chart-bar';
} else if (route.name === 'Information') {
iconName = 'info-circle';
} else if (route.name === 'Settings') {
iconName = 'cog';
}
return <FontAwesome5 name={iconName} color={color} size={size} />;
},
})}
<Tab.Screen
name="Home" // Ändere den Namen hier entsprechend
component={HomeStackScreen} // Verwende den HomeStackScreen als Komponente
options={{ tabBarLabel: 'Home' }}
/>
<Tab.Screen
name="Statistics"
component={StatisticsScreen}
options={{ tabBarLabel: 'Statistiken' }}
/>
<Tab.Screen
name="Information"
component={InformationScreen}
options={{ tabBarLabel: 'Informationen' }}
/>
<Tab.Screen
name="Settings"
component={SettingsScreen}
options={{ tabBarLabel: 'Einstellungen' }}
/>
</Tab.Navigator>
</NavigationContainer>
);
};
export default App;