React-native-tab-view: Feature Request: Indicator Adjust to size of text

Created on 8 Sep 2020  路  7Comments  路  Source: satya164/react-native-tab-view

I love using your library and I think this feature would be a great addition!

I'm currently using the library with tabs that adjust to the size of the text within it. I also want the indicator line to the same size as the text, which I've been able to achieve by adding a borderLeftWidth, borderRightWidth and setting the border colour to equal the background colour, however I think it would be a great addition to the library to officially support it and I would be happy to create a PR for it!

Are you interested in having this functionality?

Most helpful comment

you can specify width: 'auto' in tabStyle

All 7 comments

Couldn't find version numbers for the following packages in the issue:

  • react-native-tab-view
  • react-native-gesture-handler
  • react-native-reanimated
  • ``

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

+1

Man, you saved my life with the idea of adding border to the indicator

I copy-pasted the source code of TabBarIndicator.jsx into my project and played a little bit with outputRange in getTranslateX and getWidth methods to add some padding values that I have set in my labels. Then I used the new Indicator component in renderIndicator prop, so it looks like this renderIndicator={(props) => <TabBarIndicator {...props} />}.

This feature would definitely be helpful.
By the way, thanks for giving the idea about the borders @KoboBunny!
I've been stuck for 2 days thinking about it!

Ha i would have never thought about the hidden border tho get the indicator smaller, tried all kind of things but not that!! saved me hours! Be nice to be able out of the box to have a little more flexibility in the styling part

you can specify width: 'auto' in tabStyle

Was this page helpful?
0 / 5 - 0 ratings

Related issues

QuentinBrosse picture QuentinBrosse  路  4Comments

hyochan35 picture hyochan35  路  3Comments

nastarfan picture nastarfan  路  3Comments

f6m6 picture f6m6  路  3Comments

lubomyr picture lubomyr  路  3Comments