/* @flow */

import React, { PureComponent } from 'react';

import SceneView from '../SceneView';
import withCachedChildNavigation from '../../withCachedChildNavigation';

import type {
  NavigationScreenProp,
  NavigationState,
  NavigationRoute,
  NavigationAction,
  NavigationRouter,
} from '../../TypeDefinition';

type Props = {
  screenProps?: {};
  router: NavigationRouter,
  navigation: NavigationScreenProp<NavigationState, NavigationAction>,
  childNavigationProps: { [key: string]: NavigationScreenProp<NavigationRoute, NavigationAction> },
};

/**
 * Component that renders child screen of the drawer.
 */
class DrawerScreen extends PureComponent<void, Props, void> {
  props: Props;

  render() {
    const { router, navigation, childNavigationProps } = this.props;
    const { routes, index } = navigation.state;
    const childNavigation = childNavigationProps[routes[index].key];
    const Content = router.getComponentForState(navigation.state);
    return (
      <SceneView
        screenProps={this.props.screenProps}
        component={Content}
        navigation={childNavigation}
      />
    );
  }
}

export default withCachedChildNavigation(DrawerScreen);

@@ -937,29 +937,40 @@
 tFor
-State(navigation.stat
+RouteName(routes%5Bindex%5D.routeNam
 e);%0A

Fix drawer rendering wrong route (#46)