NativeBase: Invalid prop tabStyle
Warning: Failed prop type: Invalid prop tabStyle of type array supplied to DefaultTabBar, expected object.
in DefaultTabBar (at connectStyle.js:392)
in Styled(DefaultTabBar) (at Tabs/index.js:131)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 51
- Comments: 31 (2 by maintainers)
I think I found the problem.
at src/basic/Tabs/DefaultTabBar.js:25, tabStyle’s type is set like
but actually its always passed as arrays, (src/basic/Tabs/index.js:298)
and index-accessed in DefaultTabBar too (src/basic/Tabs/DefaultTabBar.js)
so I think
DefaultTabBar.propTypesis wrong, but I couldn’t just monkey-patchDefaultTabBar.propTypes(it still gave errors), so I worked around it by defining a customrenderTabBarfunction that hooks and replacestabStylewith an Array that doesn’t look like one and putting it in<Tabs>for typescript users (like me)
any update for this issue?
I’m experiencing same issue after upgrading from
2.13.14to2.15.2(latest)Same issue here – upgraded from
2.13.14->2.15.2. I tried fixing the prop as follows:But still get the warning
I’m sorry @yu-ichiro, apologies. I have tried the answers in the link, it solve one of the issues but not the prop type warning. I will take your advice and post to SO.
@realtril I’m away from RN for a while so I can’t help you right out sorry… but I’m kind of interested in why this occurs and why’s this shape issue still here, so I might fork this repo and try to find a solution (if I got time)
@sammiepls
Hey Sammie,
Sorry for sudden mention. I am facing the same problem. Have you solved it and would you mind sharing if solved please?
version 2.15.2 still has this warning
@yu-ichiro it worked! But when I try to pass in a style prop, then I’ll get the same warning. I have to hard-code the style to remove the tabs’ border (https://stackoverflow.com/questions/51466904/how-to-remove-the-border-of-native-base-tabs) and doing that seems to negate the workaround.
Will remove the bottom border, but gives the earlier
tabStylewarning and this warning:The culprit seems to be the fact that
propsare being spread onto the<DefaultTabBar {...props} />innative-base/src/basic/Tabs/index.js:131.