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.greeting}>{greeting}{firstName ? `, ${firstName}` : ''}</Text>
|
||||||
<Text style={s.date}>{now.toLocaleDateString('fr-FR', { weekday: 'long', day: 'numeric', month: 'long' })}</Text>
|
<Text style={s.date}>{now.toLocaleDateString('fr-FR', { weekday: 'long', day: 'numeric', month: 'long' })}</Text>
|
||||||
</View>
|
</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} />
|
<Search size={18} color={C.ink} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
@@ -79,13 +79,13 @@ export default function HomeScreen() {
|
|||||||
</View>
|
</View>
|
||||||
<Text style={s.quickLabel}>Note du jour</Text>
|
<Text style={s.quickLabel}>Note du jour</Text>
|
||||||
</TouchableOpacity>
|
</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' }]}>
|
<View style={[s.quickIcon, { backgroundColor: '#edf0f7' }]}>
|
||||||
<PenLine size={20} color="#5b7ec7" />
|
<PenLine size={20} color="#5b7ec7" />
|
||||||
</View>
|
</View>
|
||||||
<Text style={s.quickLabel}>Nouvelle note</Text>
|
<Text style={s.quickLabel}>Nouvelle note</Text>
|
||||||
</TouchableOpacity>
|
</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' }]}>
|
<View style={[s.quickIcon, { backgroundColor: '#eef7ed' }]}>
|
||||||
<GraduationCap size={20} color="#4a9b61" />
|
<GraduationCap size={20} color="#4a9b61" />
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ export default function RootLayout() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loading) return
|
if (loading) return
|
||||||
const inAuth = segments[0] === '(auth)'
|
const inAuth = segments[0] === '(auth)'
|
||||||
if (!user && !inAuth) router.replace('/(auth)/login')
|
if (!user && !inAuth) router.replace({ pathname: '/(auth)/login' })
|
||||||
else if (user && inAuth) router.replace('/(tabs)/home')
|
else if (user && inAuth) router.replace({ pathname: '/(tabs)/home' })
|
||||||
}, [user, loading, segments])
|
}, [user, loading, segments])
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
|
|||||||
Reference in New Issue
Block a user