Closed solomonhawk closed 5 years ago
Update: I'm not convinced this is a bug in the library itself but perhaps some kind of unwanted interaction with some other component of my system. What seemed to trigger it was tapping on a touchable contained within one of the tab views.
I'll try to gather more info.
Thanks! Curious to see what's causing it.
@solomonhawk @satya164 I am experiencing exact same issue... seems like it is being triggered when I change index
externally, but I am not sure about it either...
It's a pain as it is not always reproducible :/
Also, besides from sometimes having negative position (which I've solved by adding extrapolate: 'clamp'
to the Animated.interpolate, I sometimes get wrong position, such as 2
for a second tab view (where it should be 1
).
Hey, I just released a new alpha 2.0.0-alpha.0
of the library. It's rewritten using react-native-gesture-handler and react-native-reanimated addresses a many platform specific bugs and performance problems. The documentation is updated as well.
Please try the new version and see if it addresses your issue. If not, please open a new issue following the issue template.
Current behaviour
I'm seeing a bug in the TabBar behavior. I'm rendering my own custom component here and interpolating the
position
passed in byreact-native-tab-view
per suggestion. In a certain edge case I am seeing aposition
value of-1
which as far as I can tell is invalid. The result is that my tab indicator disappears (it's now transitioned left off-screen) and my tab colors go wacky (since they're not expecting anything outside of the range[0, ... tabs.length - 1]
.Reproduction may be a little difficult - I'll see if I can find time to make a snack. Basically to repro I have to swipe to change tabs and then tap on an interactive element within one of my tabs which triggers the issue. I can't quite tell why since the interaction is a tap and not a swipe.
It seems like this is the offending piece: https://github.com/react-native-community/react-native-tab-view/blob/master/src/TabView.js#L85-L87
Expected behaviour
I think that
position
should respect the following constraint:0 <= position <= navigationState.routes.length - 1
Is this accurate?
Screenshots (if applicable)
Good:
Bad:
What have you tried
I changed the suspect code to the following locally however there's still some odd behavior.
Your Environment
Below is the source for my
TabBar
custom component, hope it's helpful: