From 98d8862cc000a76e01b480b784483b8af1761191 Mon Sep 17 00:00:00 2001 From: Kimi Yap Date: Tue, 29 Oct 2024 22:34:43 +0800 Subject: [PATCH] fix: add missing article link and fix orientation issue Signed-off-by: Kimi Yap --- app/meditation/meditation.tsx | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/app/meditation/meditation.tsx b/app/meditation/meditation.tsx index 1061f9d..ed9529a 100644 --- a/app/meditation/meditation.tsx +++ b/app/meditation/meditation.tsx @@ -1,9 +1,18 @@ import {useState, useRef} from 'react'; -import {View, Text, StyleSheet, TouchableOpacity} from 'react-native'; +import { + View, + Text, + StyleSheet, + TouchableOpacity, + Pressable, + BackHandler, +} from 'react-native'; import Slider from '@react-native-community/slider'; import {Audio} from 'expo-av'; import {MaterialIcons} from '@expo/vector-icons'; import {Image} from 'expo-image'; +import {router} from 'expo-router'; +import * as ScreenOrientation from 'expo-screen-orientation'; export default function Meditation() { const [sound, setSound] = useState(null); @@ -91,6 +100,16 @@ export default function Meditation() { return minutes + ':' + (Number(seconds) < 10 ? '0' : '') + seconds; }; + async function changeOrientation() { + await ScreenOrientation.lockAsync(2); // Sets to ANY portrait + } + + BackHandler.addEventListener('hardwareBackPress', function () { + changeOrientation(); + }); + + changeOrientation(); + return ( @@ -166,9 +185,15 @@ export default function Meditation() { Increase Productivity - + + router.push( + '/thisarticle?category=Self Care&title=Mindful Pause&id=0', + ) + } + > Read more - + ); }