Skip to content

Commit

Permalink
Link NewMap to Center.js
Browse files Browse the repository at this point in the history
  • Loading branch information
胡翔喻 committed Nov 27, 2016
1 parent d5b1dfc commit 8b944bc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
24 changes: 12 additions & 12 deletions AppInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,30 @@ var AppInit = React.createClass({
// })
// }

const { navigator } = this.props;
if(navigator) {
navigator.replace({
name: 'NavMap',
component: NavMap,
})
}

// const { navigator } = this.props;
// if(navigator) {
// navigator.replace({
// name: 'NavMap',
// component: NavMap,
// name: 'VRPanorama',
// component: VRPanorama,
// })
// }

// const { navigator } = this.props;
// if(navigator) {
// navigator.replace({
// name: 'VRPanorama',
// component: VRPanorama,
// name: 'Center',
// component: Center,
// })
// }

const { navigator } = this.props;
if(navigator) {
navigator.replace({
name: 'Center',
component: Center,
})
}

// const { navigator } = this.props;
// if(navigator) {
// navigator.replace({
Expand Down
12 changes: 6 additions & 6 deletions Center.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ var Center = React.createClass({
await this.PetRef.child(3).update({current_HP: 58});
console.log('end');
this.setModalVisible(!this.state.modalVisible);
const { navigator } = this.props;
if(navigator) {
//返回NewMap
navigator.pop();
}

},
setModalVisible(visible) {
this.setState({modalVisible: visible,sign: '完成'});
Expand All @@ -64,7 +60,11 @@ var Center = React.createClass({
</View>
<View style={{flex: 1,justifyContent: 'center',}}>
<Text style={styles.welcome_2} onPress={() => {
this.setModalVisible(!this.state.modalVisible)
const { navigator } = this.props;
if(navigator) {
//返回NewMap
navigator.pop();
}
}}>
確定
</Text>
Expand Down
16 changes: 8 additions & 8 deletions NewMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import gym_09 from './gym_09';
import gym_10 from './gym_10';
import gym_11 from './gym_11';
import gym_12 from './gym_12';
import TheCenter from './Center';
import FireStore from './FireStore';
import WaterStore from './WaterStore';
import WoodStore from './WoodStore';
Expand Down Expand Up @@ -488,14 +489,13 @@ var NewMap = React.createClass({

// }
if(annotation.title=='寶貝中心'){
Alert.alert(
'歡迎來到寵物中心',
'你的寵物都已回復~',
[

{text: 'OK', onPress: () => console.log('OK Pressed')},
]
)
const { navigator } = this.props;
if(navigator) {
navigator.push({
name: 'TheCenter',
component: TheCenter,
})
}
}
else if(annotation.title=='道館'){
const { navigator } = this.props;
Expand Down

0 comments on commit 8b944bc

Please sign in to comment.