mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-10 09:13:43 +08:00
Allow tabBarTestIDProps to be a function that receive the focused status (#3303)
This commit is contained in:
@@ -64,13 +64,15 @@ class TabView extends React.PureComponent {
|
||||
return options.tabBarOnPress;
|
||||
};
|
||||
|
||||
_getTestIDProps = ({ route }) => {
|
||||
_getTestIDProps = ({ route, focused }) => {
|
||||
const options = this.props.router.getScreenOptions(
|
||||
this.props.childNavigationProps[route.key],
|
||||
this.props.screenProps || {}
|
||||
);
|
||||
|
||||
return options.tabBarTestIDProps;
|
||||
return typeof options.tabBarTestIDProps === 'function'
|
||||
? options.tabBarTestIDProps({ focused })
|
||||
: options.tabBarTestIDProps;
|
||||
};
|
||||
|
||||
_renderIcon = ({ focused, route, tintColor }) => {
|
||||
|
||||
Reference in New Issue
Block a user