im using react navigation 3 and also using
this.props.navigation.navigate(item.navigationPath)
to navigate through pages
the problem is when i click the button in navbar to go back it doesn't go back
i want it to go back 1 step but it do nothing
here is the back component
class NavigationBack extends Component {
toggleDrawer = () => {
this.props.navigation.goBack()
};
render() {
return (
<View style={{ flexDirection: 'row' }}>
<TouchableOpacity onPress={this.toggleDrawer.bind(this)}>
<Image
source={require('./image/drawer.png')}
style={{ width: 25, height: 25, marginLeft: 5 }}
/>
</TouchableOpacity>
</View>
);
}
}
Also when im in the Home->Category->Single-Category
and i press the hardware back button it take me to Home instead of Category
here is a link to snack
https://snack.expo.io/#ov3rcontrol/navi
I tried your code and made some modification. can you check this code ? is this what you need ?
/*Example of Navigation Drawer with Sectioned Menu*/
import React, { Component } from 'react';
import {
StyleSheet,
Platform,
View,
Text,
Image,
TouchableOpacity,
YellowBox,
Dimensions,
Button,
} from 'react-native';
//Import required react-navigation component
import {
createDrawerNavigator,
createStackNavigator,
createAppContainer,
} from 'react-navigation';
//Import all the screens
import Screen1 from './pages/Screen1';
import Screen2 from './pages/Screen2';
import Screen3 from './pages/Screen3';
import category from './pages/category';
import singleCategory from './pages/singleCategory';
//Import custom Drawer / sidebar
import SideMenu from './sidemenu';
//Navigation Drawer Structure for all screen
class NavigationDrawerStructure extends Component {
toggleDrawer = () => {
this.props.navigationProps.toggleDrawer();
};
render() {
return (
<View style={{ flexDirection: 'row' }}>
<TouchableOpacity onPress={this.toggleDrawer.bind(this)}>
{/*Donute Button Image */}
<Image
source={require('./image/drawer.png')}
style={{ width: 25, height: 25, marginLeft: 5 }}
/>
</TouchableOpacity>
</View>
);
}
}
class NavigationBack extends Component {
toggleDrawer = () => {
this.props.navigation.goBack()
};
render() {
return (
<View style={{ flexDirection: 'row' }}>
<TouchableOpacity onPress={this.toggleDrawer.bind(this)}>
<Image
source={require('./image/drawer.png')}
style={{ width: 25, height: 25, marginLeft: 5 }}
/>
</TouchableOpacity>
</View>
);
}
}
//Stack Navigator for the First Option of Navigation Drawer
const FirstActivity_StackNavigator = createStackNavigator({
//All the screen from the First Option will be indexed here
First: {
screen: Screen1,
navigationOptions: ({ navigation }) => ({
title: 'Demo Screen 1',
headerLeft: <NavigationDrawerStructure navigationProps={navigation} />,
headerStyle: {
backgroundColor: '#FF9800',
},
headerTintColor: '#fff',
}),
},
});
//Stack Navigator for the Second Option of Navigation Drawer
const Screen2_StackNavigator = createStackNavigator({
//All the screen from the Second Option will be indexed here
Second: {
screen: Screen2,
navigationOptions: ({ navigation }) => ({
title: 'Demo Screen 2',
headerLeft: <NavigationDrawerStructure navigationProps={navigation} />,
headerStyle: {
backgroundColor: '#FF9800',
},
headerTintColor: '#fff',
}),
},
});
//Stack Navigator for the Third Option of Navigation Drawer
const Screen3_StackNavigator = createStackNavigator({
//All the screen from the Third Option will be indexed here
Third: {
screen: Screen3,
navigationOptions: ({ navigation }) => ({
title: 'Demo Screen 3',
headerLeft: <NavigationDrawerStructure navigationProps={navigation} />,
headerStyle: {
backgroundColor: '#FF9800',
},
headerTintColor: '#fff',
}),
},
});
const category_nav = createStackNavigator({
//All the screen from the Third Option will be indexed here
cat: {
screen: category,
navigationOptions: ({ navigation }) => ({
title: 'Makeup Artist',
headerLeft: <NavigationBack navigationProps={navigation} />,
headerStyle: {
backgroundColor: 'grey',
},
headerTintColor: '#fff',
}),
},
});
const single_category_nav = createStackNavigator({
//All the screen from the Third Option will be indexed here
single_cat: {
screen: singleCategory,
navigationOptions: ({ navigation }) => ({
title: 'Mahmoud Makup',
headerLeft: <NavigationBack navigationProps={navigation} />,
headerStyle: {
backgroundColor: 'grey',
},
headerTintColor: '#fff',
}),
},
});
//Drawer Navigator for the Navigation Drawer / Sidebar
const Drawers = createStackNavigator({
NavScreen1: { screen: FirstActivity_StackNavigator },
NavScreen2: { screen: Screen2_StackNavigator },
NavScreen3: { screen: Screen3_StackNavigator },
category: {screen: category_nav},
single_category: {screen: single_category_nav}
},{
headerMode: 'none'
})
const DrawerStack = createDrawerNavigator(
{
drawerScreens: Drawers
},
{
contentComponent: (props) => (
<SideMenu {...props}/>
),
drawerWidth: Dimensions.get('window').width - 120,
}
);
const RootStack = createStackNavigator({
root: DrawerStack
},{
headerMode: "none"
});
export default createAppContainer(RootStack);
Related
When I launch my app on android I get that error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Here is my Navigation.js
import React from 'react'
import { createStackNavigator } from 'react-navigation-stack'
import { Dimensions } from 'react-native'
import {createAppContainer, } from 'react-navigation';
import { createBottomTabNavigator } from 'react-navigation-tabs'
import Home from '../screens/Home'
import AddCollege from '../screens/AddCollege'
import ViewCollege from '../screens/ViewCollege'
import ViewSchool from '../screens/ViewSchool'
import AddSchool from '../screens/AddSchool'
import Profile from '../screens/Profile'
import Dashboard from '../screens/Dashboard'
import Settings from '../screens/Settings'
import ManageProfile from '../screens/ManageProfile'
import { Ionicons } from "react-native-vector-icons";
const HEIGHT = Dimensions.get('window').height
const WIDTH = Dimensions.get('window').width
const HomeStack = createStackNavigator(
{
Home: Home,
AddCollege: AddCollege,
ViewCollege: ViewCollege,
ViewSchool: ViewSchool,
AddSchool: AddSchool,
ManageProfile: ManageProfile
},
{
defaultNavigationOptions: {
headerStyle: {
backgroundColor: 'black',
height: HEIGHT / 9
},
headerTintColor: '#fff',
},
}
);
const ProfileStack = createStackNavigator(
{
Profile: Profile,
},
{
defaultNavigationOptions: {
headerTitleStyle: {
textAlign: 'center',
},
headerStyle: {
backgroundColor: 'black',
height: HEIGHT / 9
//marginTop: 24 ,
},
headerTintColor: '#fff',
title: 'Profile',
},
}
);
const DashboardStack = createStackNavigator(
{
Dashboard: Dashboard,
},
{
defaultNavigationOptions: {
title: 'Dashboard',
headerStyle: {
backgroundColor: 'black',
height: HEIGHT / 9
},
headerTintColor: '#fff',
},
}
);
const SettingsStack = createStackNavigator(
{
Settings: Settings,
},
{
defaultNavigationOptions: {
title: 'Settings ',
headerStyle: {
backgroundColor: 'black',
height:HEIGHT / 9
},
headerTitleStyle: {
color: '#fff',
},
},
},
);
const MainApp = createBottomTabNavigator({
Home: {
screen: HomeStack ,
navigationOptions: {
tabBarLabel: 'Home',
tabBarIcon: ({ tintColor }) => (
<Ionicons name="md-home" color={tintColor} size={30} />
)
}
},
Profile: {
screen: ProfileStack,
navigationOptions: {
tabBarLabel: 'Profile',
tabBarIcon: ({ tintColor }) => (
<Ionicons name="md-user" color={tintColor} size={30} />
)
}
},
Dashboard: {
screen: DashboardStack,
navigationOptions: {
tabBarLabel: 'Dashboard',
tabBarIcon: ({ tintColor }) => (
<Ionicons name="md-clipboard" color={tintColor} size={30} />
)
}
} ,
Settings: {
screen : SettingsStack ,
navigationOptions: {
tabBarLabel: 'Settings',
tabBarIcon: ({ tintColor }) => (
<Ionicons name="md-settings" color={tintColor} size={30} />
)
}
}
},
{
tabBarOptions: {
labelStyle: {
fontSize: 12,
padding: 0,
margin: 0
},
activeTintColor: 'red',
inactiveTintColor: 'white',
style:{height: HEIGHT / 10, backgroundColor: 'black' },
showIcon: true,
padding: 0,
margin: 0
}
});
export default createAppContainer(MainApp);
It's because of the wrong import from react-native-vector-icons
You should do it in this way
import Ionicons from "react-native-vector-icons/Ionicons";
or for other fonts
import FontAwesome from 'react-native-vector-icons/FontAwesome';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
Also check your other components (like your screens) that are exported as default!
Could you please help me on this small issue.
I am very very new to React native and here i am training in learn react navigation. My problem is Drawer navigator is not working when i try to swap from left to right. But bottom navigator is working. Any idea whats wrong with this please.
Also: if you can please send me a good sample to learn this area.
I have some samples, but most of the samples are outdated.
MyCode:
import React from 'react';
import {TouchableOpacity, View, Text, Image} from 'react-native';
import {createAppContainer, createSwitchNavigator} from 'react-navigation';
import {createStackNavigator} from 'react-navigation-stack';
import {createBottomTabNavigator} from 'react-navigation-tabs';
import {createDrawerNavigator} from 'react-navigation-drawer';
import HomeScreen2 from '../screens/HomeScreen2';
import HomeScreen from '../screens/HomeScreen';
import Setup from '../screens/Setup';
const HomeStack = createStackNavigator(
{
//Defination of Navigaton from home screen
Home: { screen: HomeScreen },
// Details: { screen: ProfileScreen },
},
{
defaultNavigationOptions: {
//Header customization of the perticular Screen
headerStyle: {
backgroundColor: '#42f44b',
},
headerTintColor: '#FFFFFF',
title: 'Home',
//Header title
},
}
);
const SettingsStack = createStackNavigator(
{
//Defination of Navigaton from setting screen
Settings: { screen: Setup },
},
{
defaultNavigationOptions: {
//Header customization of the perticular Screen
headerStyle: {
backgroundColor: '#42f44b',
},
headerTintColor: '#FFFFFF',
title: 'Settings',
//Header title
},
}
);
const TabMain = createBottomTabNavigator(
{
TAB1: HomeStack,
TAB2: SettingsStack,
},
{
initialRouteName: 'TAB1',
}
)
const DrawHomeView = createStackNavigator({
HomeV: {screen: HomeScreen2}},
{
headerMode: 'float',
navigationOptions: ({navigation}) => ({
headerStyle: {
backgroundColor: 'rgb(255,45,85)',
paddingLeft: 10,
paddingRight: 10
},
title: 'Map View',
headerTintColor: 'white',
headerLeft: <View>
<TouchableOpacity
onPress={() => {
if (navigation.state.isDrawerOpen === false) {
navigation.dispatch(DrawerActions.openDrawer());
} else {
navigation.dispatch(DrawerActions.closeDrawer());
}
}}>
<Text>Menu</Text>
</TouchableOpacity>
</View>
})
});
const DrawSettingsView = createStackNavigator({
SettingsV: {screen: Setup}},
{
headerMode: 'float',
navigationOptions: ({navigation}) => ({
headerStyle: {
backgroundColor: 'rgb(255,45,85)',
paddingLeft: 10,
paddingRight: 10
},
title: 'Map View',
headerTintColor: 'white',
headerLeft: <View>
<TouchableOpacity
onPress={() => {
if (navigation.state.isDrawerOpen === false) {
navigation.dispatch(DrawerActions.openDrawer());
} else {
navigation.dispatch(DrawerActions.closeDrawer());
}
}}>
<Text>Menu</Text>
</TouchableOpacity>
</View>
})
});
const TabMain2 = createDrawerNavigator(
{
TAB3: DrawHomeView,
TAB4: DrawSettingsView,
},
{
initialRouteName: 'TAB3',
}
)
export default createAppContainer(createSwitchNavigator(
{
Sub1: TabMain,
Sub2: TabMain2,
},
{
initialRouteName: 'Sub2',
}
));
Okay. After some dabbling with your code and the docs : https://reactnavigation.org/docs/nesting-navigators/
and please read the docs and try their examples as they are excellent descriptive and available for real time execution on snack.
For the second part of the question, i put together an example for you:
import * as React from 'react';
import { Button, View, Text } from 'react-native';
import { createDrawerNavigator } from '#react-navigation/drawer';
import { NavigationContainer } from '#react-navigation/native';
import { createBottomTabNavigator } from '#react-navigation/bottom-tabs';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
//Import necessary components
//Create Screens, Dummy screens in this case.
function NotificationsScreen({ navigation }) {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Button onPress={() => navigation.goBack()} title="Go back home" />
</View>
);
}
function Feed ({ navigation, route }) {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text style={{fontSize: 40}}>Feed </Text>
</View>
);}
function Home ({ navigation, route }) {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text style={{fontSize: 40}}> Home </Text>
</View>
);}
// Here is your questions answer, just create a Bottom Navigator
// and a Drawer Navigator and nest them in each other after declaring your
// screens.
const Tab = createBottomTabNavigator();
const Drawer = createDrawerNavigator();
function HomeScreen({ navigation }) {
return (
<Tab.Navigator>
//Put your Tab screens here.
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="Feed" component={Feed} />
</Tab.Navigator>
);
}
export default function App() {
return (
// For the main export create a navigation container and declare the
// Drawer Navigator inside the main navigation container, then use that to
// To Access your Tab navigator "HomeScreen" and put whatever else you
// Want in your Drawer Navigator.
<NavigationContainer>
<Drawer.Navigator initialRouteName="Home">
<Drawer.Screen name="Home" component={HomeScreen} />
<Drawer.Screen name="Notifications" component={NotificationsScreen} />
</Drawer.Navigator>
</NavigationContainer>
);
}
Explanation: You are only allowed to nest navigators within each other and not within the main navigation container.
This code has been tested using expo-cli 3.18.4
I'm developing an app using React-Native (Expo) with React-Navigation module. I'm struggling to get what I want for "createBottomTabBar" styling and working on a custom tab bar component.
Where can I learn/find examples similar to this? Is my code correct?
I am using this: Border bottom on Bottom Navigation in React Native and this video: https://www.youtube.com/watch?v=w24FE9PZpzk
But I don't know how to get any further.
Router/index.js
import { createSwitchNavigator,createStackNavigator, createBottomTabNavigator, createDrawerNavigator, createAppContainer } from 'react-navigation';
import { Home, SignUpScreen, LoginScreen, ForgotPasswordScreen, Setting, AboutScreen, ScanFlight, FlightDetails, ChatList, ChatMessages, FriendList, exploreProfile, myProfile, FlightAdd, Notifications,Achievements } from '../Screens';
// Tab bar Custom Component
import appBottomTabs from '../NavigationLayout/bottomTabBar'
// Bottom Tab navigation
const MainTabNavigator = createBottomTabNavigator({
Home,
ChatList,
ScanFlight
}, {
tabBarOptions: {
activeTintColor: "#6200EE",
inactiveTintColor: "#858585",
style: {
paddingVertical: 10,
backgroundColor: "#fff",
border: '#ffffff'
},
labelStyle: {
fontSize: 14,
lineHeight: 16,
fontFamily: "Rubik_Regular"
},
tabBarPosition: "bottom",
tabBarComponent: appBottomTabs,
animationEnabled: true,
swipeEnabled: true,
unmountInactiveRoutes: true
}
});
// Drawer Navigation
const appDrawerNavigator = createDrawerNavigator({
Home: {screen: MainTabNavigator},
Login: LoginScreen,
SignUp: SignUpScreen,
ForgotPassword: ForgotPasswordScreen,
Settings: Setting,
About: AboutScreen,
FlightDetails: FlightDetails,
FlightAdd: FlightAdd,
}, {
unmountInactiveRoutes: true
});
const AppLoginNavigator = createSwitchNavigator({
LoginScreen,
ForgotPasswordScreen,
appDrawerNavigator: {
screen: appDrawerNavigator
},
appStackNavigator: {
screen: appStackNavigator
}
});
const AppContainer = createAppContainer(AppLoginNavigator);
class App extends Component {
render() {
return (
<AppContainer />
);
}
}
export default App;
NavigationLayout/bottomTabBar.js
import React, {Component} from 'react'
import {View, TouchableWithoutFeedback, Text, StyleSheet} from 'react-native'
class appBottomTabs extends Component {
constructor(){
super()
this.state = {
routeNameSelected:'Home'
}
}
onPressTab(routeName){
this.props.jumpTo(routeName)
this.setState({
routeNameSelected:routeName
})
}
render() {
const {navigation} = this.props;
const {routes} = navigation.state;
return (
<View style={styles.tabbar}>
{routes && routes.map((route, index) => {
return (
<TouchableWithoutFeedback
key={route.key}
style={styles.tab}
onPress={() => this.onPressTab(route.routeName)}
>
</TouchableWithoutFeedback>
);
})}
</View>
)
}
}
export default appBottomTabs;
This is the layout I'm aiming to achieve: https://postimg.cc/Mfc5HxPs
with the active link having bigger font size and a border bottom.
So you need to use defaultNavigationOptions in createBottomTabNavigator.
defaultNavigationOptions takes in a function/react component where you can return you component.
For example
const renderNav = (routeName, name, tintColor, focused) => (
<View style={{flex: 1, alignItems: 'center', borderBottomColor: focused ? tintColor: '', borderBottomWidth: focused ? 4 : 0}}>
<Icon name={name} color={tintColor} size={12} style={{paddingBottom: 4, paddingTop: 10}} />
<Text style={{paddingBottom: 8}}>{routeName}</Text>
</View>
)
const customTabs = ({ navigation }) => ({
tabBarIcon: ({ focused, horizontal, tintColor }) => {
const { routeName } = navigation.state;
if (routeName === 'Profile') {
return renderNav(routeName, 'user', tintColor, focused);
} else if (routeName === 'Home') {
return renderNav(routeName, 'home', tintColor, focused);
} else if (routeName === 'History') {
return renderNav(routeName, 'history', tintColor, focused);
} else if (routeName === 'Cart') {
return renderNav(routeName, 'shopping-cart', tintColor, focused);
}
}
});
const DashboardTabNav = createBottomTabNavigator({
Profile: {
screen: ProfileScreen
},
Home: Dashboard,
History: SettingsScreen,
Cart: CartScreen
},
{
defaultNavigationOptions: customTabs,
animationEnabled: true,
swipeEnabled: true,
tabBarPosition: 'bottom',
initialRouteName: 'Cart',
tabBarOptions: {
activeTintColor: '#6C1D7C',
inactiveTintColor: 'rgba(0,0,0,0.6)',
showLabel: false,
style:{
shadowColor: 'rgba(58,55,55,0.1)',
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 1,
shadowRadius: 15,
elevation: 3,
borderTopColor: 'transparent',
backgroundColor:'#fff',
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
height: 50
},
activeTabStyle: {
backgroundColor: 'white',
borderBottomWidth: 4,
borderColor: '#6C1D7C'
}
},
});
im using the Material-Bottom-Tab-Navigatior and would like to get a transparent bar background however my result atm looks like this
This is the code
import React from 'react';
import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs';
import Icon from 'react-native-vector-icons/Feather';
import HomePage from '../components/whatsOn/HomePage';
import ComingSoon from '../components/comingSoon/ComingSoon';
import Favourites from '../components/favourites/Favourites';
import config from '../static/config.json';
import texts from '../static/texts.json';
const { gradient } = config.colors;
const { ComingSoonTitle, HomeTitle, FavouritesTitle } = texts.Tabs;
const lang = config.language;
export const TabStack = createMaterialBottomTabNavigator({
comingSoon: {
screen: ComingSoon,
activeTintColor: gradient.primary,
navigationOptions: {
tabBarColor: 'transparent',
tabBarLabel: ComingSoonTitle[lang],
tabBarIcon: ({ tintColor }) => (<Icon name="calendar" color={tintColor} size={24} />),
},
},
whatsOn: {
screen: HomePage,
activeTintColor: gradient.primary,
navigationOptions: {
tabBarColor: 'transparent',
tabBarLabel: HomeTitle[lang],
tabBarIcon: ({ tintColor }) => (<Icon name="film" color={tintColor} size={24} />),
},
},
favourites: {
screen: Favourites,
activeTintColor: gradient.primary,
navigationOptions: {
tabBarColor: 'transparent',
tabBarLabel: FavouritesTitle[lang],
tabBarIcon: ({ tintColor }) => (<Icon name="star" color={tintColor} size={24} />),
},
},
}, {
shifting: true,
initialRouteName: 'whatsOn',
order: ['comingSoon', 'whatsOn', 'favourites'],
tabBarPosition: 'bottom',
});
this TabStack is nested inside this stack:
export const HomeStack = createStackNavigator({
Tabs: {
screen: TabStack,
navigationOptions: {
title: 'Compeso',
header: props => <CustomHeader {...props} />,
headerStyle: {
backgroundColor: 'transparent',
},
headerTitleStyle: {
fontSize: 24,
fontWeight: '500',
color: colors.typography,
},
headerRight: MenuIcon,
headerLeft: SearchIcon,
animationEnabled: true,
},
},
Drawer: {
screen: MoreInfromation,
},
}, {
initialRouteName: 'Tabs',
cardStyle: { backgroundColor: 'transparent' },
});
the HomeStack is nested in a switchNavigator
export default class Router extends Component {
render() {
return (
<MainStack />
);
}
}
const MainStack = createSwitchNavigator({
Auth: LoginStack,
Home: HomeStack,
},
{
initialRouteName: 'Home',
});
This MainStack is getting rendered in my App.js
I put this tab navigator into a stack navigator and each component that gets displayed shows a scroll view with a height of 815 pixels to make sure the background is behind the bar.
Can someone advice ?
Thanks in advance
You need to include barStyle.
So, for transparent the style will be something like this:
barStyle: {backgroundColor:'transparent'}
In your code it will look something like this(included at bottom).
export const TabStack = createMaterialBottomTabNavigator({
comingSoon: {
...
},
...
}, {
shifting: true,
initialRouteName: 'whatsOn',
order: ['comingSoon', 'whatsOn', 'favourites'],
tabBarPosition: 'bottom',
barStyle: {backgroundColor:'transparent'}
});
I want to create a drawer. For each screen accessed through the drawer I want to show the same header I am actually customizing on WelcomeContainer AppNavigator. The drawer should overlap the header. The problem is that the header appear only on the home screen: If I click on the the category menu, the drawer disappear. I even tried to copy the header code and past it in the category screen and nothing appeared. This is my code
const AppNavigator = StackNavigator({
Home: {
screen: WelcomeContainer,
navigationOptions: ({navigation}) => ({
headerLeft:
<Icon name="menu" color='#5c72b0' size={35} style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems:'center',
paddingLeft:10 }} onPress={ () => navigation.navigate('DrawerOpen') } />,
headerRight:
<Icon name="settings" color='#5c72b0' size={25} style={{ alignItems:'center', paddingRight:10 }}
onPress={ () => navigation.navigate('Settings', {title: I18n.t('settings.title') }) } /> })
},
Settings: {
screen: SettingsContainer,
navigationOptions: ({navigation}) => ({
title: navigation.state.params.title
})
},
About: {
screen: About,
navigationOptions: ({navigation}) => ({
title: navigation.state.params.title
})
}
})
const AppDrawer = DrawerNavigator(
{
Home: {
path: '/',
screen: AppNavigator,
},
Category: {
path: '/sent',
screen: CategoryContainer,
},
},
{
initialRouteName: 'Home',
contentOptions: {
activeTintColor: '#e91e63',
},
}
);
Could you please help me solve the problem?