From 4db67a17a65b78f69f4a47e79096cb7edc747038 Mon Sep 17 00:00:00 2001 From: "satyajit.happy" Date: Sun, 14 Jul 2019 21:55:19 +0200 Subject: [PATCH] refactor: don't use keyboardAwareNavigator The HOC currently forces us to expose some options in stack config which we don't want to. So we vendor this functionality for now to avoid this. --- packages/stack/example/App.js | 6 ++ packages/stack/example/src/StackWithInput.js | 58 +++++++++++++++++++ packages/stack/package.json | 1 - .../NestedNavigator.test.tsx.snap | 2 - .../StackNavigator.test.tsx.snap | 2 - .../src/navigators/createStackNavigator.tsx | 19 ++++-- packages/stack/src/views/KeyboardManager.tsx | 52 +++++++++++++++++ packages/stack/src/views/Stack/Stack.tsx | 36 ++++-------- packages/stack/src/views/Stack/StackItem.tsx | 42 +++++++------- packages/stack/src/views/Stack/StackView.tsx | 24 +++----- 10 files changed, 170 insertions(+), 72 deletions(-) create mode 100644 packages/stack/example/src/StackWithInput.js create mode 100644 packages/stack/src/views/KeyboardManager.tsx diff --git a/packages/stack/example/App.js b/packages/stack/example/App.js index 259a2205..018cb1c9 100644 --- a/packages/stack/example/App.js +++ b/packages/stack/example/App.js @@ -23,6 +23,7 @@ import LifecycleInteraction from './src/LifecycleInteraction'; import GestureInteraction from './src/GestureInteraction'; import SwitchWithStacks from './src/SwitchWithStacks'; import StackWithDrawer from './src/StackWithDrawer'; +import StackWithInput from './src/StackWithInput'; import HeaderPreset from './src/HeaderPreset'; import { HeaderBackgroundDefault, @@ -75,6 +76,11 @@ const data = [ title: 'Stack with drawer inside', routeName: 'StackWithDrawer', }, + { + component: StackWithInput, + title: 'Stack with text input', + routeName: 'StackWithInput', + }, { component: HeaderBackgroundDefault, title: 'Header background (UIKit transition)', diff --git a/packages/stack/example/src/StackWithInput.js b/packages/stack/example/src/StackWithInput.js new file mode 100644 index 00000000..344ecf26 --- /dev/null +++ b/packages/stack/example/src/StackWithInput.js @@ -0,0 +1,58 @@ +import * as React from 'react'; +import { Button, TextInput, View } from 'react-native'; +import { + createStackNavigator, + TransitionPresets, +} from 'react-navigation-stack'; + +class Input extends React.Component { + static navigationOptions = { + title: 'Input screen', + }; + + render() { + return ( + + ); + } +} + +class Home extends React.Component { + static navigationOptions = { + title: 'Home', + }; + + render() { + return ( + +