attentiveness / reading

iReading App Write In React-Native

Home Page:https://richardcao.me/2016/07/05/Talk-About-Reading/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

请问下怎么在sagas中实现跳转页面?

forrest23 opened this issue · comments

应用场景:在登陆操作时,在sagas中判断是否登陆成功,成功则跳转到主页,代码如下:
export function* requestLogin(loading, body) { try { yield put(fetchLogin(loading)); const loginResult = yield call( RequestUtil.request, ${LOGIN}, 'post', body, false ); const errorMessage = loginResult.error_description; if (errorMessage && errorMessage !== '') { yield put(receiveLogin({})); yield ToastUtil.showShort(errorMessage); } else { yield put(receiveLogin(loginResult)); yield call(StorageUtil.saveUser, loginResult); yield put(NavigationActions.navigate({ routeName: 'Home' })); } } catch (error) { yield put(receiveLogin({})); ToastUtil.showShort('网络发生错误,请重试' + error); } }

我是用了 yield put(NavigationActions.navigate({ routeName: 'Home' }));
这句代码来跳转,结果无效?想问下这个应该怎么写才对?其他代码都是reading一样的,有空能看下吗?谢谢
@Richard-Cao

跳转无效有什么log吗?