Skip to content

Commit

Permalink
Super secret changes don't look (bluesky-social#2218)
Browse files Browse the repository at this point in the history
* Swap in new assets

* Refine
  • Loading branch information
estrattonbailey authored Dec 15, 2023
1 parent ce6d3fa commit dd07437
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
Binary file modified assets/icon-android-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/splash-with-logo.png
Binary file not shown.
Binary file modified assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 26 additions & 16 deletions src/Splash.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useCallback, useEffect} from 'react'
import {View, StyleSheet} from 'react-native'
import {View, StyleSheet, Image as RNImage} from 'react-native'
import * as SplashScreen from 'expo-splash-screen'
import LinearGradient from 'react-native-linear-gradient'
import {Image} from 'expo-image'
import Animated, {
interpolate,
runOnJS,
Expand All @@ -14,6 +14,10 @@ import MaskedView from '@react-native-masked-view/masked-view'
import {useSafeAreaInsets} from 'react-native-safe-area-context'
import Svg, {Path, SvgProps} from 'react-native-svg'

// @ts-ignore
import splashImagePointer from '../assets/splash.png'
const splashImageUri = RNImage.resolveAssetSource(splashImagePointer).uri

export const Logo = React.forwardRef(function LogoImpl(props: SvgProps, ref) {
const width = 1000
const height = width * (67 / 64)
Expand Down Expand Up @@ -46,6 +50,8 @@ export function Splash(props: React.PropsWithChildren<Props>) {
const outroLogo = useSharedValue(0)
const outroApp = useSharedValue(0)
const [isAnimationComplete, setIsAnimationComplete] = React.useState(false)
const [isImageLoaded, setIsImageLoaded] = React.useState(false)
const isReady = props.isReady && isImageLoaded

const logoAnimations = useAnimatedStyle(() => {
return {
Expand All @@ -57,7 +63,7 @@ export function Splash(props: React.PropsWithChildren<Props>) {
scale: interpolate(
outroLogo.value,
[0, 0.06, 0.08, 1],
[1, 0.8, 0.8, 800],
[1, 0.8, 0.8, 400],
'clamp',
),
},
Expand All @@ -70,29 +76,27 @@ export function Splash(props: React.PropsWithChildren<Props>) {
return {
transform: [
{
scale: interpolate(
outroApp.value,
[0, 0.7, 1],
[1.1, 1.1, 1],
'clamp',
),
scale: interpolate(outroApp.value, [0, 1], [1.1, 1], 'clamp'),
},
],
opacity: interpolate(outroApp.value, [0, 0.7, 1], [0, 0, 1], 'clamp'),
opacity: interpolate(outroApp.value, [0, 0.7, 1], [0, 1, 1], 'clamp'),
}
})

const onFinish = useCallback(() => setIsAnimationComplete(true), [])

useEffect(() => {
if (props.isReady) {
if (isReady) {
// hide on mount
SplashScreen.hideAsync().catch(() => {})

intro.value = withTiming(
1,
{duration: 200, easing: Easing.out(Easing.cubic)},
{duration: 800, easing: Easing.out(Easing.cubic)},
async () => {
// set these values to check animation at specific point
// outroLogo.value = 0.1
// outroApp.value = 0.1
outroLogo.value = withTiming(
1,
{duration: 1200, easing: Easing.in(Easing.cubic)},
Expand All @@ -110,14 +114,20 @@ export function Splash(props: React.PropsWithChildren<Props>) {
},
)
}
}, [onFinish, intro, outroLogo, outroApp, props.isReady])
}, [onFinish, intro, outroLogo, outroApp, isReady])

const onLoadEnd = useCallback(() => {
setIsImageLoaded(true)
}, [setIsImageLoaded])

return (
<View style={{flex: 1}}>
{!isAnimationComplete && (
<LinearGradient
colors={['#0A7AFF', '#59B9FF']}
style={[StyleSheet.absoluteFillObject]}
<Image
accessibilityIgnoresInvertColors
onLoadEnd={onLoadEnd}
source={{uri: splashImageUri}}
style={StyleSheet.absoluteFillObject}
/>
)}

Expand Down

0 comments on commit dd07437

Please sign in to comment.