Skip to content

Commit

Permalink
Here’s the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwasner committed Aug 9, 2017
1 parent fa6034d commit faf4e74
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 103 deletions.
82 changes: 3 additions & 79 deletions Example/Example.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
import Launch from './components/Launch';
import Register from './components/Register';
import Login from './components/Login';
import Login2 from './components/Login2';
import Login3 from './components/Login3';
import {
Scene,
Router,
Expand Down Expand Up @@ -54,84 +52,10 @@ class Example extends Component {
<Scene key="modal" modal hideNavBar>
<Scene key="drawer" drawer contentComponent={TabView} >
<Scene key="root" hideNavBar hideTabBar>
<Scene key="echo" back clone component={EchoView} getTitle={({navigation}) => navigation.state.key}/>
<Scene key="register" back>
<Scene key="_register" component={Register} title="Register" />
<Scene key="register2" component={Register} title="Register2" />
<Scene key="home" component={Home} title="Replace" type='replace' />
</Scene>
<Scene key="launch" component={Launch} title="Launch" initial />
<Scene
key="tabbar"
gestureEnabled={false}
tabs
tabBarStyle={styles.tabBarStyle}
activeBackgroundColor='#ddd'
>
<Scene
key="tab1"
title="Tab #1"
tabBarLabel="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"
back
titleStyle={{color: 'black'}}
/>
</Scene>
<Scene key="tab2" initial title="Tab #2" icon={TabIcon}>
<Scene
key="tab2_1"
component={TabView}
title="Tab #2_1"
renderRightButton={() => <Text>Right</Text>}
/>
<Scene
key="tab2_2"
component={TabView}
title="Tab #2_2"
back
onBack={() => alert('onBack button!')}
backTitle="Back!"
panHandlers={null}
/>
</Scene>
<Scene key="tab3" component={TabView} title="Tab #3" icon={TabIcon}/>
<Scene key="tab4" component={TabView} title="Tab #4" hideNavBar icon={TabIcon}/>
<Scene key="tab5" component={TabView} title="Tab #5" icon={TabIcon}/>
</Scene>
<Scene key="home" component={Home} title="Home" type='replace' />
<Scene key="login" component={Login} title="Login" type='replace' initial />
</Scene>
</Scene>
<Scene key="login" >
<Scene key="loginModal" component={Login} title="Login" leftTitle="Cancel" onLeft={Actions.pop}/>
<Scene
key="loginModal2"
component={Login2}
title="Login2"
backTitle="Back"
panHandlers={null}
duration={1}
/>
<Scene
key="loginModal3"
hideNavBar
component={Login3}
title="Login3"
panHandlers={null}
duration={1}
/>
<Scene key="launch" component={Launch} title="Launch"/>
</Scene>
</Scene>
<Scene key="error" component={Error}/>
Expand Down
13 changes: 9 additions & 4 deletions Example/components/Home.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import {View, Text, StyleSheet} from "react-native";
import Button from "react-native-button";
import {Actions} from "react-native-router-flux";
import {Actions,ActionConst} from "react-native-router-flux";

var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#F5FCFF",
backgroundColor: "#d82455",
},
welcome: {
fontSize: 20,
Expand All @@ -26,8 +26,13 @@ class Home extends React.Component {
render(){
return (
<View style={styles.container}>
<Text>Replace screen</Text>
<Button onPress={Actions.pop}>Back</Button>
<Text>Home Screen</Text>
<Button onPress={()=>Actions.launch()}>Go to Launch page</Button>
<Button onPress={()=>{
console.log('hello')
this.props.navigation.navigate('login',{type:ActionConst.REPLACE})
}}>Logout</Button>

</View>
);
}
Expand Down
7 changes: 2 additions & 5 deletions Example/components/Launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ class Launch extends React.Component {
return (
<View {...this.props} style={styles.container}>
<Text>Launch page</Text>
<Button onPress={()=>Actions.login({data:"Custom data", title:"Custom title" })}>Go to Login page</Button>
<Button onPress={()=>Actions.register()}>Go to Register page</Button>
<Button onPress={()=>Actions.error("Error message")}>Popup error</Button>
<Button onPress={()=>Actions.tabbar()}>Go to TabBar page</Button>
<Button onPress={()=>Actions.pop()}>back</Button>
<Button onPress={()=>Actions.login()}>Go to Login page</Button>
<Button onPress={()=>Actions.home()}>Go to Home page</Button>
</View>
);
}
Expand Down
19 changes: 4 additions & 15 deletions Example/components/Login.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {View, Text, StyleSheet} from "react-native";
import Button from "react-native-button";
import {Actions} from "react-native-router-flux";
import {Actions,ActionConst} from "react-native-router-flux";

const styles = StyleSheet.create({
container: {
Expand All @@ -23,25 +23,14 @@ const styles = StyleSheet.create({
});

export default class extends React.Component {
componentDidMount() {
Actions.refresh({
title: 'Login!',
rightTitle: 'rightTitle',
onRight: () => {},
});
}
render() {
const title = this.props.title || 'No Title';
const data = this.props.data || 'No Data';
console.log("Login RENDER");
return (
<View style={[styles.container, this.props.style]}>
<Text>Login page 1</Text>
<Text>Title: {title}</Text>
<Text>Data: {data}</Text>
<Button onPress={() => Actions.loginModal2({data: "Custom data2", title: "Custom title2"})}>Login 2</Button>
<Button onPress={() => Actions.refresh({title: "Changed title", data: "Changed data"})}>Change title</Button>
<Button onPress={Actions.pop}>Back</Button>
<View {...this.props} style={styles.container}>
<Text>Login</Text>
<Button onPress={()=>Actions.home({type:ActionConst.REPLACE})}>REPLACE to Home</Button>
</View>
);
}
Expand Down

0 comments on commit faf4e74

Please sign in to comment.