{"id":22663165,"url":"https://github.com/puti94/react-navigation-easy-helper","last_synced_at":"2025-04-12T07:22:22.466Z","repository":{"id":57341765,"uuid":"124234289","full_name":"puti94/react-navigation-easy-helper","owner":"puti94","description":"比较简单易用副作用少的react-navigation 辅助插件","archived":false,"fork":false,"pushed_at":"2019-12-09T09:32:35.000Z","size":199,"stargazers_count":27,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T02:35:01.713Z","etag":null,"topics":["react-native","react-navigation"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puti94.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-07T12:41:40.000Z","updated_at":"2024-01-22T05:57:33.000Z","dependencies_parsed_at":"2022-09-16T03:01:08.605Z","dependency_job_id":null,"html_url":"https://github.com/puti94/react-navigation-easy-helper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-navigation-easy-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-navigation-easy-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-navigation-easy-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-navigation-easy-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puti94","download_url":"https://codeload.github.com/puti94/react-navigation-easy-helper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248531083,"owners_count":21119693,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react-native","react-navigation"],"created_at":"2024-12-09T12:17:32.856Z","updated_at":"2025-04-12T07:22:22.426Z","avatar_url":"https://github.com/puti94.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-navigation-easy-helper\n\n由于Navigator被官方移除，官方推荐的路由是react-navigation。但使用起来还是有些复杂。本组件旨在不更改源码情况下，简单配置即可实现一些复杂的功能。如在任意位置进行跳转、根据路由名字返回指定页面、简化参数的获取、快速点击的拦截、统一页面跳转的拦截等。\n\n- 安装:`npm install react-navigation-easy-helper --save` or `yarn add react-navigation-easy-helper`\n- 使用: \n\n  ```jsx\n    import {configRoute,addToRouteStack,configRoute} from 'react-navigation-easy-helper'\n  \n    //首先需要在之前的导航配置文件中用configRoute包裹参数\n      export const AppNavigator = StackNavigator(\n      configRoute({\n        LaunchPage: {screen: LaunchPage},\n        Test2Page: {screen: Test2Page},\n        Test3Page: {screen: Test3Page},\n        Test4Page: {screen: Test4Page},\n        LoginPage: {screen: LoginPage},\n    }), {\n        initialRouteName: 'LaunchPage'\n    }\n   );\n  \n    //在任意地方就可以这样使用\n    RouteHelper.navigate('Test2Page', {params: '我是参数'})\n    //返回指定页面\n    RouteHelper.goBackTo('Test2Page')\n  \n    //在注册的页面可以添加回调\n     componentDidFocus(){\n        console.log('componentDidFocus',arguments)\n     }\n  \n     componentWillBlur(){\n        console.log('componentWillBlur',arguments)\n     }\n  \n       //跳转拦截器用法\n        let needLoginPage = ['Test3Page'];\n                let noLogin = true;\n                RouteHelper.routeInterceptor = (routeName, params) =\u003e {\n                    if (noLogin \u0026\u0026 needLoginPage.indexOf(routeName) !== -1) {\n                        // RouteHelper.navigate('LoginPage', {\n                        //     routeName,\n                        //     params\n                        // });\n                        RouteHelper.push('LoginPage', {\n                            successCallBack: () =\u003e {\n                                noLogin = false;\n                                RouteHelper.push(routeName, params)\n                            }\n                        });\n                        return false;\n                    }\n                    return true\n                };\n                RouteHelper.navigate('Test3Page', {params: '我是参数'})\n  \n                //其它具体用法见example\n  ```\n- 注意点:本组件只是简化一些react-navigation的用法，方法可能不是很完善，如遇到问题，欢迎提issues,如果觉得不错，欢迎star。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputi94%2Freact-navigation-easy-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fputi94%2Freact-navigation-easy-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputi94%2Freact-navigation-easy-helper/lists"}