React Native Assignment– 6
Custom Components and UI Design
Basic Questions
- Create a presentational (dumb) component AppHeader that only receives a title as a prop and displays it.
- Build a container (smart) component UserListContainer that fetches users from an API and passes them down to a dumb UserList.
- Create a reusable Button component with customizable props: label, color, and onPress.
- Extend the Button to accept an optional icon (using react-native-vector-icons).
- Build a reusable Input component (TextInput) that accepts placeholder, secureTextEntry, and onChangeText.
- Create a Card component that accepts title, description, and image props and render them.
- Add a Modal component that accepts dynamic content via children props.
- Create a reusable Toast component with message and type (success | error) props.
- Build a controlled component: Input with internal state for value and a Submit button that calls onSubmit(value).
- Build an uncontrolled component: Input that exposes ref for parent access to value.
- Demonstrate prop drilling by passing a theme color from App → Parent → Child → Grandchild.
- Refactor the above to use React Context instead of prop drilling.
- Add custom event handlers: create a Form component that fires onSubmit with all field values.
- Add a Button with multiple variants (primary, secondary, outline) by styling based on a prop.
- Implement a reusable Modal with fade-in animation using Animated.
- Create a Dropdown component that accepts an array of options and fires onSelect(option).
- Add a Badge component that displays a count and can be styled via props.
- Create a Tab component with two tabs; active tab is highlighted.
- Build an Accordion component with expand/collapse functionality for sections.
- Memoize a heavy Card component with React.memo and confirm re-render optimization.
Intermediate Questions
- Build a Higher-Order Component (HOC) withAuth that only renders a wrapped component if the user is authenticated.
- Create a Render Props component DataProvider that fetches JSON and allows consumers to decide how to render it.
- Build a Compound Component pattern: Tabs, Tabs.Tab, and Tabs.Content to manage active state internally.
- Create a ThemeProvider using Context to pass theme colors; use it across multiple components.
- Build a ProfileCard component and split it into subcomponents: ProfileCard.Header, ProfileCard.Body, ProfileCard.Footer.
- Organize a reusable Button component into folder structure: Button/index.js, Button.styles.js, and test file.
- Refactor a large Form component into smaller subcomponents: Form.Input, Form.Button.
- Add React.memo to a ListItem component and measure reduced re-renders in FlatList.
- Install react-native-paper and use its Button and TextInput components in a login form.
- Customize the react-native-paper Button with brand colors.
- Install react-native-elements and create a product list using its Card component.
- Override styles of the react-native-elements Card for a unique brand theme.
- Install native-base and use its Button and Badge components in a sample screen.
- Add dark mode and light mode themes using react-native-paper’s theme provider.
- Create a custom theme with react-native-elements and apply it globally.
- Extend a react-native-paper TextInput to accept a new errorMessage prop and display error text.
- Build a screen mixing components from all three libraries (paper, elements, native-base).
- Create a Modal using react-native-paper but override its padding and background color.
- Add responsive font scaling with react-native-size-matters for Button text.
- Test accessibility by enabling larger font settings and confirm text scales correctly.
Advanced Questions
- Add custom Google Fonts (Poppins, Roboto) to your project: configure for both iOS and Android.
- Replace default fonts in a ThemeProvider with your custom fonts.
- Add multiple font weights (regular, bold, medium) and apply them across Text components.
- Install react-native-vector-icons and display FontAwesome icons inside Buttons.
- Create a NotificationIcon with a badge counter using MaterialIcons.
- Build a reusable IconButton that accepts iconName, library, and onPress.
- Add a responsive font scaling hook useResponsiveFontSize() using Dimensions & PixelRatio.
- Create a branded button that extends react-native-paper Button with custom padding, radius, and font.
- Build a Dashboard screen that uses Cards, Modals, Toasts, and Tabs with consistent theming.
- Final Hands-on Project:
- Create a design system with reusable components (Button, Card, Input, Modal, Toast, Tabs, Accordion)
- Add themes (light/dark + brand colors) via Context or library theming
- Integrate third-party UI libraries and override their styles for consistency
- Add custom fonts and icons globally with dynamic scaling for accessibility
- Build a complete sample screen (e.g., E-commerce Product Page) using your custom + library components