Skip to content

Commit

Permalink
fix: refactor pulse bar and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
frankvonhoven committed Jun 28, 2024
1 parent fcb32fb commit f52fdb4
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions app/components/Views/BrowserTab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,15 @@ const createStyles = (colors, shadows) =>
right: 16,
borderRadius: 4,
},
blockingView: {
backgroundColor: colors.primary.inverse,
justifyContent: 'center',
position: 'absolute',
height: '100%',
width: '100%',
opacity: 0.85,
zIndex: 1,
},
});

const sessionENSNames = {};
Expand All @@ -267,6 +276,7 @@ export const BrowserTab = (props) => {
const [ipfsBannerVisible, setIpfsBannerVisible] = useState(false);
const [isResolvedIpfsUrl, setIsResolvedIpfsUrl] = useState(false);
const [pageIsLoaded, setPageIsLoaded] = useState(true);
const pulseOpacity = useRef(new Animated.Value(0.5)).current;
const webviewRef = useRef(null);
const blockListType = useRef('');
const allowList = useRef([]);
Expand Down Expand Up @@ -1164,30 +1174,28 @@ export const BrowserTab = (props) => {
allowList.current = props.whitelist;
};

const opacity = useRef(new Animated.Value(0.5)).current;

useEffect(() => {
Animated.loop(
Animated.sequence([
Animated.timing(opacity, {
Animated.timing(pulseOpacity, {
toValue: 1,
duration: 700,
useNativeDriver: true,
}),
Animated.timing(opacity, {
Animated.timing(pulseOpacity, {
toValue: 0.4,
duration: 700,
useNativeDriver: true,
}),
]),
).start();
}, [opacity]);
}, [pulseOpacity]);

const progressBarPulseContainer = () => (
<Animated.View
style={{

Check failure on line 1196 in app/components/Views/BrowserTab/index.js

View workflow job for this annotation

GitHub Actions / scripts (lint)

Inline style: { zIndex: 2 }
zIndex: 2,
opacity,
opacity: pulseOpacity,
}}
>
{renderProgressBar()}

Check failure on line 1201 in app/components/Views/BrowserTab/index.js

View workflow job for this annotation

GitHub Actions / scripts (lint)

'renderProgressBar' was used before it was defined
Expand Down Expand Up @@ -1536,18 +1544,7 @@ export const BrowserTab = (props) => {
>
<View style={styles.webview}>
{progressBarPulseContainer()}
{!pageIsLoaded ? (
<View
style={{
justifyContent: 'center',
height: '100%',
backgroundColor: '#000000dd',
zIndex: 1,
position: 'absolute',
width: '100%',
}}
/>
) : null}
{!pageIsLoaded && <View style={styles.blockingView} />}
{!!entryScriptWeb3 && firstUrlLoaded && (
<>
<WebView
Expand Down

0 comments on commit f52fdb4

Please sign in to comment.