我正在尝试将NavigationFocus用于组件,因为代码是用Typescript编写的。 ,
我的道具道具
interface IScreenProps {
navigation: NavigationScreenProp<NavigationState, IParamsNavigate>;
departments: NavigationNode[] | null;
updateSearchCriteria: (searchCriteria: ISearchCriteria, stack: StackNames) => void;
resetProductState: () => void;
isFocused: boolean;
}
组件
class SearchScreen extends React.Component<IScreenProps, IScreenState> {
.....
}
export default connect(mapStateToProps, mapDispatchToProps)( withNavigationFocus(SearchScreen));
没有构建错误,在searchScreen导出时,编辑器/ IDE中仍以红线显示。我遇到了下面的错误。
请让我知道如何解决此问题。
答案 0 :(得分:0)
使用NavigationStackProp
(或与您的导航器相关的一种),而不是NavigationScreenProp
interface IScreenProps {
navigation: NavigationStackProp<IParamsNavigate>;
departments: NavigationNode[] | null;
updateSearchCriteria: (searchCriteria: ISearchCriteria, stack: StackNames) => void;
resetProductState: () => void;
isFocused: boolean;
}