mobile: fix typed routes - router.push/replace avec objet pathname
Some checks failed
CI / Lint, Unit Tests & Build (push) Failing after 1m5s
CI / Deploy production (on server) (push) Has been skipped

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:
Antigravity
2026-05-29 17:18:45 +00:00
parent 12d1e3dfdd
commit e7290d6f9c
2 changed files with 5 additions and 5 deletions

View File

@@ -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>

View File

@@ -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) {