Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit the App when the default scenario is returned #2752

Closed
Xiao-HuangShu opened this issue Jan 2, 2018 · 2 comments
Closed

Exit the App when the default scenario is returned #2752

Xiao-HuangShu opened this issue Jan 2, 2018 · 2 comments

Comments

@Xiao-HuangShu
Copy link

Version

Tell us which versions you are using: 4.0.0-beta.24

  • react-native-router-flux 4.0.0-beta.24
  • react-native 0.51.0
    ###I have four scenarios, A, B, C, D, A is the default scene, when I click to D scene in turn, I click the back button and in theory should be returned to A scene, but it directly out of the App, here is my code
@Xiao-HuangShu
Copy link
Author

Xiao-HuangShu commented Jan 2, 2018

This is manipulating GIF:
20180102_153312

This is the code:
`import { Router, Scene, Actions, Tabs, Stack } from 'react-native-router-flux'
import { createStore, applyMiddleware, compose, combineReducers } from 'redux'
import { connect, Provider } from 'react-redux'
import thunkMiddleware from 'redux-thunk'

// 全局异常处理
import ErrorUtils from 'ErrorUtils'
ErrorUtils.setGlobalHandler(e => {
console.log('错误处理',e);
})

import React, { Component,PropTypes } from 'react';
import {
StyleSheet,
Text,
View
} from 'react-native';
import TabIcon from './app/components/tabIcon'
import Index from './app/components/index'
import My from './app/components/my'

import * as reducers from './app/reducers'
// http://www.redux.org.cn/docs/api/combineReducers.html
const reducer = combineReducers({
...reducers,
})
const RouterWithRedux = connect()(Router)
const middleware = [thunkMiddleware]
// compose(...functions)从右到左来组合多个函数 ,当需要把多个 store 增强器 依次执行的时候,需要用到它,http://www.redux.org.cn/docs/api/compose.html
const store = compose(
// http://www.redux.org.cn/docs/api/applyMiddleware.html
applyMiddleware(...middleware)
)(createStore)(reducer)

export default class App extends Component<{}> {

render() {
    return (
        <Provider store={store}>
            <RouterWithRedux scenes={scenes} >
            </RouterWithRedux>
        </Provider>
    );
}

}

const scenes = Actions.create(

<Stack hideNavBar key="stack" titleStyle={{ alignSelf: 'center' }} >


















)

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
}
});

// 如果不是开发环境,提示为空
if (!DEV) {
global.console = {
info: () => {},
log: () => {},
warn: () => {},
debug: () => {},
error: () => {},
};
}
`
I don't know why some code is missing, I added a picture to fill the code

11

@Blapi
Copy link
Collaborator

Blapi commented Jan 2, 2018

Check #2737

@Blapi Blapi closed this as completed Jan 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants