React Native Assignment– 3
Navigation with React Navigation
Basic Questions
- Install @react-navigation/native along with dependencies (react-native-screens, react-native-safe-area-context, @react-navigation/stack, react-native-gesture-handler) and confirm setup by running the app.
- Wrap your application in a NavigationContainer and display a simple “Home” screen.
- Create a Stack Navigator with two screens: Home and Profile.
- Add a button on Home that navigates to Profile using navigation.navigate.
- Use navigation.push to push multiple instances of the Profile screen and verify the back stack.
- Customize the header title of Profile screen to show “User Profile”.
- Add a back button with a custom label on Profile screen.
- Create a Tab Navigator with three tabs: Home, Settings, and Notifications.
- Add icons to the tabs using react-native-vector-icons.
- Customize active and inactive tab styles (e.g., different colors).
- Set up a Drawer Navigator with two routes: Dashboard and Profile.
- Customize the drawer content to display a profile picture and username at the top.
- Handle gestures in the drawer navigation by enabling swipe-to-open.
- Pass a username parameter from Home screen to Profile screen using navigation.navigate.
- Retrieve the parameter inside Profile screen using route.params.
- Pass a function from one screen to another and call it on button press.
- Configure deep linking for your app and test with a custom URL scheme.
- Set up Android deep linking by editing AndroidManifest.xml.
- Configure iOS deep linking by adding a URL scheme in Xcode.
- Test navigation by opening your app directly to Profile screen via a deep link.
Intermediate Questions
- Create a button in an external app or browser link that opens your React Native app via deep linking.
- Add logic to redirect users to the correct screen if the app was opened via an external link.
- Combine a Stack Navigator and a Tab Navigator where Tabs are inside the Stack.
- Combine a Drawer Navigator with a Stack Navigator and handle navigation between them.
- Pass props between nested navigators and ensure state is updated correctly.
- Create a custom header for Profile screen with a search bar.
- Add a header button that triggers navigation to a new Settings screen.
- Change header styles dynamically based on screen state (e.g., dark mode).
- Implement custom transition animations between screens using screenOptions.
- Add a fade-in transition effect using CardStyleInterpolators.
- Build a bottom tab navigator where each tab itself has a stack of screens.
- Create a drawer navigator with nested tabs inside one drawer route.
- Add gesture handling to disable swipe navigation on certain screens.
- Use headerMode=”none” to hide headers and create a full-screen splash experience.
- Add a slide transition between two specific stack screens.
- Use deep linking with query params (e.g., /profile?id=123) and extract the ID.
- Open a modal screen using stack navigation with presentation: “modal”.
- Implement conditional navigation: redirect to Login if the user is not authenticated.
- Store navigation history in state and display a breadcrumb component.
- Create a reusable navigation wrapper component that includes custom headers and transitions.
Advanced Questions
- Implement a nested navigation setup combining Stack, Tab, and Drawer navigators together.
- Build a custom drawer component with user avatar, username, and logout button.
- Add role-based navigation: show/hide certain tabs based on user role (admin vs user).
- Configure deep linking for both Android and iOS with nested navigators.
- Handle external links (email/QR codes) that route directly to nested stack screens.
- Add animated custom transitions between screens using TransitionSpecs.
- Implement shared element transitions between two stack screens (e.g., image gallery to detail).
- Build a navigation guard that prevents navigating to Profile unless logged in.
- Dynamically update navigation options (title, buttons) based on API data.
- Final Hands-on Project:
- Create an app with Stack + Tab + Drawer navigators combined
- Pass data and functions between screens and nested navigators
- Configure deep linking for Profile and Settings screens
- Add custom headers with search bars and action buttons
- Implement custom transition animations for modal and stack screens
- Test external linking by opening the app directly to specific nested screens