Merge pull request #26325 from jasonmerino/react-native-navigation-navigatorevent

react-native-navigation NavigatorEvent adding more id types and type prop
This commit is contained in:
Mine Starks
2018-06-13 08:49:57 -07:00
committed by GitHub
2 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for react-native-navigation 1.1
// Project: https://github.com/wix/react-native-navigation
// Definitions by: Egor Shulga <https://github.com/egorshulga>
// Jason Merino <https://github.com/jasonmerino>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -119,7 +120,8 @@ export interface LightBox {
}
export interface NavigatorEvent {
id: 'willAppear' | 'didAppear' | 'willDisappear' | 'didDisappear' | 'willCommitPreview' | 'backPress';
id: 'willAppear' | 'didAppear' | 'willDisappear' | 'didDisappear' | 'willCommitPreview' | 'backPress' | 'bottomTabSelected' | 'bottomTabReselected' | string;
type: 'NavBarButtonPress' | 'DeepLink';
}
export class Navigator {
@@ -20,6 +20,8 @@ class Screen1 extends React.Component<Props> {
onNavigatorEvent = (event: NavigatorEvent) => {
if (event.id === 'willAppear') {
console.log('will appear');
} else if (event.type === 'NavBarButtonPress' && event.id === 'sideMenu') {
console.log('side menu pressed');
}
}