Skip to content

Commit

Permalink
fix progressbar
Browse files Browse the repository at this point in the history
  • Loading branch information
Rider21 committed Mar 8, 2024
1 parent 3d34cfb commit 591d259
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
26 changes: 12 additions & 14 deletions src/screens/WebviewScreen/WebviewScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const WebviewScreen = ({ route, navigation }: WebviewScreenProps) => {
if (!e.loading) {
setTitle(e.title);
}
setLoading(e.loading)
setCurrentUrl(e.url);
setCanGoBack(e.canGoBack);
setCanGoForward(e.canGoForward);
Expand Down Expand Up @@ -74,7 +75,7 @@ const WebviewScreen = ({ route, navigation }: WebviewScreenProps) => {
<Appbar
title={title}
theme={theme}
loading={loading}
loading={loading && progress !== 1}
currentUrl={currentUrl}
canGoBack={canGoBack}
canGoForward={canGoForward}
Expand All @@ -85,27 +86,16 @@ const WebviewScreen = ({ route, navigation }: WebviewScreenProps) => {
navigation.goBack();
}}
/>
{menuVisible ? (
<Menu
theme={theme}
currentUrl={currentUrl}
webView={webViewRef}
setMenuVisible={setMenuVisible}
/>
) : null}
<ProgressBar
color={theme.primary}
progress={progress}
visible={loading}
visible={loading && progress !== 1}
/>
<WebView
userAgent={getUserAgent()}
ref={webViewRef}
source={{ uri }}
onLoadProgress={({ nativeEvent }) => {
setProgress(nativeEvent.progress);
setLoading(nativeEvent.loading);
}}
onLoadProgress={({ nativeEvent }) => setProgress(nativeEvent.progress)}
onNavigationStateChange={handleNavigation}
injectedJavaScript={injectJavaScriptCode}
setDisplayZoomControls={true}
Expand All @@ -115,6 +105,14 @@ const WebviewScreen = ({ route, navigation }: WebviewScreenProps) => {
setTempData(JSON.parse(nativeEvent.data))
}
/>
{menuVisible ? (
<Menu
theme={theme}
currentUrl={currentUrl}
webView={webViewRef}
setMenuVisible={setMenuVisible}
/>
) : null}
</>
);
};
Expand Down
6 changes: 4 additions & 2 deletions src/screens/WebviewScreen/components/Appbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ const Appbar: React.FC<AppbarProps> = ({
<TextTicker
style={{ color: theme.outline, fontSize: 16 }}
loop
scrollSpeed={45}
scrollSpeed={50}
bounceSpeed={60}
marqueeDelay={1000}
isInteraction={false}
bounceDelay={1000}
//isInteraction={false}
disabled={loading}
>
{currentUrl}
Expand Down
4 changes: 2 additions & 2 deletions src/screens/WebviewScreen/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ const Menu: React.FC<MenuProps> = ({
right: 0,
justifyContent: 'center',
alignItems: 'center',
zIndex: 1,
//zIndex: 1,
}}
>
<View style={{ position: 'absolute', right: 0, paddingTop: top }}>
<View style={{ position: 'absolute', right: 0, top: top }}>
<Pressable
style={{ backgroundColor: theme.surface2, padding: 15 }}
onPress={() => {
Expand Down

0 comments on commit 591d259

Please sign in to comment.