PedroBern / react-native-collapsible-tab-view

A cross-platform Collapsible Tab View component for React Native
MIT License
827 stars 160 forks source link

Different icon depending on if tab is selected #279

Closed Livijn closed 1 year ago

Livijn commented 1 year ago

How do I change the icon or tab content depending on if the tab is selected?

This is is not working:

      <Tabs.Tab
        name="posts"
        label={(props) => (
          <FaIcon
            icon="image"
            type={props.index === ? 'fas' : 'far'}
          />
        )}
      >
andreialecu commented 1 year ago

There's an example of how to do this here:

https://github.com/PedroBern/react-native-collapsible-tab-view/blob/main/example/src/Shared/ExampleComponentCustomLabels.tsx

Video of it in action at: https://github.com/PedroBern/react-native-collapsible-tab-view/pull/255#issuecomment-1131663672

I suggest using the latest v5 RC.

Livijn commented 1 year ago

Thanks! Worked perfectly!