ptomasroos / react-native-tab-navigator

A tab bar that switches between scenes, written in JS for cross-platform support
MIT License
2.4k stars 416 forks source link

Ignore null children in the tab-bar. #86

Closed mvantellingen closed 8 years ago

mvantellingen commented 8 years ago

This allows you to render tab items conditonally since the false condition returns null in that case.

mvantellingen commented 8 years ago

This allows the following constructs:

  return (
    <TabNavigator>
      // Other TabNavigator.Item

      {(() => {
        if (debug) {
          return (
            <TabNavigator.Item title="Debug">
              <Debug navigator={navigator}/>
            </TabNavigator.Item>
          )
        }
      })()}
    </TabNavigator>
  )
ide commented 8 years ago

Published in 0.3.3.