From cc7eb445d2e30f5ff61764802327ca0b599109aa Mon Sep 17 00:00:00 2001 From: fhelwanger Date: Tue, 20 Feb 2018 13:30:52 -0300 Subject: [PATCH] Update react-router-native types * Fix AndroidBackButton children * Add BackButton component * Add initialEntries and initialIndex to NativeRouter --- types/react-router-native/index.d.ts | 12 ++++++--- .../react-router-native-tests.tsx | 27 ++++++++++--------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/types/react-router-native/index.d.ts b/types/react-router-native/index.d.ts index 4a14dce8dc..7b299be3e9 100644 --- a/types/react-router-native/index.d.ts +++ b/types/react-router-native/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for React Router Native 4.0 +// Type definitions for React Router Native 4.2 // Project: https://github.com/ReactTraining/react-router-native // Definitions by: Eduard Zintz +// Fernando Helwanger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -22,11 +23,12 @@ export { import * as React from 'react'; import * as H from 'history'; -export interface AndroidBackButtonProps { - children: React.Component[]; +export interface BackButtonProps { + children?: React.ReactNode; } -export class AndroidBackButton extends React.Component {} +export class BackButton extends React.Component {} +export class AndroidBackButton extends React.Component {} export class DeepLinking extends React.Component {} @@ -42,6 +44,8 @@ export class Link extends React.Component {} export interface NativeRouterProps { getUserConfirmation?: Function; keyLength?: number; + initialEntries?: string[]; + initialIndex?: number; } export class NativeRouter extends React.Component {} diff --git a/types/react-router-native/react-router-native-tests.tsx b/types/react-router-native/react-router-native-tests.tsx index db52c10299..2cbdfac1b2 100644 --- a/types/react-router-native/react-router-native-tests.tsx +++ b/types/react-router-native/react-router-native-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { StyleSheet, Text, View } from 'react-native'; -import { NativeRouter as Router, Route, Link } from 'react-router-native'; +import { NativeRouter as Router, Route, Link, AndroidBackButton, BackButton } from 'react-router-native'; const Home: React.SFC = () => { return ( @@ -27,19 +27,22 @@ const About: React.SFC = () => { export default class App extends React.Component { render() { return ( - - - - - Home - - + + + + + + + Home + + About - + + + + - - - + ); }