mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 01:31:45 +00:00
Adding a test that fails
This commit is contained in:
@@ -41,6 +41,7 @@ import {
|
||||
NavigationScreenComponent,
|
||||
NavigationContainerComponent,
|
||||
withNavigation,
|
||||
withNavigationFocus,
|
||||
NavigationInjectedProps,
|
||||
} from 'react-navigation';
|
||||
|
||||
@@ -532,3 +533,19 @@ const BackButtonWithNavigation = withNavigation<BackButtonProps>(MyBackButton);
|
||||
const BackButtonInstance = <BackButtonWithNavigation
|
||||
title="Back" onRef={ref => { const backButtonRef = ref; }}
|
||||
/>;
|
||||
|
||||
// Test withNavigationFocus
|
||||
|
||||
interface MyFocusedComponentProps { expectsFocus: boolean; }
|
||||
class MyFocusedComponent extends React.Component<MyFocusedComponentProps & NavigationInjectedProps> {
|
||||
render() {
|
||||
return <button title={`${this.props.expectsFocus} vs ${this.props.isFocused}`} onClick={() => { this.props.navigation.goBack(); }} />;
|
||||
}
|
||||
}
|
||||
|
||||
// withNavigationFocus returns a component that wraps MyFocusedComponent and passes in the
|
||||
// navigation and isFocused prop
|
||||
const MyFocusedComponentWithNavigationFocus = withNavigationFocus<MyFocusedComponentProps>(MyFocusedComponent);
|
||||
const MyFocusedComponentInstance = <MyFocusedComponentWithNavigationFocus
|
||||
expectsFocus={true} onRef={ref => { const backButtonRef = ref; }}
|
||||
/>;
|
||||
|
||||
Reference in New Issue
Block a user