when i try to duplicate function it show RootNavigator error
Duplicate function implementation.ts(2393)
i try add export at the top but won't work
export {}
https://reactnavigation.org/docs/native-stack-navigator#options
const DashboardStack = createNativeStackNavigator<RootStackParamList>();
function RootNavigator() {
return (
<DashboardStack.Navigator>
<DashboardStack.Screen name="Root" component={BottomTabNavigator} options={{ headerShown: false }} />
<DashboardStack.Screen name="NotFound" component={NotFoundScreen} options={{ title: 'Oops!' }} />
<DashboardStack.Group screenOptions={{ presentation: 'modal' }}>
</DashboardStack.Group>
</DashboardStack.Navigator>
);
}
const ActivityStack = createNativeStackNavigator<RootStackParamList>();
function RootNavigator() {
return (
<DashboardStack.Navigator>
<DashboardStack.Screen name="Root" component={BottomTabNavigator} options={{ headerShown: false }} />
<DashboardStack.Screen name="NotFound" component={NotFoundScreen} options={{ title: 'Oops!' }} />
<DashboardStack.Group screenOptions={{ presentation: 'modal' }}>
</DashboardStack.Group>
</DashboardStack.Navigator>
);
}
CodePudding user response:
You can't have two variables with the same name in the same scope. You have to give them different names.