Files
react-navigation/packages/core
Satyajit Sahoo 3a77107968 fix: drop isFirstRouteInParent method (#145)
The `isFirstRouteInParent` method was added to determine whether the back button should be shown in the header for stack navigator or not.
This was mainly due to the API of the old version of stack whose public API of header didn't have all required info to determine whether it should be shown.
It was probably a mistake to add it, because this method doesn't look at history and so pretty much useless for other navigators which aren't stack.

In the new stack, the header receives a `previous` prop and the `headerLeft` option receives a `canGoBack` prop which can be used for this purpose.
It's also possible to check if a route is the first by doing `navigation.dangerouslyGetState().routes[0].key === route.key`.

So it's time to drop this method.
2019-10-30 08:51:59 +01:00
..
2019-10-29 21:20:18 +01:00
2019-10-29 21:20:18 +01:00
2019-08-21 19:12:40 +05:30
2019-08-21 14:27:07 +05:30

@react-navigation/core

Core utilities for building navigators.

Installation

Open a Terminal in your project's folder and run,

yarn add @react-navigation/core

Usage

A basic custom navigator bundling a router and a view looks like this:

import { useNavigationBuilder } from '@react-navigation/core';
import { StackRouter } from '@react-navigation/routers';

function StackNavigator({ initialRouteName, children, ...rest }) {
  const { state, navigation, descriptors } = useNavigationBuilder(StackRouter, {
    initialRouteName,
    children,
  });

  return (
    <StackView
      state={state}
      navigation={navigation}
      descriptors={descriptors}
      {...rest}
    />
  );
}

export default createNavigator(StackNavigator);