I’m excited to share a set of mobile apps I’ve recently completed and published on both the Google Play Store and the Apple App Store. These apps are designed with a simple goal in mind: to make meaningful, structured content more accessible, whether you’re studying theology or improving your English vocabulary. 📱 Now Available on Both Platforms All apps are live and available for download: Google Play Developer Page: https://play.google.com/store/apps/dev?id=5835943159853189043 Apple App Store Developer Page: https://apps.apple.com/ca/developer/q-z-l-corp/id1888794100 📖 Theology & Confession Study Apps For those interested in Reformed theology and classical Christian teachings, I’ve developed a series of apps that present foundational texts in a clean, focused reading format: The Belgic Confession Canons of Dort Heidelberg Catechism Westminster Shorter Catechism Each app is designed to provide a distraction-free experience, making it easier to read, reflect, and revisit these im...
React Native 导航模式:为共享页面使用全局 Stack
- Get link
- X
- Other Apps
By
Errong Leng
-
React Native 导航模式:为共享页面使用全局 Stack
在许多 React Native 应用中,你可能希望从多个 Tab 打开同一个页面(如 Article 或 Details),并且希望返回按钮能回到正确的 Tab。如果你只是把页面放在某个 Tab 的 Stack 里,会遇到一个常见的 UX 问题:返回按钮总是回到该 Stack 的根页面,而不是你来时的 Tab。
问题描述
假设你有一个包含 Home、Study 和 Mastery 的 Tab Navigator。如果你把 ArticleScreen 放在 Home 的 Stack 里,并从 Study 或 Mastery 跳转到它,返回按钮总是回到 Home,而不是你来时的 Tab。这是因为导航栈是 Tab 局部的。
解决方案:使用全局 Stack
最佳实践是创建一个 RootStack,把 Tab Navigator 和所有共享页面包裹起来。这样,任何 Tab 都可以 push 共享页面,返回按钮会回到正确的 Tab。
步骤 1:定义 Root Stack
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import TabNavigator from './TabNavigator';
import ArticleScreen from './ArticleScreen';
const RootStack = createNativeStackNavigator();
export default function AppNavigator() {
return (
<RootStack.Navigator>
<RootStack.Screen
name=\"Main\"
component={TabNavigator}
options={{ headerShown: false }}
/>
<RootStack.Screen
name=\"Article\"
component={ArticleScreen}
options={{ title: 'Article' }}
/>
</RootStack.Navigator>
);
}
步骤 2:从 Tab Stack 移除 ArticleScreen
只在 RootStack 里包含 ArticleScreen,不要放在任何 Tab 的 Stack 里。
步骤 3:更新导航调用
需要打开 Article 页面时,直接用:
navigation.navigate('Article', { articleId });
现在,返回按钮会回到你来时的 Tab,用户体验更自然。
为什么这样设计?
- 导航历史是全局的,不局限于某个 Tab。
- 任何 Tab 都能 push 共享页面,返回导航正确。
- 适合多个共享页面,易于扩展。
总结
如果你需要从多个 Tab 打开同一个页面,并希望返回按钮表现直观,推荐使用全局 Stack Navigator。这种模式简洁、可扩展,并能带来最佳的 React Native 用户体验。
你在项目中用过这种模式吗?欢迎留言交流!
❤️ Support This Blog
If this post helped you, you can support my writing with a small donation. Thank you for reading.
Best Practices
Code
Cross-tab navigation
Mobile Development
Mobile UX
Navigation
React Native
React Native中文
React Navigation
Stack Navigator
Tab Navigator
前端开发
- Get link
- X
- Other Apps
Popular Posts
2026 Begins: Choosing to Stay on the Path as a Blogger
By
Errong Leng
-
Today is January 1st, 2026 . Before rushing into new goals, I spent some time looking back at the past 12 months of data for this blog — the quiet numbers that tell a very honest story. Looking Back at the Numbers Over the past year: 📈 Total views: ~44,600 👀 Daily average visits: ~200 💬 Comments: 19 💰 AdSense income: about $0.01 per month At first glance, these numbers may look small — especially the income. But when I zoom out, I see something more meaningful. This blog has been quietly read every single day . No viral posts. No aggressive promotion. No paid traffic. Just consistent readers arriving through search, bookmarks, and curiosity. That consistency matters. What the Traffic Graph Tells Me The graph over the last 12 months shows something important: Early months were quiet and uneven Mid-year brought steady growth Toward the end of the year, traffic became more stable , with clear spikes when certain posts resonated This tell...
A New Collection of Thoughtful Learning Apps — Now Available on iOS & Android
By
Errong Leng
-
I’m excited to share a set of mobile apps I’ve recently completed and published on both the Google Play Store and the Apple App Store. These apps are designed with a simple goal in mind: to make meaningful, structured content more accessible, whether you’re studying theology or improving your English vocabulary. 📱 Now Available on Both Platforms All apps are live and available for download: Google Play Developer Page: https://play.google.com/store/apps/dev?id=5835943159853189043 Apple App Store Developer Page: https://apps.apple.com/ca/developer/q-z-l-corp/id1888794100 📖 Theology & Confession Study Apps For those interested in Reformed theology and classical Christian teachings, I’ve developed a series of apps that present foundational texts in a clean, focused reading format: The Belgic Confession Canons of Dort Heidelberg Catechism Westminster Shorter Catechism Each app is designed to provide a distraction-free experience, making it easier to read, reflect, and revisit these im...
How to Prepare App Preview Videos and Screenshots for App Store Connect
By
Errong Leng
-
How to Prepare App Preview Videos and Screenshots for App Store Connect When distributing your app through App Store Connect, preparing screenshots and app preview videos is one of the final — and surprisingly tricky — steps. This guide walks you through a simple, practical workflow that actually works. 📸 Screenshots (Easy Part) Screenshots are straightforward: Launch your app on your iPhone Capture screenshots directly on the device Transfer them to your Mac via AirDrop Open them in Preview and resize to the required dimensions That’s it. No special tools needed. 🎬 App Preview Videos (The Tricky Part) App preview videos have strict requirements from Apple: Key Requirements ⏱ Duration: ≤ 30 seconds 🎞 Frame rate: ≤ 30 fps (recommended: 30 fps) 📐 Resolution: 886 × 1920 (portrait) 1920 × 886 (landscape) 🔊 Must include audio 📱 Step 1: Record Your App on iPhone Use the built-in screen recording feature: Add Screen Recording to Control Center (i...
Comments
Post a Comment