diff options
author | Leon Jiang <35908040+leonyjiang@users.noreply.github.com> | 2020-08-27 09:48:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-27 12:48:16 -0400 |
commit | 83e655b9a252cf623b2f5c094212375723457285 (patch) | |
tree | 3ed048cc92507e532d410bc65d26210b76fb1a9d /src/components/onboarding/RegistrationWizard.tsx | |
parent | 72020ab9d2456576b72eb06a05b0649734cef007 (diff) |
[TMA-132] App Splash Screen (#38)
* Add splash screen to onboarding stack
* Fix improper wizard behavior
* Set search bar autoCapitalize to none
* Add splash screen fade transition
* Update stack navigator screenOptions
Diffstat (limited to 'src/components/onboarding/RegistrationWizard.tsx')
-rw-r--r-- | src/components/onboarding/RegistrationWizard.tsx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/components/onboarding/RegistrationWizard.tsx b/src/components/onboarding/RegistrationWizard.tsx index 31c3bbdf..0094c8af 100644 --- a/src/components/onboarding/RegistrationWizard.tsx +++ b/src/components/onboarding/RegistrationWizard.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useEffect} from 'react'; import {View, StyleSheet, ViewProps, Keyboard} from 'react-native'; import * as Animatable from 'react-native-animatable'; @@ -13,12 +13,17 @@ const RegistrationWizard = (props: RegistrationWizardProps) => { // detects visibility of keyboard to display or hide wizard const [keyboardVisible, setKeyboardVisible] = React.useState(false); - Keyboard.addListener('keyboardDidShow', () => { - setKeyboardVisible(true); - }); - Keyboard.addListener('keyboardDidHide', () => { - setKeyboardVisible(false); - }); + useEffect(() => { + const showKeyboard = () => setKeyboardVisible(true); + Keyboard.addListener('keyboardWillShow', showKeyboard); + return () => Keyboard.removeListener('keyboardWillShow', showKeyboard); + }, []); + + useEffect(() => { + const hideKeyboard = () => setKeyboardVisible(false); + Keyboard.addListener('keyboardWillHide', hideKeyboard); + return () => Keyboard.removeListener('keyboardWillHide', hideKeyboard); + }, []); return ( <View {...props}> |