React Native Assignment– 2
Core Components & Layouts
Basic Questions
- Create a simple app with a <View> container and a <Text> inside that says “Hello Core Components”.
- Nest two <View> components and style them with different background colors.
- Add multiple <Text> components with different font sizes and colors using inline styles.
- Use StyleSheet.create to define styles for <Text> and apply bold + center alignment.
- Render a local image using <Image> (from the assets folder).
- Render a remote image from a URL using <Image>.
- Create a ScrollView with 20 <Text> items that are scrollable vertically.
- Add horizontal scrolling to a ScrollView with images placed side by side.
- Create a basic form with <TextInput> for username and password fields.
- Configure TextInput with placeholder and secureTextEntry.
- Add a numeric-only TextInput using keyboardType=”numeric”.
- Create a <TouchableOpacity> button that changes text on press.
- Create a <TouchableHighlight> button with a background highlight effect on press.
- Use <Pressable> to show “Pressed” or “Not Pressed” text based on press state.
- Create a styled button with TouchableOpacity to increment a counter.
- Define multiple styles in StyleSheet and apply them conditionally.
- Create a layout with Flexbox: a row of 3 boxes evenly spaced.
- Create a stacked column of 3 <View> boxes with different colors.
- Fetch screen width/height using Dimensions.get(“window”) and display them in a <Text>.
- Add responsive font size using react-native-responsive-dimensions library.
Intermediate Questions
- Build a layout with a header, content, and footer using Flexbox.
- Create a two-column grid layout using Flexbox with flexDirection=”row”.
- Add an image gallery inside a ScrollView that scrolls horizontally.
- Create a controlled TextInput that updates state as the user types.
- Validate input: show an error message if TextInput is empty on submit.
- Build a FlatList rendering 10 items with unique keys using keyExtractor.
- Add initialNumToRender={5} to FlatList and measure rendering optimization.
- Update FlatList items dynamically using extraData state.
- Create a SectionList that groups a list of fruits into categories (Citrus, Berries, etc.).
- Add a custom header and footer to SectionList.
- Implement getItemLayout in SectionList for performance optimization.
- Use TouchableOpacity to build a custom button with rounded corners and shadow.
- Use Pressable to apply scaling animation (zoom in/out) when pressed.
- Build a login form with TextInput fields and a submit button.
- Use KeyboardAvoidingView to adjust form position when the keyboard is open.
- Add logic to dismiss the keyboard when tapping outside TextInput.
- Create a Flexbox layout with justifyContent=”space-between” and 3 items.
- Create a Flexbox layout with alignItems=”center” and multiple children.
- Build a responsive grid of 6 images that adapts to screen width.
- Compare inline styles vs StyleSheet performance by rendering 100 styled <Text> elements.
Advanced Questions
- Build a chat UI: FlatList showing messages with Text and timestamp in different styled bubbles.
- Create a SectionList contact list with alphabet headers (A–Z).
- Implement lazy-loading images with <Image> by rendering placeholders until load.
- Create a multi-field form with validation (email format, password length, etc.) using useReducer.
- Build a form that resets all TextInput values when pressing a reset button.
- Implement a ScrollView form that automatically scrolls to the next field on submit.
- Create a Pressable card component with different background colors for pressed, hovered, and focused states.
- Build a responsive layout: header + 2-column content + footer, adapting for portrait and landscape.
- Create a shopping cart UI with FlatList: render items, allow deletion, update total dynamically.
- Final Hands-on Project:
- Build a mini registration app
- Layout: Header (title), Body (form), Footer (submit button) using Flexbox
- Use multiple TextInput fields (name, email, password, phone) with validation
- Dismiss keyboard on tap outside + use KeyboardAvoidingView
- Display entered data in a FlatList below the form
- Add responsive styles (Dimensions + responsive-dimensions)