Skip to content

Commit

Permalink
Merge pull request #1 from aksonov/master
Browse files Browse the repository at this point in the history
Merge upstream.
  • Loading branch information
cridenour committed Apr 17, 2016
2 parents e2281c7 + 1deab3e commit ea8aad1
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 16 deletions.
3 changes: 3 additions & 0 deletions Example/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
presets: ["react-native"]
}
2 changes: 1 addition & 1 deletion Example/Example.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class Example extends React.Component {
<Scene key="loginModal2" hideNavBar={true} component={Login2} title="Login2" panHandlers={null} duration={1}/>
</Scene>
<Scene key="tabbar" component={NavigationDrawer}>
<Scene key="main" tabs={true} default="tab2" >
<Scene key="main" tabs={true} >
<Scene key="tab1" title="Tab #1" icon={TabIcon} navigationBarStyle={{backgroundColor:"red"}} titleStyle={{color:"white"}}>
<Scene key="tab1_1" component={TabView} title="Tab #1_1" onRight={()=>alert("Right button")} rightTitle="Right" />
<Scene key="tab1_2" component={TabView} title="Tab #1_2" titleStyle={{color:"black"}}/>
Expand Down
2 changes: 1 addition & 1 deletion Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"dependencies": {
"react": "^0.14.7",
"react-native": "^0.23.1",
"react-native": "^0.22.2",
"react-native-button": "^1.2.1",
"react-native-drawer": "^1.16.7",
"react-native-modalbox": "^1.3.0",
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default class Example extends React.Component {
<Scene key="loginModal" component={Login} schema="modal" title="Login"/>
<Scene key="loginModal2" hideNavBar={true} component={Login2} title="Login2"/>
</Scene>
<Scene key="tabbar" tabs={true} default="tab2" >
<Scene key="tabbar" tabs={true} >
<Scene key="tab1" title="Tab #1" icon={TabIcon} navigationBarStyle={{backgroundColor:'red'}} titleStyle={{color:'white'}}>
<Scene key="tab1_1" component={TabView} title="Tab #1_1" onRight={()=>alert("Right button")} rightTitle="Right" />
<Scene key="tab1_2" component={TabView} title="Tab #1_2" titleStyle={{color:'black'}}/>
Expand Down Expand Up @@ -253,6 +253,8 @@ const reducerCreate = params=>{
return <Router scenes={scenes} createReducer={reducerCreate} />;

```
## Tabbar
Every tab has its own navigation bar. However, if you do not set its parent `<Scene tabs={true} />` with `hideNavBar={true}`, the tabs' navigation bar will be overrided by their parient.

## Custom nav bar for individual scene or even different state of scene (new feature):
Your scene `component` class could implement _static_ renderNavigationBar(props) method that could return different navbar depending from component props
Expand Down
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import getInitialState from './src/State';
import Reducer from './src/Reducer';
import TabBar from './src/TabBar';
import Modal from './src/Modal';

import DefaultRenderer from './src/DefaultRenderer';
import Switch from './src/Switch';

Expand Down
2 changes: 1 addition & 1 deletion src/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class Actions {
}

create(scene:Scene){
assert(scene, "roote scene should be defined");
assert(scene, "root scene should be defined");
let refs = {};
this.iterate(scene, {}, refs);
return refs
Expand Down
12 changes: 6 additions & 6 deletions src/DefaultRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
* LICENSE file in the root directory of this source tree.
*
*/
import React, {Component, Animated, PropTypes, StyleSheet, ScrollView, View, Text, NavigationExperimental} from "react-native";
import React, {Component, Animated, PropTypes, StyleSheet, View, NavigationExperimental} from "react-native";
const {
AnimatedView: NavigationAnimatedView,
Card: NavigationCard,
RootContainer: NavigationRootContainer,
Header: NavigationHeader,
} = NavigationExperimental;
import Actions from "./Actions";
import getInitialState from "./State";
import Reducer from "./Reducer";
import TabBar from "./TabBar";
import NavBar from "./NavBar";

Expand Down Expand Up @@ -95,15 +92,18 @@ export default class DefaultRenderer extends Component {

_renderCard(/*NavigationSceneRendererProps*/ props) {
const { key, direction, panHandlers, getSceneStyle } = props.scene.navigationState;
const style = getSceneStyle ? getSceneStyle(props) : null;

const optionals = {};
if (getSceneStyle) optionals.style = getSceneStyle(props);

return (
<NavigationCard
{...props}
key={'card_' + key}
direction={direction || 'horizontal'}
panHandlers={panHandlers}
renderScene={this._renderScene}
style={style}
{...optionals}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*
*/
import React, {Component, StyleSheet, ScrollView, Text, NavigationExperimental} from "react-native";
import React, {Component, NavigationExperimental} from "react-native";
const {
AnimatedView: NavigationAnimatedView,
Card: NavigationCard,
Expand Down
2 changes: 1 addition & 1 deletion src/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*
*/
import React, {Text, Component} from "react-native";
import React, {Component} from "react-native";

export default class extends Component {
render(){
Expand Down
2 changes: 1 addition & 1 deletion src/Schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*
*/
import React, {Text, Component} from "react-native";
import React, {Component} from "react-native";

export default class extends Component {
render(){
Expand Down
3 changes: 1 addition & 2 deletions src/TabBar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, {View, Text, Component, NavigationExperimental} from "react-native";
import React, {View, Component, NavigationExperimental} from "react-native";
import Tabs from "react-native-tabs";
import DefaultRenderer from "./DefaultRenderer";
import Actions from "./Actions";
import NavBar from "./NavBar";
const {
AnimatedView: NavigationAnimatedView,
CardStack: NavigationCardStack,
Expand Down

0 comments on commit ea8aad1

Please sign in to comment.