[iOS 15] Tab indicator does not update when switching pages after SwiftUI migration (v8)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- ios, react-native, swift, typescript
- Lĩnh vực
- mobile
Hướng nghiên cứu
Tái hiện vấn đề bằng bản demo được liên kết và trình mô phỏng iOS 15, sau đó so sánh với iOS 16 hoặc mới hơn. Đọc PagerViewProps.swift và phần di chuyển sang SwiftUI được thảo luận trong PR #1020, tập trung vào state được báo cáo và việc truyền sự kiện. Công việc được hoàn tất khi indicator đi theo trang đang hiển thị trên iOS 15, trong khi hành vi hiện tại vẫn đúng trên các phiên bản mới hơn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
| Version | |
|---|---|
react-native-pager-view |
8.0.1 |
react-native-tab-view |
4.1.2 |
@react-navigation/native |
7.2.4 |
@react-navigation/bottom-tabs |
7.16.1 |
@react-navigation/native-stack |
7.15.1 |
@react-navigation/stack |
7.9.2 |
@react-navigation/elements |
2.9.18 |
react-native-screens |
4.25.0 |
react-native |
0.84.1 |
| iOS | 15.x |
Description
After upgrading to v8.0.0 (SwiftUI rewrite), the tab indicator (active tab highlight) no longer updates on iOS 15 when switching pages. The page content switches correctly, but the tab bar UI stays on the originally selected tab.
Downgrading to v7.0.2 resolves the issue immediately, which strongly suggests a regression introduced by the SwiftUI migration.
iOS15
https://github.com/user-attachments/assets/e842d9b5-e5f0-404c-ada7-d975d088cdab
iOS26.5
https://github.com/user-attachments/assets/da1c2566-c61f-453c-9841-f634fa3ace25
Reproducible Demo
https://github.com/manakuro/react-native-pager-view-ios15-issue
1. Set up an iOS 15 simulator
An iOS 15 simulator runtime is required. If you don't have one:
- Open Xcode
- Go to Xcode → Settings → Platforms
- Click + and download iOS 15.x
- Once downloaded, open Window → Devices and Simulators → Simulators
- Click + to add a new simulator, choose any device (e.g. iPhone 13) with the iOS 15 runtime
2. Run the demo
git clone https://github.com/manakuro/react-native-pager-view-ios15-issue.git
cd react-native-pager-view-ios15-issue
yarn install
cd ios && pod install && cd ..
npx react-native run-ios --simulator "iPhone 13 (iOS 15)"
import * as React from 'react';
import { View, useWindowDimensions } from 'react-native';
import { TabView, SceneMap } from 'react-native-tab-view';
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
const FirstRoute = () => (
<View style={{ flex: 1, backgroundColor: '#ff4081' }} />
);
const SecondRoute = () => (
<View style={{ flex: 1, backgroundColor: '#673ab7' }} />
);
const renderScene = SceneMap({
first: FirstRoute,
second: SecondRoute,
});
const routes = [
{ key: 'first', title: 'First' },
{ key: 'second', title: 'Second' },
];
export default function App() {
const layout = useWindowDimensions();
const [index, setIndex] = React.useState(0);
return (
<SafeAreaProvider>
<SafeAreaView style={{ flex: 1 }}>
<TabView
navigationState={{ index, routes }}
renderScene={renderScene}
onIndexChange={setIndex}
initialLayout={{ width: layout.width }}
/>
</SafeAreaView>
</SafeAreaProvider>
);
}
Expected behavior
The tab indicator moves to the tapped tab, matching the displayed page content.
Actual behavior
The page content switches correctly, but the tab indicator remains on the original tab. The tab bar UI and the actual page are out of sync.
Reproduction
Reproducible with the standard react-native-tab-view setup on iOS 15. Confirmed working correctly on iOS 16 and above.
Possible cause
During the PR review for the SwiftUI migration (#1020), a reviewer flagged that ObservableObject usage in PagerViewProps.swift requires iOS 17+, while the stated minimum deployment target is iOS 15+. This may indicate that certain SwiftUI APIs used in v8 are not fully compatible with iOS 15, causing state/event propagation to silently break on that OS version.
Workaround
Downgrade to v7.0.2:
npm install [email protected]
# or
yarn add [email protected]
- Ngôn ngữ chính
- TypeScript
- Star
- 3.4k
- Fork
- 485
- Merge trung bình
- 2 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của callstack/react-native-pager-view
-
[iOS] Focused TextInput keeps focus and keyboard after switching pages (v9)Có thể đã có người làm @TaduJR đã nhận hôm nay. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 69/100
callstack/react-native-pager-view#1192 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 73/100
callstack/react-native-pager-view#1191 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
callstack/react-native-pager-view#1189 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
iOS: PagerScrollDelegate proxies to itself and overflows the stack when the weak originalDelegate diesCó thể đã có người làm @lvlrSajjad đã nhận 36 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
callstack/react-native-pager-view#1146 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
callstack/react-native-pager-view#1144 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của callstack/react-native-pager-view
Issue tương tự
-
e2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
redhat-developer/rhdh-plugin-export-overlays#4460 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
docs(api): openapi.yaml still documents gif-tools optimize colors as 2-256 instead of 2, 4, 16, 256Đang mởarea: backend documentation priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
snapotter-hq/SnapOtter#2919 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
obsidianmd/pele#39 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
biomejs/biome#12475 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày