diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index d13c342cf9..332f4e4645 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -576,7 +576,7 @@ export interface NavigationScreenProp { closeDrawer: () => any; toggleDrawer: () => any; getParam: (param: T, fallback?: P[T]) => P[T]; - setParams: (newParams: P) => boolean; + setParams: (newParams: Partial

) => boolean; addListener: ( eventName: string, callback: NavigationEventCallback diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 7563708163..03b6f76775 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -489,3 +489,28 @@ const CustomHeaderStack = createStackNavigator({ } } }); + +interface ScreenProps { + name: string; + onPlay(): void; +} + +class SetParamsTest extends React.Component> { + componentDidMount() { + this.props.navigation.setParams({ + onPlay: this.onPlay + }); + } + + onPlay = () => { + // + } + + render() { + const name = this.props.navigation.getParam('name'); + + return ( + My name is {name} + ); + } +}