gorhom/react-native-animated-tabbar

Element Type is invalid: Expected a string (Error)

Haseeba393 opened this issue · 14 comments

Bug

I'm using latest versions of react native and gorhom/react-native-animated-tabbar library. I have only one screen App.js and i'm doing everything on that. I have followed all steps of installation and did the same code as he described in React Navigation v5/Javascript. But getting this error:
image

Environment info

This is my package.json
{
"name": "pr",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@gorhom/animated-tabbar": "^2.1.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/bottom-tabs": "^5.11.2",
"@react-navigation/native": "^5.8.10",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-gesture-handler": "^1.9.0",
"react-native-reanimated": "^1.13.2",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.16.1",
"react-native-svg": "^12.1.0"
},
"devDependencies": {
"@babel/core": "7.12.10",
"@babel/runtime": "7.12.5",
"@react-native-community/eslint-config": "1.1.0",
"babel-jest": "25.5.1",
"eslint": "6.8.0",
"jest": "25.5.4",
"metro-react-native-babel-preset": "0.59.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}

Steps To Reproduce

I have uploaded my code to this repository. You can check everything here and let me know if anything I'm doing wrong.
https://github.com/Haseeba393/animated-tab-bar

Describe what you expected to happen:
Expected bahavior that animation should be performed as shown in the demo of this library

Anyone here to help out please?

Hi @Haseeba393 , try to provide component ?

    icon: {
      //component: /* ICON COMPONENT */,

Can you please give me an example? How I have to provide icon component?

According to you, I'm giving an image as an icon but the same error
image

@gorhom Brother are you there? I need your help?

Anyone here?

@Haseeba393 i will look into this later today 👍

Please @gorhom it will be really thanks of you

any luck so far? @gorhom

Anyone here?

Can I get support here?

This is very embarrassing for me. If you are not able to handle the support for this library then please tell me. You said that you will check it but I didn't get any reply from you

Hi @Haseeba393 , i understand your frustration but this is clearly not the library issue but the way your provide your icons. I am not going to fix every one use-cases.

However, i tried your provided repo, and it seems working fine , i added Icon as custom component and it works also fine.

const Icon = () => (<View style={{ width: 20, height: 20}} />)

const tabs = {
  screen1: {
    // < Screen name
    labelStyle: {
      color: '#5B37B7',
    },
    icon: {
      component: () => (<View style={{ width: 20, height: 20}} />),
      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)',
    },
  },
....

I'm really sorry brother. I know that no one can solve all use cases related to 1 library. By the way, I tried the way you provided the Icon and it is working fine. Thank you so much. You really saved my day.
Just one thing, if you please this also in your documentation then it will be really helpful for other people.
Thank you again @gorhom