小编Smi*_*ter的帖子

React Navigation v6 NavigationContainer 链接属性与嵌套导航打字稿问题

我正在使用 React navigation 6 和包含选项卡导航器的根堆栈导航器。我的链接属性配置在应用程序组件中如下所示:

export default function App() {
    const linking = {
        prefixes: [prefix],
        config: {
            screens: {
                Roundups: 'roundups',
                Account: 'account',
                TabNavigator: {
                    screens: {
                        Tab1: 'tab1',
                        Tab2: 'tab2',
                    },
                },
            },
        },
    };

    return (
        <NavigationContainer linking={linking} fallback={<Text>Loading...</Text>}>
            <QueryClientProvider client={queryClient}>
                <Stack.Navigator>
                    <Stack.Screen name="RoundUps" component={RoundUps} />
                    <Stack.Screen name="Account" component={Account} />
                    <Stack.Screen name="LoggedIn" component={TabNavigator} />
                </Stack.Navigator>
            </QueryClientProvider>
        </NavigationContainer>
     );
}
Run Code Online (Sandbox Code Playgroud)

我的 TabNavigator 组件如下所示:

const Tab = createBottomTabNavigator();

type Props = NativeStackScreenProps<RootStackParamList, 'TabNavigator'>;

const TabNavigator = ({ navigation }: …
Run Code Online (Sandbox Code Playgroud)

typescript react-native react-navigation expo

13
推荐指数
1
解决办法
4555
查看次数

Angular 6-导入带有子路由的库/ npm模块时正确路由

我已按照本指南构建了Angular 6库模块,并在库中运行了一个虚拟应用程序,因此我可以在开发过程中导入和测试模块。

我从库中导入的库模块具有子路由。我认为这是此问题的根本原因。双关打算。库模块的路由模块如下所示:

// Library Module routing
const routes: Routes = [{
    path: '',
    children: [
        { path: '', component: LoginFormComponent },
        { path: 'forgot-password', component: ForgotPasswordFormComponent }
    ]
}];

@NgModule({
    imports: [ RouterModule.forChild(routes) ],
    exports: [ RouterModule ]
})
export class LoginRoutingModule {}
Run Code Online (Sandbox Code Playgroud)

在我的虚拟应用程序中,我有一个模块模块,由应用程序路由模块延迟加载:

// Dummy app root routing
const appRoutes: Routes = [
    {
        path: '',
        children:  [{
            path: 'modules',
            loadChildren: './modules/modules.module#ModulesModule'
        }]
    },
    { path: '**', redirectTo: '' }
];

@NgModule({
    imports: [RouterModule.forRoot(appRoutes)],
    exports: [RouterModule] …
Run Code Online (Sandbox Code Playgroud)

routes node-modules angular ng-packagr angular6

5
推荐指数
0
解决办法
2426
查看次数