// app/index.tsx (Expo SDK 58, Expo Router, Reanimated 4, expo-updates)
import {
Link,
Stack
} from 'expo-router';
import {
Pressable,
Text,
View
} from 'react-native';
import Animated, {
useAnimatedStyle,
useSharedValue,
withSpring
} from 'react-native-reanimated';
import * as Updates from 'expo-updates';
export default function Home() {
const scale = useSharedValue(1);
const style = useAnimatedStyle(() => ({
transform: [{
scale: scale.value
}]
}));
async function applyUpdate() {
scale.value = withSpring(0.95, {}, () => {
scale.value = withSpring(1);
});
const {
isAvailable
} = await Updates
.checkForUpdateAsync(); // OTA check (release builds only)
if (isAvailable) {
await Updates.fetchUpdateAsync();
await Updates.reloadAsync();
}
}
return ( <
View style = {
{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
gap: 16
}
} >
<
Stack.Screen options = {
{
title: 'Home'
}
}
/> <
Animated.View style = {
style
} >
<
Pressable onPress = {
applyUpdate
} > < Text > Check
for update < /Text></Pressable >
<
/Animated.View> <
Link href = "/settings" > Settings < /Link> <
/View>
);
}