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

Warning due to a upgrade react-native to 0.26 [using key props] #75

Closed oziks closed 6 years ago

oziks commented 8 years ago

I attempt to upgrade to react-native 0.26 but a warning message appears. I explain you my workflow :

The warning message is

Warning: Element: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props)

on this line https://github.com/exponentjs/react-native-tab-navigator/blob/master/TabNavigator.js#L48.

According to https://fb.me/react-special-props, using key props is not a good idea.

ide commented 8 years ago

That's kind of annoying... semantically we actually want the same value as the key prop. One thing that's confusing is we're accessing element.key instead of element.props.key -> need to investigate this more.