35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
// Metro module 1488 (f1489).
|
|
import { nanoid } from "./Module1489";
|
|
export default {
|
|
getStateForAction: (a0, a1) => {
|
|
let c13060_2;
|
|
const type = a1.type;
|
|
if (type === "SET_PARAMS") {
|
|
const r38 = a1.source ? a0.routes.findIndex((route) => route.key === a1.source) : a0.index;
|
|
c13060_2 = r38;
|
|
return r38 !== -1 ? {
|
|
...a0,
|
|
routes: a0.routes.map((route, index) => index === c13060_2 ? {
|
|
...route,
|
|
params: {
|
|
...route.params,
|
|
...a1.payload.params
|
|
}
|
|
} : route)
|
|
} : null;
|
|
}
|
|
if (type === "RESET") {
|
|
const payload = a1.payload;
|
|
return payload.routes.length !== 0 ? payload.routes.some((route) => !a0.routeNames.includes(route.name)) ? null : payload.stale === false ? a0.routeNames.length === payload.routeNames.length ? payload.routeNames.some((routeName) => !a0.routeNames.includes(routeName)) ? null : {
|
|
...payload,
|
|
routes: payload.routes.map((route) => route.key ? route : {
|
|
...route,
|
|
key: `${route.name}-${nanoid()}`
|
|
})
|
|
} : null : payload : null;
|
|
}
|
|
return null;
|
|
},
|
|
shouldActionChangeFocus: (a0) => a0.type === "NAVIGATE"
|
|
};
|