Provide Icons to React Stack NavigationReact Navigation with Redux - StackNavigator Load Other Screen Content in BackgroundShow splash screen before show main screen in react native without using 3rd party libraryReact Navigation Redux Authentication Keeps StackingNot able to access parent stack routes from nested stack navigatorReact-Navigation: Navigate screen when DeclaredHow to push a new scene using react-navigation?React Native Navigation invoke all screens componentDidMount/componentWillMount when navigated to Home after loginHide parent's navigation header from the nested navigatorBottom tab bar not showing iconsHow to add createBottomTabNavigator to same screen with createStackNavigator

What is this opening trap called, and how should I play afterwards? How can I refute the gambit, and play if I accept it?

Why does the A-4 Skyhawk sit nose-up when on ground?

What is this particular type of chord progression, common in classical music, called?

Why would people reject a god's purely beneficial blessing?

Analog is Obtuse!

Are neural networks the wrong tool to solve this 2D platformer/shooter game? Is there a proven way to frame this problem to a neural network?

Is there any reason to avoid sunglasses with blue lenses?

How to positively portray high and mighty characters?

How many satellites can stay in a Lagrange point?

Ending: accusative or not?

Does anycast addressing add additional latency in any way?

Averting Real Women Don’t Wear Dresses

Why do some games show lights shine through walls?

Is there a maximum distance from a planet that a moon can orbit?

Links to webpages in books

Alphabet completion rate

Layout of complex table

Going to get married soon, should I do it on Dec 31 or Jan 1?

Mount a folder with a space on Linux

Putting out of focus command for LaTeX/fuzzying the resulting pdf

Declining an offer to present a poster instead of a paper

When is it ok to add filler to a story?

Find smallest index that is identical to the value in an array

Can a US President have someone sent to prison?



Provide Icons to React Stack Navigation


React Navigation with Redux - StackNavigator Load Other Screen Content in BackgroundShow splash screen before show main screen in react native without using 3rd party libraryReact Navigation Redux Authentication Keeps StackingNot able to access parent stack routes from nested stack navigatorReact-Navigation: Navigate screen when DeclaredHow to push a new scene using react-navigation?React Native Navigation invoke all screens componentDidMount/componentWillMount when navigated to Home after loginHide parent's navigation header from the nested navigatorBottom tab bar not showing iconsHow to add createBottomTabNavigator to same screen with createStackNavigator






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am trying to assign icons to the bottom navigation, but I have created stack navigation and I am rendering them to bottom navigation. Please help me out as I am new to React Native. And I do not want to use createMaterialBottomNavigator



import React from "react";
import createStackNavigator, createAppContainer, createBottomTabNavigator from "react-navigation";
import Icon from "native-base";
import DoctorHome from "../containers/Home/DoctorHome/DoctorHome";
import Appointments from "../containers/DoctorFlow/Appointments/Appointments";
import EditProfile from "../containers/DoctorFlow/EditProfile/EditProfile";
import ViewClinic from "../containers/DoctorFlow/ViewClinic/ViewClinic";
import AddClinic from "../containers/DoctorFlow/AddClinic/AddClinic";
import Profile from "../containers/DoctorFlow/Profile/Profile";
import Proffession from "../containers/DoctorFlow/Profile/Proffession";
import Login from "../containers/Login/Login";
import SignUp from "../containers/SignUp/SignUp";
// import Splash from "../containers/SplashScreen";
import
View,
Image,
Touchable,
TouchableHighlight,
TouchableNativeFeedback,
Platform
from "react-native";

const HomeStack = createStackNavigator (
Home: DoctorHome,
Appointments: Appointments,
EditProfile: EditProfile
);
const ClinicStack = createStackNavigator (
Clinic: ViewClinic,
AddClinic: AddClinic
);
const ProfileStack = createStackNavigator (
Profile: Profile,
EditProfile: EditProfile,
Proffession: Proffession
);
const LoginStack = createStackNavigator (
Login: Login,
SignUp: SignUp
);
const MainNavigator = createBottomTabNavigator(
Home: HomeStack,
Clinic: ClinicStack,
Profile: ProfileStack,
Login: LoginStack
);

export const AppNavigator = createAppContainer(MainNavigator);









share|improve this question






























    0















    I am trying to assign icons to the bottom navigation, but I have created stack navigation and I am rendering them to bottom navigation. Please help me out as I am new to React Native. And I do not want to use createMaterialBottomNavigator



    import React from "react";
    import createStackNavigator, createAppContainer, createBottomTabNavigator from "react-navigation";
    import Icon from "native-base";
    import DoctorHome from "../containers/Home/DoctorHome/DoctorHome";
    import Appointments from "../containers/DoctorFlow/Appointments/Appointments";
    import EditProfile from "../containers/DoctorFlow/EditProfile/EditProfile";
    import ViewClinic from "../containers/DoctorFlow/ViewClinic/ViewClinic";
    import AddClinic from "../containers/DoctorFlow/AddClinic/AddClinic";
    import Profile from "../containers/DoctorFlow/Profile/Profile";
    import Proffession from "../containers/DoctorFlow/Profile/Proffession";
    import Login from "../containers/Login/Login";
    import SignUp from "../containers/SignUp/SignUp";
    // import Splash from "../containers/SplashScreen";
    import
    View,
    Image,
    Touchable,
    TouchableHighlight,
    TouchableNativeFeedback,
    Platform
    from "react-native";

    const HomeStack = createStackNavigator (
    Home: DoctorHome,
    Appointments: Appointments,
    EditProfile: EditProfile
    );
    const ClinicStack = createStackNavigator (
    Clinic: ViewClinic,
    AddClinic: AddClinic
    );
    const ProfileStack = createStackNavigator (
    Profile: Profile,
    EditProfile: EditProfile,
    Proffession: Proffession
    );
    const LoginStack = createStackNavigator (
    Login: Login,
    SignUp: SignUp
    );
    const MainNavigator = createBottomTabNavigator(
    Home: HomeStack,
    Clinic: ClinicStack,
    Profile: ProfileStack,
    Login: LoginStack
    );

    export const AppNavigator = createAppContainer(MainNavigator);









    share|improve this question


























      0












      0








      0








      I am trying to assign icons to the bottom navigation, but I have created stack navigation and I am rendering them to bottom navigation. Please help me out as I am new to React Native. And I do not want to use createMaterialBottomNavigator



      import React from "react";
      import createStackNavigator, createAppContainer, createBottomTabNavigator from "react-navigation";
      import Icon from "native-base";
      import DoctorHome from "../containers/Home/DoctorHome/DoctorHome";
      import Appointments from "../containers/DoctorFlow/Appointments/Appointments";
      import EditProfile from "../containers/DoctorFlow/EditProfile/EditProfile";
      import ViewClinic from "../containers/DoctorFlow/ViewClinic/ViewClinic";
      import AddClinic from "../containers/DoctorFlow/AddClinic/AddClinic";
      import Profile from "../containers/DoctorFlow/Profile/Profile";
      import Proffession from "../containers/DoctorFlow/Profile/Proffession";
      import Login from "../containers/Login/Login";
      import SignUp from "../containers/SignUp/SignUp";
      // import Splash from "../containers/SplashScreen";
      import
      View,
      Image,
      Touchable,
      TouchableHighlight,
      TouchableNativeFeedback,
      Platform
      from "react-native";

      const HomeStack = createStackNavigator (
      Home: DoctorHome,
      Appointments: Appointments,
      EditProfile: EditProfile
      );
      const ClinicStack = createStackNavigator (
      Clinic: ViewClinic,
      AddClinic: AddClinic
      );
      const ProfileStack = createStackNavigator (
      Profile: Profile,
      EditProfile: EditProfile,
      Proffession: Proffession
      );
      const LoginStack = createStackNavigator (
      Login: Login,
      SignUp: SignUp
      );
      const MainNavigator = createBottomTabNavigator(
      Home: HomeStack,
      Clinic: ClinicStack,
      Profile: ProfileStack,
      Login: LoginStack
      );

      export const AppNavigator = createAppContainer(MainNavigator);









      share|improve this question
















      I am trying to assign icons to the bottom navigation, but I have created stack navigation and I am rendering them to bottom navigation. Please help me out as I am new to React Native. And I do not want to use createMaterialBottomNavigator



      import React from "react";
      import createStackNavigator, createAppContainer, createBottomTabNavigator from "react-navigation";
      import Icon from "native-base";
      import DoctorHome from "../containers/Home/DoctorHome/DoctorHome";
      import Appointments from "../containers/DoctorFlow/Appointments/Appointments";
      import EditProfile from "../containers/DoctorFlow/EditProfile/EditProfile";
      import ViewClinic from "../containers/DoctorFlow/ViewClinic/ViewClinic";
      import AddClinic from "../containers/DoctorFlow/AddClinic/AddClinic";
      import Profile from "../containers/DoctorFlow/Profile/Profile";
      import Proffession from "../containers/DoctorFlow/Profile/Proffession";
      import Login from "../containers/Login/Login";
      import SignUp from "../containers/SignUp/SignUp";
      // import Splash from "../containers/SplashScreen";
      import
      View,
      Image,
      Touchable,
      TouchableHighlight,
      TouchableNativeFeedback,
      Platform
      from "react-native";

      const HomeStack = createStackNavigator (
      Home: DoctorHome,
      Appointments: Appointments,
      EditProfile: EditProfile
      );
      const ClinicStack = createStackNavigator (
      Clinic: ViewClinic,
      AddClinic: AddClinic
      );
      const ProfileStack = createStackNavigator (
      Profile: Profile,
      EditProfile: EditProfile,
      Proffession: Proffession
      );
      const LoginStack = createStackNavigator (
      Login: Login,
      SignUp: SignUp
      );
      const MainNavigator = createBottomTabNavigator(
      Home: HomeStack,
      Clinic: ClinicStack,
      Profile: ProfileStack,
      Login: LoginStack
      );

      export const AppNavigator = createAppContainer(MainNavigator);






      react-native react-navigation react-navigation-stack






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 11:55









      Firu

      9588 silver badges26 bronze badges




      9588 silver badges26 bronze badges










      asked Mar 25 at 10:55









      TheReactorTheReactor

      146 bronze badges




      146 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Refer the code below to assign icons to bottom navigation.



           import React from 'react';
          import Text, View from 'react-native';
          import Ionicons from '@expo/vector-icons'; // 6.2.2
          import createBottomTabNavigator, createAppContainer from 'react-navigation';

          class HomeScreen extends React.Component
          render()
          return (
          <View style= flex: 1, justifyContent: 'center', alignItems: 'center' >
          <Text>Home!</Text>
          </View>
          );



          class SettingsScreen extends React.Component
          render()
          return (
          <View style= flex: 1, justifyContent: 'center', alignItems: 'center' >
          <Text>Settings!</Text>
          </View>
          );



          class IconWithBadge extends React.Component
          render()
          const name, badgeCount, color, size = this.props;
          return (
          <View style= width: 24, height: 24, margin: 5 >
          <Ionicons name=name size=size color=color />
          badgeCount > 0 && (
          <View
          style=
          // /If you're using react-native < 0.57 overflow outside of the parent
          // will not work on Android, see https://git.io/fhLJ8
          position: 'absolute',
          right: -6,
          top: -3,
          backgroundColor: 'red',
          borderRadius: 6,
          width: 12,
          height: 12,
          justifyContent: 'center',
          alignItems: 'center',
          >
          <Text style= color: 'white', fontSize: 10, fontWeight: 'bold' >
          badgeCount
          </Text>
          </View>
          )
          </View>
          );



          const HomeIconWithBadge = props =>
          // You should pass down the badgeCount in some other ways like context, redux, mobx or event emitters.
          return <IconWithBadge ...props />;
          ;

          const getTabBarIcon = (navigation, focused, tintColor) =>
          const routeName = navigation.state;
          let IconComponent = Ionicons;
          let iconName;
          if (routeName === 'Home')
          iconName = `ios-information-circle$focused ? '' : '-outline'`;
          // We want to add badges to home tab icon
          IconComponent = HomeIconWithBadge;
          else if (routeName === 'Settings')
          iconName = `ios-options$focused ? '' : '-outline'`;


          // You can return any component that you like here!
          return <IconComponent name=iconName size=25 color=tintColor />;
          ;

          export default createAppContainer(
          createBottomTabNavigator(

          Home: screen: HomeScreen ,
          Settings: screen: SettingsScreen ,
          ,

          defaultNavigationOptions: ( navigation ) => (
          tabBarIcon: ( focused, tintColor ) =>
          getTabBarIcon(navigation, focused, tintColor),
          ),
          tabBarOptions:
          activeTintColor: 'tomato',
          inactiveTintColor: 'gray',
          ,

          )
          );





          share|improve this answer























          • the thing is I want to add my own custom icons and I do not want to borrow from vector Icons. And I am not using expo cli..

            – TheReactor
            Mar 25 at 13:08











          • For that just replace iconName = ios-options$focused ? '' : '-outline'; and iconName = ios-information-circle$focused ? '' : '-outline'; with return(<Image source=uri:'NETWORK_IMAGE_PATH' style=/>); or return(<Image source=require('LOCAL_IMAGE_PATH') style=/>); and remove return <IconComponent name=iconName size=25 color=tintColor />;

            – shruti garg
            Mar 25 at 14:32














          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55336199%2fprovide-icons-to-react-stack-navigation%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Refer the code below to assign icons to bottom navigation.



           import React from 'react';
          import Text, View from 'react-native';
          import Ionicons from '@expo/vector-icons'; // 6.2.2
          import createBottomTabNavigator, createAppContainer from 'react-navigation';

          class HomeScreen extends React.Component
          render()
          return (
          <View style= flex: 1, justifyContent: 'center', alignItems: 'center' >
          <Text>Home!</Text>
          </View>
          );



          class SettingsScreen extends React.Component
          render()
          return (
          <View style= flex: 1, justifyContent: 'center', alignItems: 'center' >
          <Text>Settings!</Text>
          </View>
          );



          class IconWithBadge extends React.Component
          render()
          const name, badgeCount, color, size = this.props;
          return (
          <View style= width: 24, height: 24, margin: 5 >
          <Ionicons name=name size=size color=color />
          badgeCount > 0 && (
          <View
          style=
          // /If you're using react-native < 0.57 overflow outside of the parent
          // will not work on Android, see https://git.io/fhLJ8
          position: 'absolute',
          right: -6,
          top: -3,
          backgroundColor: 'red',
          borderRadius: 6,
          width: 12,
          height: 12,
          justifyContent: 'center',
          alignItems: 'center',
          >
          <Text style= color: 'white', fontSize: 10, fontWeight: 'bold' >
          badgeCount
          </Text>
          </View>
          )
          </View>
          );



          const HomeIconWithBadge = props =>
          // You should pass down the badgeCount in some other ways like context, redux, mobx or event emitters.
          return <IconWithBadge ...props />;
          ;

          const getTabBarIcon = (navigation, focused, tintColor) =>
          const routeName = navigation.state;
          let IconComponent = Ionicons;
          let iconName;
          if (routeName === 'Home')
          iconName = `ios-information-circle$focused ? '' : '-outline'`;
          // We want to add badges to home tab icon
          IconComponent = HomeIconWithBadge;
          else if (routeName === 'Settings')
          iconName = `ios-options$focused ? '' : '-outline'`;


          // You can return any component that you like here!
          return <IconComponent name=iconName size=25 color=tintColor />;
          ;

          export default createAppContainer(
          createBottomTabNavigator(

          Home: screen: HomeScreen ,
          Settings: screen: SettingsScreen ,
          ,

          defaultNavigationOptions: ( navigation ) => (
          tabBarIcon: ( focused, tintColor ) =>
          getTabBarIcon(navigation, focused, tintColor),
          ),
          tabBarOptions:
          activeTintColor: 'tomato',
          inactiveTintColor: 'gray',
          ,

          )
          );





          share|improve this answer























          • the thing is I want to add my own custom icons and I do not want to borrow from vector Icons. And I am not using expo cli..

            – TheReactor
            Mar 25 at 13:08











          • For that just replace iconName = ios-options$focused ? '' : '-outline'; and iconName = ios-information-circle$focused ? '' : '-outline'; with return(<Image source=uri:'NETWORK_IMAGE_PATH' style=/>); or return(<Image source=require('LOCAL_IMAGE_PATH') style=/>); and remove return <IconComponent name=iconName size=25 color=tintColor />;

            – shruti garg
            Mar 25 at 14:32
















          0














          Refer the code below to assign icons to bottom navigation.



           import React from 'react';
          import Text, View from 'react-native';
          import Ionicons from '@expo/vector-icons'; // 6.2.2
          import createBottomTabNavigator, createAppContainer from 'react-navigation';

          class HomeScreen extends React.Component
          render()
          return (
          <View style= flex: 1, justifyContent: 'center', alignItems: 'center' >
          <Text>Home!</Text>
          </View>
          );



          class SettingsScreen extends React.Component
          render()
          return (
          <View style= flex: 1, justifyContent: 'center', alignItems: 'center' >
          <Text>Settings!</Text>
          </View>
          );



          class IconWithBadge extends React.Component
          render()
          const name, badgeCount, color, size = this.props;
          return (
          <View style= width: 24, height: 24, margin: 5 >
          <Ionicons name=name size=size color=color />
          badgeCount > 0 && (
          <View
          style=
          // /If you're using react-native < 0.57 overflow outside of the parent
          // will not work on Android, see https://git.io/fhLJ8
          position: 'absolute',
          right: -6,
          top: -3,
          backgroundColor: 'red',
          borderRadius: 6,
          width: 12,
          height: 12,
          justifyContent: 'center',
          alignItems: 'center',
          >
          <Text style= color: 'white', fontSize: 10, fontWeight: 'bold' >
          badgeCount
          </Text>
          </View>
          )
          </View>
          );



          const HomeIconWithBadge = props =>
          // You should pass down the badgeCount in some other ways like context, redux, mobx or event emitters.
          return <IconWithBadge ...props />;
          ;

          const getTabBarIcon = (navigation, focused, tintColor) =>
          const routeName = navigation.state;
          let IconComponent = Ionicons;
          let iconName;
          if (routeName === 'Home')
          iconName = `ios-information-circle$focused ? '' : '-outline'`;
          // We want to add badges to home tab icon
          IconComponent = HomeIconWithBadge;
          else if (routeName === 'Settings')
          iconName = `ios-options$focused ? '' : '-outline'`;


          // You can return any component that you like here!
          return <IconComponent name=iconName size=25 color=tintColor />;
          ;

          export default createAppContainer(
          createBottomTabNavigator(

          Home: screen: HomeScreen ,
          Settings: screen: SettingsScreen ,
          ,

          defaultNavigationOptions: ( navigation ) => (
          tabBarIcon: ( focused, tintColor ) =>
          getTabBarIcon(navigation, focused, tintColor),
          ),
          tabBarOptions:
          activeTintColor: 'tomato',
          inactiveTintColor: 'gray',
          ,

          )
          );





          share|improve this answer























          • the thing is I want to add my own custom icons and I do not want to borrow from vector Icons. And I am not using expo cli..

            – TheReactor
            Mar 25 at 13:08











          • For that just replace iconName = ios-options$focused ? '' : '-outline'; and iconName = ios-information-circle$focused ? '' : '-outline'; with return(<Image source=uri:'NETWORK_IMAGE_PATH' style=/>); or return(<Image source=require('LOCAL_IMAGE_PATH') style=/>); and remove return <IconComponent name=iconName size=25 color=tintColor />;

            – shruti garg
            Mar 25 at 14:32














          0












          0








          0







          Refer the code below to assign icons to bottom navigation.



           import React from 'react';
          import Text, View from 'react-native';
          import Ionicons from '@expo/vector-icons'; // 6.2.2
          import createBottomTabNavigator, createAppContainer from 'react-navigation';

          class HomeScreen extends React.Component
          render()
          return (
          <View style= flex: 1, justifyContent: 'center', alignItems: 'center' >
          <Text>Home!</Text>
          </View>
          );



          class SettingsScreen extends React.Component
          render()
          return (
          <View style= flex: 1, justifyContent: 'center', alignItems: 'center' >
          <Text>Settings!</Text>
          </View>
          );



          class IconWithBadge extends React.Component
          render()
          const name, badgeCount, color, size = this.props;
          return (
          <View style= width: 24, height: 24, margin: 5 >
          <Ionicons name=name size=size color=color />
          badgeCount > 0 && (
          <View
          style=
          // /If you're using react-native < 0.57 overflow outside of the parent
          // will not work on Android, see https://git.io/fhLJ8
          position: 'absolute',
          right: -6,
          top: -3,
          backgroundColor: 'red',
          borderRadius: 6,
          width: 12,
          height: 12,
          justifyContent: 'center',
          alignItems: 'center',
          >
          <Text style= color: 'white', fontSize: 10, fontWeight: 'bold' >
          badgeCount
          </Text>
          </View>
          )
          </View>
          );



          const HomeIconWithBadge = props =>
          // You should pass down the badgeCount in some other ways like context, redux, mobx or event emitters.
          return <IconWithBadge ...props />;
          ;

          const getTabBarIcon = (navigation, focused, tintColor) =>
          const routeName = navigation.state;
          let IconComponent = Ionicons;
          let iconName;
          if (routeName === 'Home')
          iconName = `ios-information-circle$focused ? '' : '-outline'`;
          // We want to add badges to home tab icon
          IconComponent = HomeIconWithBadge;
          else if (routeName === 'Settings')
          iconName = `ios-options$focused ? '' : '-outline'`;


          // You can return any component that you like here!
          return <IconComponent name=iconName size=25 color=tintColor />;
          ;

          export default createAppContainer(
          createBottomTabNavigator(

          Home: screen: HomeScreen ,
          Settings: screen: SettingsScreen ,
          ,

          defaultNavigationOptions: ( navigation ) => (
          tabBarIcon: ( focused, tintColor ) =>
          getTabBarIcon(navigation, focused, tintColor),
          ),
          tabBarOptions:
          activeTintColor: 'tomato',
          inactiveTintColor: 'gray',
          ,

          )
          );





          share|improve this answer













          Refer the code below to assign icons to bottom navigation.



           import React from 'react';
          import Text, View from 'react-native';
          import Ionicons from '@expo/vector-icons'; // 6.2.2
          import createBottomTabNavigator, createAppContainer from 'react-navigation';

          class HomeScreen extends React.Component
          render()
          return (
          <View style= flex: 1, justifyContent: 'center', alignItems: 'center' >
          <Text>Home!</Text>
          </View>
          );



          class SettingsScreen extends React.Component
          render()
          return (
          <View style= flex: 1, justifyContent: 'center', alignItems: 'center' >
          <Text>Settings!</Text>
          </View>
          );



          class IconWithBadge extends React.Component
          render()
          const name, badgeCount, color, size = this.props;
          return (
          <View style= width: 24, height: 24, margin: 5 >
          <Ionicons name=name size=size color=color />
          badgeCount > 0 && (
          <View
          style=
          // /If you're using react-native < 0.57 overflow outside of the parent
          // will not work on Android, see https://git.io/fhLJ8
          position: 'absolute',
          right: -6,
          top: -3,
          backgroundColor: 'red',
          borderRadius: 6,
          width: 12,
          height: 12,
          justifyContent: 'center',
          alignItems: 'center',
          >
          <Text style= color: 'white', fontSize: 10, fontWeight: 'bold' >
          badgeCount
          </Text>
          </View>
          )
          </View>
          );



          const HomeIconWithBadge = props =>
          // You should pass down the badgeCount in some other ways like context, redux, mobx or event emitters.
          return <IconWithBadge ...props />;
          ;

          const getTabBarIcon = (navigation, focused, tintColor) =>
          const routeName = navigation.state;
          let IconComponent = Ionicons;
          let iconName;
          if (routeName === 'Home')
          iconName = `ios-information-circle$focused ? '' : '-outline'`;
          // We want to add badges to home tab icon
          IconComponent = HomeIconWithBadge;
          else if (routeName === 'Settings')
          iconName = `ios-options$focused ? '' : '-outline'`;


          // You can return any component that you like here!
          return <IconComponent name=iconName size=25 color=tintColor />;
          ;

          export default createAppContainer(
          createBottomTabNavigator(

          Home: screen: HomeScreen ,
          Settings: screen: SettingsScreen ,
          ,

          defaultNavigationOptions: ( navigation ) => (
          tabBarIcon: ( focused, tintColor ) =>
          getTabBarIcon(navigation, focused, tintColor),
          ),
          tabBarOptions:
          activeTintColor: 'tomato',
          inactiveTintColor: 'gray',
          ,

          )
          );






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 11:29









          shruti gargshruti garg

          1069 bronze badges




          1069 bronze badges












          • the thing is I want to add my own custom icons and I do not want to borrow from vector Icons. And I am not using expo cli..

            – TheReactor
            Mar 25 at 13:08











          • For that just replace iconName = ios-options$focused ? '' : '-outline'; and iconName = ios-information-circle$focused ? '' : '-outline'; with return(<Image source=uri:'NETWORK_IMAGE_PATH' style=/>); or return(<Image source=require('LOCAL_IMAGE_PATH') style=/>); and remove return <IconComponent name=iconName size=25 color=tintColor />;

            – shruti garg
            Mar 25 at 14:32


















          • the thing is I want to add my own custom icons and I do not want to borrow from vector Icons. And I am not using expo cli..

            – TheReactor
            Mar 25 at 13:08











          • For that just replace iconName = ios-options$focused ? '' : '-outline'; and iconName = ios-information-circle$focused ? '' : '-outline'; with return(<Image source=uri:'NETWORK_IMAGE_PATH' style=/>); or return(<Image source=require('LOCAL_IMAGE_PATH') style=/>); and remove return <IconComponent name=iconName size=25 color=tintColor />;

            – shruti garg
            Mar 25 at 14:32

















          the thing is I want to add my own custom icons and I do not want to borrow from vector Icons. And I am not using expo cli..

          – TheReactor
          Mar 25 at 13:08





          the thing is I want to add my own custom icons and I do not want to borrow from vector Icons. And I am not using expo cli..

          – TheReactor
          Mar 25 at 13:08













          For that just replace iconName = ios-options$focused ? '' : '-outline'; and iconName = ios-information-circle$focused ? '' : '-outline'; with return(<Image source=uri:'NETWORK_IMAGE_PATH' style=/>); or return(<Image source=require('LOCAL_IMAGE_PATH') style=/>); and remove return <IconComponent name=iconName size=25 color=tintColor />;

          – shruti garg
          Mar 25 at 14:32






          For that just replace iconName = ios-options$focused ? '' : '-outline'; and iconName = ios-information-circle$focused ? '' : '-outline'; with return(<Image source=uri:'NETWORK_IMAGE_PATH' style=/>); or return(<Image source=require('LOCAL_IMAGE_PATH') style=/>); and remove return <IconComponent name=iconName size=25 color=tintColor />;

          – shruti garg
          Mar 25 at 14:32




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55336199%2fprovide-icons-to-react-stack-navigation%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript