├── .expo-shared └── assets.json ├── .gitignore ├── App.js ├── LICENSE ├── app.json ├── assets ├── adaptive-icon.png ├── data │ └── notifications.js ├── favicon.png ├── icon.png ├── images │ ├── Parallax │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ └── 5.png │ ├── apps │ │ ├── calendar.png │ │ ├── fitness.webp │ │ └── mail.png │ ├── bg.jpeg │ ├── home.png │ ├── home2.jpg │ └── wallpaper.webp └── splash.png ├── babel.config.js ├── package-lock.json ├── package.json └── src ├── components ├── NotificationItem.js ├── NotificationsList.js ├── Parallax.js ├── SensorAnimatedImage.js └── SwipeUpToOpen.js └── screens └── LockScreen.js /.expo-shared/assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true, 3 | "40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .expo/ 3 | dist/ 4 | npm-debug.* 5 | *.jks 6 | *.p8 7 | *.p12 8 | *.key 9 | *.mobileprovision 10 | *.orig.* 11 | web-build/ 12 | 13 | # macOS 14 | .DS_Store 15 | -------------------------------------------------------------------------------- /App.js: -------------------------------------------------------------------------------- 1 | import { View, StyleSheet, Image } from "react-native"; 2 | import { StatusBar } from "expo-status-bar"; 3 | import { GestureHandlerRootView } from "react-native-gesture-handler"; 4 | import bg from "./assets/images/bg.jpeg"; 5 | import SensorAnimatedImage from "./src/components/SensorAnimatedImage"; 6 | import Parallax from "./src/components/Parallax"; 7 | import LockScreen from "./src/screens/LockScreen"; 8 | 9 | import layer1 from "./assets/images/Parallax/2.png"; 10 | import layer2 from "./assets/images/Parallax/3.png"; 11 | import layer3 from "./assets/images/Parallax/4.png"; 12 | import layer4 from "./assets/images/Parallax/5.png"; 13 | 14 | const App = () => { 15 | return ( 16 | 17 | {/* */} 18 | 19 | 20 | 21 | 22 | 23 | ); 24 | }; 25 | 26 | const styles = StyleSheet.create({ 27 | container: { 28 | flex: 1, 29 | width: "100%", 30 | alignItems: "center", 31 | justifyContent: "center", 32 | }, 33 | }); 34 | 35 | export default App; 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 notJust.dev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "iOSLockScreen", 4 | "slug": "iOSLockScreen", 5 | "version": "1.0.0", 6 | "orientation": "portrait", 7 | "icon": "./assets/icon.png", 8 | "userInterfaceStyle": "light", 9 | "splash": { 10 | "image": "./assets/splash.png", 11 | "resizeMode": "contain", 12 | "backgroundColor": "#ffffff" 13 | }, 14 | "updates": { 15 | "fallbackToCacheTimeout": 0 16 | }, 17 | "assetBundlePatterns": [ 18 | "**/*" 19 | ], 20 | "ios": { 21 | "supportsTablet": true 22 | }, 23 | "android": { 24 | "adaptiveIcon": { 25 | "foregroundImage": "./assets/adaptive-icon.png", 26 | "backgroundColor": "#FFFFFF" 27 | } 28 | }, 29 | "web": { 30 | "favicon": "./assets/favicon.png" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /assets/adaptive-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/adaptive-icon.png -------------------------------------------------------------------------------- /assets/data/notifications.js: -------------------------------------------------------------------------------- 1 | import calendar from "../images/apps/calendar.png"; 2 | import fitness from "../images/apps/fitness.webp"; 3 | import mail from "../images/apps/mail.png"; 4 | 5 | export default [ 6 | { 7 | id: "1", 8 | createdAt: "1m", 9 | icon: fitness, 10 | title: "Keep it going", 11 | subtitle: "Your best day this week was Friday. Finish the week strong.", 12 | }, 13 | { 14 | id: "2", 15 | createdAt: "10m", 16 | icon: calendar, 17 | title: "Team meeting", 18 | subtitle: "10:00 - 11:00", 19 | }, 20 | { 21 | id: "3", 22 | createdAt: "45m", 23 | icon: mail, 24 | title: "notJust.dev inquiry", 25 | subtitle: "Hey Vadim, how is it going? ", 26 | }, 27 | { 28 | id: "4", 29 | createdAt: "1h", 30 | icon: calendar, 31 | title: "Team meeting", 32 | subtitle: "10:00 - 11:00", 33 | }, 34 | { 35 | id: "5", 36 | createdAt: "2h", 37 | icon: calendar, 38 | title: "Team meeting", 39 | subtitle: "10:00 - 11:00", 40 | }, 41 | { 42 | id: "6", 43 | createdAt: "5h", 44 | icon: mail, 45 | title: "Hola Vadim", 46 | subtitle: 47 | "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing", 48 | }, 49 | { 50 | id: "7", 51 | createdAt: "6h", 52 | icon: mail, 53 | title: "To the moon", 54 | subtitle: "Lorem Ipsum is simply dummy text of the printing ", 55 | }, 56 | { 57 | id: "8", 58 | createdAt: "6h", 59 | icon: fitness, 60 | title: "10,000 steps", 61 | subtitle: "Your best day this week was Friday. Finish the week strong.", 62 | }, 63 | { 64 | id: "9", 65 | createdAt: "2h", 66 | icon: calendar, 67 | title: "Team meeting", 68 | subtitle: "10:00 - 11:00", 69 | }, 70 | { 71 | id: "10", 72 | createdAt: "6h", 73 | icon: fitness, 74 | title: "10,000 steps", 75 | subtitle: "Your best day this week was Friday. Finish the week strong.", 76 | }, 77 | { 78 | id: "11", 79 | createdAt: "6h", 80 | icon: fitness, 81 | title: "10,000 steps", 82 | subtitle: "Your best day this week was Friday. Finish the week strong.", 83 | }, 84 | { 85 | id: "12", 86 | createdAt: "6h", 87 | icon: fitness, 88 | title: "10,000 steps", 89 | subtitle: "Your best day this week was Friday. Finish the week strong.", 90 | }, 91 | { 92 | id: "13", 93 | createdAt: "6h", 94 | icon: fitness, 95 | title: "10,000 steps", 96 | subtitle: "Your best day this week was Friday. Finish the week strong.", 97 | }, 98 | { 99 | id: "14", 100 | createdAt: "6h", 101 | icon: fitness, 102 | title: "10,000 steps", 103 | subtitle: "Your best day this week was Friday. Finish the week strong.", 104 | }, 105 | { 106 | id: "15", 107 | createdAt: "6h", 108 | icon: fitness, 109 | title: "10,000 steps", 110 | subtitle: "Your best day this week was Friday. Finish the week strong.", 111 | }, 112 | { 113 | id: "16", 114 | createdAt: "6h", 115 | icon: fitness, 116 | title: "10,000 steps", 117 | subtitle: "Your best day this week was Friday. Finish the week strong.", 118 | }, 119 | ]; 120 | -------------------------------------------------------------------------------- /assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/favicon.png -------------------------------------------------------------------------------- /assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/icon.png -------------------------------------------------------------------------------- /assets/images/Parallax/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/Parallax/1.png -------------------------------------------------------------------------------- /assets/images/Parallax/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/Parallax/2.png -------------------------------------------------------------------------------- /assets/images/Parallax/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/Parallax/3.png -------------------------------------------------------------------------------- /assets/images/Parallax/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/Parallax/4.png -------------------------------------------------------------------------------- /assets/images/Parallax/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/Parallax/5.png -------------------------------------------------------------------------------- /assets/images/apps/calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/apps/calendar.png -------------------------------------------------------------------------------- /assets/images/apps/fitness.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/apps/fitness.webp -------------------------------------------------------------------------------- /assets/images/apps/mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/apps/mail.png -------------------------------------------------------------------------------- /assets/images/bg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/bg.jpeg -------------------------------------------------------------------------------- /assets/images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/home.png -------------------------------------------------------------------------------- /assets/images/home2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/home2.jpg -------------------------------------------------------------------------------- /assets/images/wallpaper.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/images/wallpaper.webp -------------------------------------------------------------------------------- /assets/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notJust-dev/iOSLockScreen/d04557be35f3cafefbd68b4d8b40a326da62bee3/assets/splash.png -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | api.cache(true); 3 | return { 4 | presets: ["babel-preset-expo"], 5 | plugins: ["react-native-reanimated/plugin"], 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ioslockscreen", 3 | "version": "1.0.0", 4 | "main": "node_modules/expo/AppEntry.js", 5 | "scripts": { 6 | "start": "expo start", 7 | "android": "expo start --android", 8 | "ios": "expo start --ios", 9 | "web": "expo start --web" 10 | }, 11 | "dependencies": { 12 | "dayjs": "^1.11.5", 13 | "expo": "~46.0.13", 14 | "expo-status-bar": "~1.4.0", 15 | "react": "18.0.0", 16 | "react-native": "0.69.6", 17 | "react-native-reanimated": "~2.9.1", 18 | "expo-blur": "~11.2.0", 19 | "react-native-gesture-handler": "~2.5.0" 20 | }, 21 | "devDependencies": { 22 | "@babel/core": "^7.12.9" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /src/components/NotificationItem.js: -------------------------------------------------------------------------------- 1 | import { 2 | View, 3 | Text, 4 | StyleSheet, 5 | Image, 6 | useWindowDimensions, 7 | } from "react-native"; 8 | import Animated, { 9 | useAnimatedStyle, 10 | interpolate, 11 | withTiming, 12 | Extrapolate, 13 | useDerivedValue, 14 | } from "react-native-reanimated"; 15 | import { BlurView } from "expo-blur"; 16 | 17 | export const NOTIFICATION_HEIGHT = 80; 18 | 19 | const NotificationItem = ({ 20 | data, 21 | index, 22 | listVisibility, 23 | scrollY, 24 | footerHeight, 25 | }) => { 26 | const { height } = useWindowDimensions(); 27 | const containerHeight = useDerivedValue( 28 | () => height - 250 - footerHeight.value 29 | ); 30 | 31 | const startPosition = NOTIFICATION_HEIGHT * index; 32 | 33 | const animatedStyle = useAnimatedStyle(() => { 34 | const pos1 = startPosition - containerHeight.value; 35 | const pos2 = startPosition + NOTIFICATION_HEIGHT - containerHeight.value; 36 | 37 | if (listVisibility.value >= 1) { 38 | // we are animating the last visible item 39 | return { 40 | opacity: interpolate(scrollY.value, [pos1, pos2], [0, 1]), 41 | transform: [ 42 | { 43 | translateY: interpolate( 44 | scrollY.value, 45 | [pos1, pos2], 46 | [-NOTIFICATION_HEIGHT / 2, 0], 47 | Extrapolate.CLAMP 48 | ), 49 | }, 50 | { 51 | scale: interpolate( 52 | scrollY.value, 53 | [pos1, pos2], 54 | [0.8, 1], 55 | Extrapolate.CLAMP 56 | ), 57 | }, 58 | ], 59 | }; 60 | } else { 61 | // animate all items to hide them 62 | return { 63 | transform: [ 64 | { 65 | translateY: interpolate( 66 | listVisibility.value, 67 | [0, 1], 68 | [containerHeight.value - startPosition, 0] 69 | ), 70 | }, 71 | { 72 | scale: interpolate(listVisibility.value, [0, 1], [0.5, 1]), 73 | }, 74 | ], 75 | opacity: listVisibility.value, 76 | }; 77 | } 78 | }); 79 | 80 | return ( 81 | 82 | 83 | 84 | 85 | {data.title} 86 | 87 | {data.subtitle} 88 | 89 | 90 | {data.createdAt} ago 91 | 92 | 93 | ); 94 | }; 95 | 96 | const styles = StyleSheet.create({ 97 | container: { 98 | height: NOTIFICATION_HEIGHT - 10, 99 | // backgroundColor: "#00000075", 100 | margin: 5, 101 | marginHorizontal: 10, 102 | padding: 13, 103 | borderRadius: 20, 104 | flexDirection: "row", 105 | alignItems: "center", 106 | overflow: "hidden", 107 | }, 108 | time: { 109 | color: "lightgray", 110 | fontSize: 12, 111 | position: "absolute", 112 | right: 10, 113 | top: 10, 114 | }, 115 | icon: { 116 | width: 40, 117 | height: 40, 118 | marginRight: 10, 119 | }, 120 | title: { 121 | color: "white", 122 | fontWeight: "500", 123 | letterSpacing: 0.2, 124 | }, 125 | subtitle: { 126 | color: "white", 127 | lineHeight: 18, 128 | letterSpacing: 0.2, 129 | }, 130 | }); 131 | 132 | export default NotificationItem; 133 | -------------------------------------------------------------------------------- /src/components/NotificationsList.js: -------------------------------------------------------------------------------- 1 | import { FlatList, useWindowDimensions } from "react-native"; 2 | 3 | import notifications from "../../assets/data/notifications"; 4 | 5 | import NotificationItem from "./NotificationItem"; 6 | import Animated, { 7 | useAnimatedScrollHandler, 8 | withTiming, 9 | withSpring, 10 | useSharedValue, 11 | } from "react-native-reanimated"; 12 | 13 | const NotificationsList = ({ 14 | footerVisibility, 15 | footerHeight, 16 | ...flatListProps 17 | }) => { 18 | const { height } = useWindowDimensions(); 19 | const listVisibility = useSharedValue(1); 20 | const scrollY = useSharedValue(0); 21 | 22 | const handler = useAnimatedScrollHandler({ 23 | onScroll: (event) => { 24 | const y = event.contentOffset.y; 25 | scrollY.value = y; 26 | if (y < 10) { 27 | // here we should have the footer opened 28 | footerVisibility.value = withTiming(1); 29 | } else { 30 | // close the footer 31 | footerVisibility.value = withTiming(0); 32 | } 33 | }, 34 | onBeginDrag: (event) => { 35 | if (listVisibility.value < 1) { 36 | listVisibility.value = withSpring(1); 37 | } 38 | }, 39 | onEndDrag: (event) => { 40 | if (event.contentOffset.y < 0) { 41 | listVisibility.value = withTiming(0); 42 | } 43 | }, 44 | }); 45 | 46 | return ( 47 | ( 50 | 57 | )} 58 | {...flatListProps} 59 | onScroll={handler} 60 | scrollEventThrottle={16} 61 | /> 62 | ); 63 | }; 64 | 65 | export default NotificationsList; 66 | -------------------------------------------------------------------------------- /src/components/Parallax.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import SensorAnimatedImage from "./SensorAnimatedImage"; 3 | 4 | const Parallax = ({ layers }) => { 5 | return ( 6 | <> 7 | {layers.reverse().map((layer, index) => ( 8 | 13 | ))} 14 | 15 | ); 16 | }; 17 | 18 | export default Parallax; 19 | -------------------------------------------------------------------------------- /src/components/SensorAnimatedImage.js: -------------------------------------------------------------------------------- 1 | import { useWindowDimensions } from "react-native"; 2 | import Animated, { 3 | useAnimatedSensor, 4 | SensorType, 5 | useAnimatedStyle, 6 | interpolate, 7 | withTiming, 8 | } from "react-native-reanimated"; 9 | 10 | const IMAGE_OFFSET = 100; 11 | const PI = Math.PI; 12 | const HALF_PI = PI / 2; 13 | 14 | const SensorAnimatedImage = ({ image, order }) => { 15 | const { width, height } = useWindowDimensions(); 16 | 17 | const sensor = useAnimatedSensor(SensorType.ROTATION); 18 | 19 | const imageStyle = useAnimatedStyle(() => { 20 | const { pitch, roll } = sensor.sensor.value; 21 | 22 | return { 23 | top: withTiming( 24 | interpolate( 25 | pitch, 26 | [-HALF_PI, HALF_PI], 27 | [(-IMAGE_OFFSET * 2) / order, 0] 28 | ), 29 | { duration: 100 } 30 | ), 31 | left: withTiming( 32 | interpolate(roll, [-PI, PI], [(-IMAGE_OFFSET * 2) / order, 0]), 33 | { 34 | duration: 100, 35 | } 36 | ), 37 | }; 38 | }); 39 | 40 | return ( 41 | 52 | ); 53 | }; 54 | 55 | export default SensorAnimatedImage; 56 | -------------------------------------------------------------------------------- /src/components/SwipeUpToOpen.js: -------------------------------------------------------------------------------- 1 | import { Text } from "react-native"; 2 | import Animated, { 3 | useAnimatedStyle, 4 | withTiming, 5 | withRepeat, 6 | withSequence, 7 | withDelay, 8 | } from "react-native-reanimated"; 9 | 10 | const SwipeUpToOpen = () => { 11 | const animatedStyles = useAnimatedStyle(() => ({ 12 | transform: [ 13 | { 14 | translateY: withRepeat( 15 | withSequence( 16 | withTiming(-15, { duration: 300 }), 17 | withDelay(1500, withTiming(0, { duration: 3000 })), 18 | withTiming(-15) 19 | ), 20 | -1 21 | ), 22 | }, 23 | ], 24 | opacity: withRepeat( 25 | withSequence( 26 | withDelay(1500, withTiming(0)), 27 | withDelay(3000, withTiming(1)) 28 | ), 29 | -1 30 | ), 31 | })); 32 | 33 | return ( 34 | 45 | Swipe up to open 46 | 47 | ); 48 | }; 49 | 50 | export default SwipeUpToOpen; 51 | -------------------------------------------------------------------------------- /src/screens/LockScreen.js: -------------------------------------------------------------------------------- 1 | import { useState, useEffect, useMemo } from "react"; 2 | import { 3 | StyleSheet, 4 | Text, 5 | View, 6 | ImageBackground, 7 | useWindowDimensions, 8 | Image, 9 | } from "react-native"; 10 | import wallpaper from "../../assets/images/wallpaper.webp"; 11 | import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"; 12 | import dayjs from "dayjs"; 13 | import NotificationsList from "../components/NotificationsList"; 14 | import SwipeUpToOpen from "../components/SwipeUpToOpen"; 15 | import home2 from "../../assets/images/home2.jpg"; 16 | 17 | import { PanGestureHandler } from "react-native-gesture-handler"; 18 | import { BlurView } from "expo-blur"; 19 | 20 | import Animated, { 21 | SlideInDown, 22 | SlideInUp, 23 | useSharedValue, 24 | useAnimatedStyle, 25 | interpolate, 26 | useDerivedValue, 27 | useAnimatedGestureHandler, 28 | withTiming, 29 | Easing, 30 | useAnimatedProps, 31 | } from "react-native-reanimated"; 32 | 33 | const AnimatedBlurView = Animated.createAnimatedComponent(BlurView); 34 | 35 | export default function App() { 36 | const [date, setDate] = useState(dayjs()); 37 | const { height } = useWindowDimensions(); 38 | const y = useSharedValue(height); 39 | 40 | const footerVisibility = useSharedValue(1); 41 | const footerHeight = useDerivedValue(() => 42 | interpolate(footerVisibility.value, [0, 1], [0, 85]) 43 | ); 44 | 45 | useEffect(() => { 46 | const interval = setInterval(() => { 47 | setDate(dayjs()); 48 | }, 1000 * 60); 49 | 50 | return () => clearInterval(interval); 51 | }, []); 52 | 53 | const animatedFooterStyle = useAnimatedStyle(() => ({ 54 | marginTop: interpolate(footerVisibility.value, [0, 1], [-85, 0]), 55 | opacity: footerVisibility.value, 56 | })); 57 | 58 | const animatedContainerStyle = useAnimatedStyle(() => ({ 59 | transform: [ 60 | { 61 | translateY: withTiming(y.value - height, { 62 | duration: 100, 63 | easing: Easing.linear, 64 | }), 65 | }, 66 | ], 67 | })); 68 | 69 | const unlockGestureHandler = useAnimatedGestureHandler({ 70 | onActive: (event) => { 71 | y.value = event.absoluteY; 72 | }, 73 | onEnd: (event) => { 74 | if (event.velocityY < -500) { 75 | // unlock 76 | y.value = withTiming(0, { easing: Easing.linear }); 77 | } else if (event.velocityY > 500) { 78 | // reset 79 | y.value = withTiming(height, { easing: Easing.linear }); 80 | } else if (y.value < height / 2 || event.velocityY < -500) { 81 | // unlock 82 | y.value = withTiming(0, { easing: Easing.linear }); 83 | } else { 84 | // reset 85 | y.value = withTiming(height, { easing: Easing.linear }); 86 | } 87 | }, 88 | }); 89 | 90 | const homeScreenBlur = useAnimatedProps(() => ({ 91 | intensity: interpolate(y.value, [0, height], [0, 100]), 92 | })); 93 | 94 | const lockScreenBlur = useAnimatedProps(() => ({ 95 | intensity: interpolate(y.value, [0, height], [100, 0]), 96 | })); 97 | 98 | const Header = useMemo( 99 | () => ( 100 | 101 | 102 | {date.format("dddd, DD MMMM")} 103 | {date.format("hh:mm")} 104 | 105 | ), 106 | [date] 107 | ); 108 | 109 | return ( 110 | <> 111 | {/* Home Screen */} 112 | 116 | {/* Lock Screen */} 117 | 121 | 122 | 123 | 131 | {/* Notification List */} 132 | 137 | 138 | 142 | 143 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | ); 164 | } 165 | 166 | const styles = StyleSheet.create({ 167 | container: { 168 | flex: 1, 169 | width: "100%", 170 | }, 171 | header: { 172 | alignItems: "center", 173 | justifyContent: "center", 174 | height: 250, 175 | }, 176 | date: { 177 | color: "#C3FFFE", 178 | fontSize: 20, 179 | fontWeight: "500", 180 | marginTop: 20, 181 | }, 182 | time: { 183 | fontSize: 82, 184 | fontWeight: "bold", 185 | color: "#C3FFFE", 186 | }, 187 | footer: { 188 | flexDirection: "row", 189 | justifyContent: "space-between", 190 | marginTop: "auto", 191 | marginBottom: 10, 192 | paddingVertical: 10, 193 | paddingHorizontal: 30, 194 | height: 75, 195 | }, 196 | icon: { 197 | backgroundColor: "#00000050", 198 | width: 50, 199 | aspectRatio: 1, 200 | alignItems: "center", 201 | justifyContent: "center", 202 | borderRadius: 50, 203 | }, 204 | panGestureContainerUnlock: { 205 | position: "absolute", 206 | width: "100%", 207 | height: 200, 208 | bottom: 0, 209 | left: 0, 210 | transform: [ 211 | { 212 | translateY: 100, 213 | }, 214 | ], 215 | }, 216 | }); 217 | --------------------------------------------------------------------------------