11import { useTheme } from "@/src/theme/useTheme" ;
2- import { useCallback , useEffect , useMemo , useState } from "react" ;
2+ import { useCallback , useEffect , useMemo , useRef , useState } from "react" ;
33import { Animated , StyleSheet , View } from "react-native" ;
44import {
55 KeyboardEvents ,
@@ -82,6 +82,14 @@ export default function BrowserScreen() {
8282 [ height , offset , bottomContainerY ]
8383 ) ;
8484
85+ // Navigation handlers for WebView
86+ const webviewRef = useRef < any > ( null ) ;
87+
88+ const goBack = ( ) => webviewRef . current ?. goBack ?.( ) ;
89+ const goForward = ( ) => webviewRef . current ?. goForward ?.( ) ;
90+ const reload = ( ) => webviewRef . current ?. reload ?.( ) ;
91+ const stopLoading = ( ) => webviewRef . current ?. stopLoading ?.( ) ;
92+
8593 return (
8694 < View style = { { flex : 1 } } >
8795 < SafeAreaView
@@ -93,6 +101,11 @@ export default function BrowserScreen() {
93101 >
94102 < View style = { styles . webViewContainer } >
95103 < WebViewContainer
104+ ref = { webviewRef }
105+ goBack = { goBack }
106+ goForward = { goForward }
107+ reload = { reload }
108+ stopLoading = { stopLoading }
96109 bottomPadding = { isKeyboardVisible ? 16 : 0 }
97110 onScrollDirectionChange = { setScrollDirection }
98111 />
@@ -101,11 +114,15 @@ export default function BrowserScreen() {
101114
102115 < Animated . View style = { [ styles . bottomContainer , bottomContainerStyle ] } >
103116 { showAddressBar && (
104- < AddressBar onFocusChange = { onAddressBarFocusChange } />
117+ < AddressBar
118+ onReload = { reload }
119+ onStop = { stopLoading }
120+ onFocusChange = { onAddressBarFocusChange }
121+ />
105122 ) }
106123 { ! showAddressBar && < AddressBarDisplay /> }
107124 { /* Toolbar contains the SafeAreaView */ }
108- < Toolbar />
125+ < Toolbar onBack = { goBack } onForward = { goForward } />
109126 </ Animated . View >
110127 </ View >
111128 ) ;
0 commit comments