Skip to content

Commit

Permalink
fix: add missing article link and fix orientation issue
Browse files Browse the repository at this point in the history
Signed-off-by: Kimi Yap <[email protected]>
  • Loading branch information
ItsMeKimi committed Oct 29, 2024
1 parent 4773911 commit 9fb33bc
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions app/meditation/meditation.tsx
Original file line number Diff line number Diff line change
@@ -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<Audio.Sound | null>(null);
Expand Down Expand Up @@ -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 (
<View style={styles.container}>
<View>
Expand Down Expand Up @@ -166,9 +185,15 @@ export default function Meditation() {
<Text style={styles.subtext}>Increase Productivity</Text>
</View>
</View>
<View>
<Pressable
onPress={() =>
router.push(
'/thisarticle?category=Self Care&title=Mindful Pause&id=0',
)
}
>
<Text style={{...styles.pill, ...styles.pillActive}}>Read more</Text>
</View>
</Pressable>
</View>
);
}
Expand Down

0 comments on commit 9fb33bc

Please sign in to comment.