react-navigation-helpers
react-navigation-helpers copied to clipboard
Type safety with NavigationService.push() and other methods?
Hi!
Wondering if it's possible to get type safety out of the helper methods exposed by this library.
i.e, if you define types in your Navigators like so:
export type FeedStackParamList = {
Community: {
name: string;
};
};
const FeedsStack = createNativeStackNavigator<FeedStackParamList>();
it would be great if we got type safety:
import * as NavigationService from 'react-navigation-helpers';
const navigateToCommunity = () => {
NavigationService.push("Community", {
wrongProp: 'foo', // <--- this would error since it's not declared for the route
});
};