Add cardStyle prop to NavigationCardStack.

Summary:
This allows the `NavigationCard` style to be extended, the default `backgroundColor` style of the `NavigationCard` is not applicable to all apps.
Fixes issue #8116. PR #8115 was already made for this but didn't pass CI checks.

**Test plan**

When rendering a NavigationCardStack, add

```
const { CardStack } = NavigationExperimental;
...

<CardStack cardStyle={{ backgroundColor: 'purple' }} />
```

to see that the `NavigationCard` background has changed to purple.
Closes https://github.com/facebook/react-native/pull/8471

Differential Revision: D3508849

Pulled By: javache

fbshipit-source-id: 65703cccf3d01def9f2060256f0ff564bbdc47d3
This commit is contained in:
JasperStam 2016-07-01 04:30:59 -07:00 committed by Facebook Github Bot 5
parent 22fbb6d46d
commit aa0efd2e64
1 changed files with 3 additions and 1 deletions

View File

@ -64,6 +64,7 @@ type Props = {
onNavigateBack?: Function,
renderOverlay: ?NavigationSceneRenderer,
renderScene: NavigationSceneRenderer,
cardStyle?: any,
style: any,
};
@ -96,6 +97,7 @@ class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
onNavigateBack: PropTypes.func,
renderOverlay: PropTypes.func,
renderScene: PropTypes.func.isRequired,
cardStyle: View.propTypes.style,
};
static defaultProps: DefaultProps = {
@ -192,7 +194,7 @@ class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
key={'card_' + props.scene.key}
panHandlers={panHandlers}
renderScene={this.props.renderScene}
style={style}
style={[style, this.props.cardStyle]}
/>
);
}