提交 a5aea730 authored 作者: vipcxj's avatar vipcxj

fix: rn端processError无法阻止错误继续传递。

fix:navigator.js中跳转方法过时导致无效。
上级 3c365f1a
......@@ -8,12 +8,15 @@ function setContainer(container: Object) {
_container = container;
}
function back() {
_container.props.navigation.dispatch(NavigationActions.back());
}
function reset(routeName: string, params?: NavigationParams) {
_container.dispatch(NavigationActions.reset({
_container.props.navigation.dispatch(NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({
type: 'Navigation/NAVIGATE',
routeName,
params,
}),
......@@ -22,18 +25,16 @@ function reset(routeName: string, params?: NavigationParams) {
}
function navigate(routeName: string, params?: NavigationParams) {
_container.dispatch(NavigationActions.navigate({
type: 'Navigation/NAVIGATE',
_container.props.navigation.dispatch(NavigationActions.navigate({
routeName,
params,
}));
}
function navigateDeep(actions: { routeName: string, params?: NavigationParams }[]) {
_container.dispatch(actions.reduceRight(
_container.props.navigation.dispatch(actions.reduceRight(
(prevAction, action): any =>
NavigationActions.navigate({
type: 'Navigation/NAVIGATE',
routeName: action.routeName,
params: action.params,
action: prevAction,
......@@ -54,6 +55,7 @@ export default {
setContainer,
navigateDeep,
navigate,
back,
reset,
getCurrentRoute,
};
......@@ -15,7 +15,11 @@ const errStyle = {
};
export function processError(err) {
if (err && err.data) {
if (err) {
if (err.preventDefault) {
err.preventDefault();
}
if (err.data) {
const { data } = err;
switch (data.errorCode) {
case errorCodes.no_such_user:
......@@ -28,6 +32,7 @@ export function processError(err) {
showError(err);
}
}
}
}
function showError(err) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论