From 719b9290f0864add697c2e40932858f514b5d811 Mon Sep 17 00:00:00 2001 From: Leland Richardson Date: Mon, 11 Apr 2016 16:28:19 -0700 Subject: [PATCH] Add getSceneStyle api to Scene and Router --- README.md | 2 ++ src/DefaultRenderer.js | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 26fb9df38..e49704c45 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ class App extends React.Component { | other props | | | all properties that will be passed to all your scenes | | children | | required (if no scenes property passed)| Scene root element | | scenes | object | optional | scenes for Router created with Actions.create. This will allow to create all actions BEFORE React processing. If you don't need it you may pass Scene root element as children | +| getSceneStyle | function | optional | Optionally override the styles for NavigationCard's Animated.View rendering the scene. | ##### Scene: | Property | Type | Default | Description | @@ -130,6 +131,7 @@ class App extends React.Component { | tabBarStyle | View style | | optional style override for the Tabs component | | sceneStyle | View style | { flex: 1 } | optional style override for the Scene's component | | other props | | | all properties that will be passed to your component instance | +| getSceneStyle | function | optional | Optionally override the styles for NavigationCard's Animated.View rendering the scene. | ## Example ![launch](https://cloud.githubusercontent.com/assets/1321329/11692367/7337cfe2-9e9f-11e5-8515-e8b7a9f230ec.gif) diff --git a/src/DefaultRenderer.js b/src/DefaultRenderer.js index 4337862cf..66b221355 100644 --- a/src/DefaultRenderer.js +++ b/src/DefaultRenderer.js @@ -84,14 +84,16 @@ export default class DefaultRenderer extends Component { } _renderCard(/*NavigationSceneRendererProps*/ props) { + const { key, direction, panHandlers, getSceneStyle } = props.scene.navigationState; + const style = getSceneStyle ? getSceneStyle(props) : null; return ( ); }