Я использую Expo SDK 54.
В iOS, когда я использую expo-router/unstable-native-tabes, мы не можем обернуть другим компонентом.
AppHeader должен оказаться наверху страницы. В iOS 26 это не работает.
Как мы можем поместить это вверху каждой страницы?
import { useEffect } from 'react'
import { Platform } from 'react-native'
import { useAuth } from '@/context/AuthContext'
import { useRouter, Stack, usePathname } from 'expo-router'
import { NativeTabs, Icon, Label, Badge } from 'expo-router/unstable-native-tabs'
import MaterialIcons from '@expo/vector-icons/MaterialIcons'
import DashboardLayout from '@/components/layouts/DashboardLayout'
import AppHeader from '@/components/ui/header'
export default function ProtectedLayout() {
const pathname = usePathname()
const router = useRouter()
const { isAuthenticated, isLoading } = useAuth()
const isPublicStaticPage = pathname === '/privacy' || pathname === '/terms'
const isAndroid = Platform.OS === 'android'
const isIOS = Platform.OS === 'ios'
useEffect(() => {
if (!isLoading && !isAuthenticated && !isPublicStaticPage) {
router.replace('/details')
}
}, [router, isAuthenticated, isLoading, isPublicStaticPage])
if ((!isAuthenticated && !isPublicStaticPage) || isLoading) {
return null
}
if (isPublicStaticPage && !isAuthenticated) {
return
}
if (isAndroid) {
return (
)
}
if (isIOS) {
return (
Attendance
Timetable
Present
Att Code
Marks
CGPA
Subjects
Feedback
3
Profile
About
Privacy Policy
Terms and Conditions
)
}
return null;
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... tom-header
Как обернуть собственные вкладки пользовательским заголовком? ⇐ IOS
Программируем под IOS
-
Anonymous
1772025747
Anonymous
Я использую Expo SDK 54.
В iOS, когда я использую expo-router/unstable-native-tabes, мы не можем обернуть другим компонентом.
AppHeader должен оказаться наверху страницы. В iOS 26 это не работает.
Как мы можем поместить это вверху каждой страницы?
import { useEffect } from 'react'
import { Platform } from 'react-native'
import { useAuth } from '@/context/AuthContext'
import { useRouter, Stack, usePathname } from 'expo-router'
import { NativeTabs, Icon, Label, Badge } from 'expo-router/unstable-native-tabs'
import MaterialIcons from '@expo/vector-icons/MaterialIcons'
import DashboardLayout from '@/components/layouts/DashboardLayout'
import AppHeader from '@/components/ui/header'
export default function ProtectedLayout() {
const pathname = usePathname()
const router = useRouter()
const { isAuthenticated, isLoading } = useAuth()
const isPublicStaticPage = pathname === '/privacy' || pathname === '/terms'
const isAndroid = Platform.OS === 'android'
const isIOS = Platform.OS === 'ios'
useEffect(() => {
if (!isLoading && !isAuthenticated && !isPublicStaticPage) {
router.replace('/details')
}
}, [router, isAuthenticated, isLoading, isPublicStaticPage])
if ((!isAuthenticated && !isPublicStaticPage) || isLoading) {
return null
}
if (isPublicStaticPage && !isAuthenticated) {
return
}
if (isAndroid) {
return (
)
}
if (isIOS) {
return (
Attendance
Timetable
Present
Att Code
Marks
CGPA
Subjects
Feedback
3
Profile
About
Privacy Policy
Terms and Conditions
)
}
return null;
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79892952/how-to-wrap-native-tabs-with-a-custom-header[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия