From 9a456fefcf08ea5b6d0284524c2e7f130180134a Mon Sep 17 00:00:00 2001 From: tsai phan Date: Fri, 30 Jun 2017 12:28:18 +0800 Subject: [PATCH] [react-navigation] strictNullChecks, and tests. --- .../react-navigation-tests.tsx | 31 +++++++++++++++++++ types/react-navigation/tsconfig.json | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 1840fd7ccf..caa8b37843 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -27,6 +27,7 @@ import { TabNavigatorConfig, Transitioner, addNavigationHelpers, + HeaderBackButton, } from 'react-navigation'; // Constants @@ -97,6 +98,9 @@ class NextScreen extends React.Component { } } +const navigationOptions = { + headerBackTitle: null, +}; const initialRouteParams: StartScreenNavigationParams = { id: 1, s: "Start", @@ -116,6 +120,7 @@ export const AppNavigator = StackNavigator( { initialRouteName: ROUTE_NAME_START_SCREEN, initialRouteParams, + navigationOptions, }, ); @@ -227,6 +232,32 @@ class CustomTransitioner extends React.Component } } +/** + * Header + */ +function renderHeaderBackButton(schema: string): JSX.Element { + switch ( schema ) { + case 'compact': + return ( + + ); + + default: + return ( + 'noop'} + pressColorAndroid="#ccc" + title="Press Me" + titleStyle={{ color: '#333' }} + tintColor="#2196f3" + truncatedTitle="Press" + width={85} + /> + ); + } +} + + const initAction: NavigationInitAction = NavigationActions.init({ params: { foo: "bar" diff --git a/types/react-navigation/tsconfig.json b/types/react-navigation/tsconfig.json index ad15863a78..bbf721c233 100644 --- a/types/react-navigation/tsconfig.json +++ b/types/react-navigation/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "jsx": "react", "typeRoots": [