This repository was archived by the owner on Jan 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
This repository was archived by the owner on Jan 18, 2022. It is now read-only.
TypeScript typings rely on nonexistent @react-navigation/core libdefs #90
Copy link
Copy link
Open
Description
Hi, I just installed react-navigation-redux-helpers and am having issues with the TypeScript typings
node_modules/react-navigation-redux-helpers/index.d.ts:9:10 - error TS7016: Could not find a declaration file for module '@react-navigation/core'. '/Users/foo/ui/node_modules/@react-navigation/core/lib/commonjs/index.js' implicitly has an 'any' type.
Try `npm install @types/react-navigation__core` if it exists or add a new declaration (.d.ts) file containing `declare module '@react-navigation/core';`
9 } from '@react-navigation/core';
My implementation:
import React from 'react'
import { createStackNavigator, NavigationParams, NavigationRoute, NavigationScreenProp } from 'react-navigation'
import { createReduxContainer } from 'react-navigation-redux-helpers'
import { connect } from 'react-redux'
import { AppState } from './store'
export const screens = strEnum([
'FOO',
])
export type Screen = keyof typeof screens
export const getDefaultNavigationOptions = ({ navigation }: any) => ({
header: <Header header={navigation.getParam('header')} />,
})
export const AppNavigator = createStackNavigator(
{
[screens.FOO]: {
screen: FooScreen,
params: { header: { title: 'Foo.Title' } },
},
},
{
initialRouteName: screens.FOO,
headerMode: 'float',
defaultNavigationOptions: getDefaultNavigationOptions,
},
)
const mapStateToProps = (state: AppState) => ({
state: state.navigation,
})
const NavContainer: React.FC = () => {
const Navigator = connect(mapStateToProps)(createReduxContainer(AppNavigator))
return <Navigator />
}
export default NavContainer
Here is the contents of the node_modules/react-navigation-redux-helpers/index.d.ts file:
declare module 'react-navigation-redux-helpers' {
import {
NavigationContainer,
NavigationEventCallback,
NavigationEventSubscription,
NavigationState,
NavigationDispatch,
NavigationScreenProp
} from '@react-navigation/core';
...
Any ideas what's wrong with the typings on the last line? '@react-navigation/core';
cdharris, ace68723 and JoosepAlviste
Metadata
Metadata
Assignees
Labels
No labels
