mobile: fix typed routes - router.push/replace avec objet pathname
typedRoutes=true dans app.json interdit les string literals
Tous les router.push/replace convertis en { pathname } object
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -66,7 +66,7 @@ export default function HomeScreen() {
|
||||
<Text style={s.greeting}>{greeting}{firstName ? `, ${firstName}` : ''}</Text>
|
||||
<Text style={s.date}>{now.toLocaleDateString('fr-FR', { weekday: 'long', day: 'numeric', month: 'long' })}</Text>
|
||||
</View>
|
||||
<TouchableOpacity onPress={() => router.push('/(tabs)/search')} style={s.searchBtn}>
|
||||
<TouchableOpacity onPress={() => router.push({ pathname: '/(tabs)/search' })} style={s.searchBtn}>
|
||||
<Search size={18} color={C.ink} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
@@ -79,13 +79,13 @@ export default function HomeScreen() {
|
||||
</View>
|
||||
<Text style={s.quickLabel}>Note du jour</Text>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity onPress={() => router.push('/(tabs)/search')} style={s.quickCard} activeOpacity={0.7}>
|
||||
<TouchableOpacity onPress={() => router.push({ pathname: '/(tabs)/search' })} style={s.quickCard} activeOpacity={0.7}>
|
||||
<View style={[s.quickIcon, { backgroundColor: '#edf0f7' }]}>
|
||||
<PenLine size={20} color="#5b7ec7" />
|
||||
</View>
|
||||
<Text style={s.quickLabel}>Nouvelle note</Text>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity onPress={() => router.push('/(tabs)/search')} style={s.quickCard} activeOpacity={0.7}>
|
||||
<TouchableOpacity onPress={() => router.push({ pathname: '/(tabs)/search' })} style={s.quickCard} activeOpacity={0.7}>
|
||||
<View style={[s.quickIcon, { backgroundColor: '#eef7ed' }]}>
|
||||
<GraduationCap size={20} color="#4a9b61" />
|
||||
</View>
|
||||
|
||||
@@ -19,8 +19,8 @@ export default function RootLayout() {
|
||||
useEffect(() => {
|
||||
if (loading) return
|
||||
const inAuth = segments[0] === '(auth)'
|
||||
if (!user && !inAuth) router.replace('/(auth)/login')
|
||||
else if (user && inAuth) router.replace('/(tabs)/home')
|
||||
if (!user && !inAuth) router.replace({ pathname: '/(auth)/login' })
|
||||
else if (user && inAuth) router.replace({ pathname: '/(tabs)/home' })
|
||||
}, [user, loading, segments])
|
||||
|
||||
if (loading) {
|
||||
|
||||
Reference in New Issue
Block a user