@@ -55,30 +55,33 @@ export default function BrowserScreen() {
5555 outputRange : [ KEYBOARD_CLOSED_HEIGHT , KEYBOARD_OPENED_HEIGHT ] ,
5656 } ) ;
5757
58- const addressBarStyle = useMemo (
58+ const bottomContainerY = useMemo ( ( ) => new Animated . Value ( 0 ) , [ ] ) ;
59+
60+ useEffect ( ( ) => {
61+ Animated . timing ( bottomContainerY , {
62+ toValue : showBottomContainer ? 0 : 200 ,
63+ duration : 400 ,
64+ useNativeDriver : true ,
65+ } ) . start ( ) ;
66+ } , [ showBottomContainer , bottomContainerY ] ) ;
67+
68+ const bottomContainerStyle = useMemo (
5969 ( ) => [
6070 {
6171 transform : [
6272 {
6373 translateY : Animated . add ( height , offset ) ,
6474 } ,
75+ {
76+ translateY : bottomContainerY ,
77+ } ,
6578 ] ,
6679 } ,
6780 { backgroundColor : "white" } ,
6881 ] ,
69- [ height , offset ]
82+ [ height , offset , bottomContainerY ]
7083 ) ;
7184
72- const bottomContainerY = useMemo ( ( ) => new Animated . Value ( 0 ) , [ ] ) ;
73-
74- useEffect ( ( ) => {
75- Animated . timing ( bottomContainerY , {
76- toValue : showBottomContainer ? 0 : 200 ,
77- duration : 400 ,
78- useNativeDriver : true ,
79- } ) . start ( ) ;
80- } , [ showBottomContainer , bottomContainerY ] ) ;
81-
8285 return (
8386 < View style = { { flex : 1 } } >
8487 < SafeAreaView
@@ -96,25 +99,11 @@ export default function BrowserScreen() {
9699 </ View >
97100 </ SafeAreaView >
98101
99- < Animated . View
100- style = { [
101- styles . bottomContainer ,
102- {
103- backgroundColor : "white" ,
104- transform : [ { translateY : bottomContainerY } ] ,
105- position : "absolute" ,
106- left : 0 ,
107- right : 0 ,
108- bottom : 0 ,
109- } ,
110- ] }
111- >
112- < Animated . View style = { addressBarStyle } >
113- { showAddressBar && (
114- < AddressBar onFocusChange = { onAddressBarFocusChange } />
115- ) }
116- { ! showAddressBar && < AddressBarDisplay /> }
117- </ Animated . View >
102+ < Animated . View style = { [ styles . bottomContainer , bottomContainerStyle ] } >
103+ { showAddressBar && (
104+ < AddressBar onFocusChange = { onAddressBarFocusChange } />
105+ ) }
106+ { ! showAddressBar && < AddressBarDisplay /> }
118107 { /* Toolbar contains the SafeAreaView */ }
119108 < Toolbar />
120109 </ Animated . View >
@@ -132,5 +121,10 @@ const styles = StyleSheet.create({
132121 } ,
133122 bottomContainer : {
134123 width : "100%" ,
124+ backgroundColor : "white" ,
125+ position : "absolute" ,
126+ left : 0 ,
127+ right : 0 ,
128+ bottom : 0 ,
135129 } ,
136130} ) ;
0 commit comments