Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined is not an object (evaluating navigation.state) #126

Open
ngoel37 opened this issue Oct 23, 2021 · 1 comment
Open

undefined is not an object (evaluating navigation.state) #126

ngoel37 opened this issue Oct 23, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@ngoel37
Copy link

ngoel37 commented Oct 23, 2021

Bug

Using standalone method from docs. Having three issues:

  1. undefined is not an object (evaluation navigation.state)

  2. The sample calls for using AnimatedTabBarView, but the imports only list AnimatedTabBar. Which one should I use?

  3. I am getting a type error on index within the component

Thanks!

Environment info

Library Version
@gorhom/animated-tabbar 2.1.2
react-native 0.63.4
react-native-reanimated 1
react-native-gesture-handler 1.10.2
react-native-svg 12.1.1

Steps To Reproduce

import AnimatedTabBarView, {TabsConfig, BubbleTabBarItemConfig} from '@gorhom/animated-tabbar'

const [index, setIndex] = useState(0)

const tabs: TabsConfig<BubbleTabBarItemConfig> = {
    Home: {
      labelStyle: {
        color: "#5B37B7",
      },
      icon: {
        component: (
          <View />
        ),
        activeColor: "rgba(91,55,183,1)",
        inactiveColor: "rgba(0,0,0,1)",
      },
      background: {
        activeColor: "rgba(223,215,243,1)",
        inactiveColor: "rgba(223,215,243,0)",
      },
    },
    Profile: {
      labelStyle: {
        color: "#1194AA",
      },
      icon: {
        component: (
          <View />
        ),
        activeColor: "rgba(17,148,170,1)",
        inactiveColor: "rgba(0,0,0,1)",
      },
      background: {
        activeColor: "rgba(207,235,239,1)",
        inactiveColor: "rgba(207,235,239,0)",
      },
    },
  }


<AnimatedTabBarView
            tabs={tabs}
            itemOuterSpace={{
              horizontal: 6,
              vertical: 12,
            }}
            itemInnerSpace={12}
            iconSize={20}
            style={{ borderRadius: 25}}
            index={index}
            onIndexChange={setIndex}
        />
@ngoel37 ngoel37 added the bug Something isn't working label Oct 23, 2021
@ngoel37 ngoel37 changed the title undefined is not an exception (evaluating navigation.state) undefined is not an object (evaluating navigation.state) Oct 23, 2021
@ngoel37
Copy link
Author

ngoel37 commented Oct 24, 2021

Fixed this. @gorhom - we just need to fix the import to

import {
  AnimatedTabBarView,
  TabsConfig,
  BubbleTabBarItemConfig,
} from "@gorhom/animated-tabbar"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant