| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import { CommonActions } from "@react-navigation/native";
- export default {
- state: {
- routerState: "",
- nowName: "",
- navigation: "",
- topNavigation: "",
- },
- actions: ({ model, setState }) => ({
- setTopNavigation(navigation) {
- console.log(navigation);
- setState({ topNavigation: navigation });
- },
- setNavigation(navigation) {
- setState({ navigation: navigation });
- },
- pushTopRouter(to, screen, params) {
- const { topNavigation } = model();
- topNavigation.navigate(to, { screen: screen, params: params });
- },
- replaceTopRouter(to) {
- const { topNavigation } = model();
- topNavigation.replace(to);
- },
- pushRouter(to) {
- const { navigation } = model();
- navigation.navigate(to);
- },
- replaceRouter(to, screen, params) {
- const { navigation } = model();
- navigation.replace(to, { screen: screen, params: params });
- },
- backRouter() {
- const { navigation } = model();
- navigation.goBack();
- },
- resetRouter(to) {
- const { navigation } = model();
- navigation.reset(to);
- },
- }),
- };
|