Core Components Questions with Answers

14 practice questions on Core Components (React Native) with answers and step-by-step solutions. Try 10 samples below, then practise all 14 free in the AptiNest app.

Sample questions

Question 1Easy

Which React Native core component is the basic building block for layout, playing roughly the role a div element plays on the web?

  1. View
  2. Text
  3. Layout
  4. Container

Answer: A. View

Explanation

View is the generic container that supports flexbox layout, styling and touch handling. It maps to a native view on each platform.

Step-by-step solution

  1. View is the basic container component in React Native.
  2. It supports flexbox layout, styling and touch handling, much like a div on the web.
  3. So the correct answer is option A, View.

Why the other options are wrong

  • B. Text is for showing text, not for layout containers.
  • C. Layout is not a core React Native component.
  • D. Container is not a core React Native component.

Tip: Use View for layout and Text for any words on screen.

Question 2Easy

Which core component is used to accept keyboard input from the user?

  1. TextInput
  2. InputField
  3. EditText
  4. TextField

Answer: A. TextInput

Explanation

TextInput is the core component for typed input. EditText and UITextField are the underlying native widgets, not React Native components.

Step-by-step solution

  1. TextInput is the core component that takes typed input from the user.
  2. The other names are not core React Native components.
  3. So the correct answer is option A, TextInput.

Why the other options are wrong

  • B. InputField is not a core React Native component.
  • C. EditText is an Android native widget, not a React Native component.
  • D. TextField is not a core React Native component.

Tip: TextInput is the component for typed input; props such as onChangeText handle the text.

Question 3Easy

A developer writes a plain string directly inside a <View>, without any wrapper. What happens?

  1. The string renders normally, like text inside an HTML div
  2. The string is silently ignored and nothing is drawn
  3. The string renders, but only in development builds
  4. An error saying text must be inside a <Text> component

Answer: D. An error saying text must be inside a <Text> component

Explanation

Unlike the DOM, React Native has no free-floating text nodes. Every piece of text must live inside a <Text> component.

Step-by-step solution

  1. React Native has no loose text nodes.
  2. Text must be inside a <Text> component.
  3. Otherwise an error is raised.

Why the other options are wrong

  • A. This is not HTML.
  • B. It raises an error rather than ignoring.
  • C. The error occurs in all builds.

Tip: Text needs <Text>.

Question 4Easy

Which core component shows a platform-native loading spinner?

  1. Spinner
  2. ProgressView
  3. LoadingSpinnerView
  4. ActivityIndicator

Answer: D. ActivityIndicator

Explanation

ActivityIndicator renders the native circular spinner on each platform. The other names are not core React Native components.

Step-by-step solution

  1. ActivityIndicator is the core component for a loading spinner.
  2. It draws the native circular spinner on each platform.
  3. So the correct answer is option D, ActivityIndicator.

Why the other options are wrong

  • A. Spinner is not a core React Native component.
  • B. ProgressView is a native iOS widget name, not a React Native component.
  • C. LoadingSpinnerView is not a core React Native component.

Tip: Use ActivityIndicator for a native spinner and ProgressBar-style components for progress.

Question 5Medium

Why is ScrollView a poor choice for rendering a list of 5,000 items?

  1. It cannot scroll past its first one hundred children
  2. It only works with a fixed, hard-coded number of children
  3. It renders every child at once, wasting memory and time
  4. It has no support for vertical scrolling of long content

Answer: C. It renders every child at once, wasting memory and time

Explanation

ScrollView mounts all its children at once. FlatList virtualises, rendering only items near the visible window.

Step-by-step solution

  1. ScrollView mounts and renders every child at once.
  2. With 5,000 items, that uses a lot of memory and slows the screen.
  3. So the reason is option C, and FlatList is the better choice because it renders only the items near the view.

Why the other options are wrong

  • A. ScrollView can scroll past many children; the problem is that it renders them all.
  • B. ScrollView works with any number of children; the issue is performance.
  • D. ScrollView supports vertical scrolling well.

Tip: Use FlatList or SectionList for long lists, because they render only visible items.

Question 6Medium

With <Pressable style={({ pressed }) => [styles.btn, pressed && styles.dim]}>, what does the style function receive?

  1. An object with a pressed flag, true while being touched
  2. The native touch event with its x and y coordinates
  3. The number of times the component has been pressed
  4. The previous style object, so it can be merged in place

Answer: A. An object with a pressed flag, true while being touched

Explanation

Pressable lets style (and children) be a function of the interaction state. The pressed boolean makes press feedback easy without extra state.

Step-by-step solution

  1. For Pressable, the style prop can be a function of the component's state.
  2. The function receives an object with a pressed flag.
  3. Pressed is true while the component is being touched, so the answer is option A.

Why the other options are wrong

  • B. The function receives the state object, not the native touch event.
  • C. The number of presses is not passed; the pressed flag is used instead.
  • D. The previous style is not passed in; the function receives the state.

Tip: Use the pressed flag from Pressable to change styles on touch without extra state.

Question 7Medium

In React Native, where do style properties such as color and fontSize get inherited from a parent?

  1. Only from a parent <Text> to nested <Text> elements
  2. From any parent View to every descendant, as in CSS
  3. From the root component to the whole app by default
  4. Nowhere: no style is ever inherited in React Native

Answer: A. Only from a parent <Text> to nested <Text> elements

Explanation

React Native has no general CSS cascade. The one exception is that nested Text components inherit text styles from their parent Text.

Step-by-step solution

  1. React Native has no general CSS cascade, so styles are not inherited from a View.
  2. The one exception is text: a nested Text inherits text styles from its parent Text.
  3. So the correct answer is option A.

Why the other options are wrong

  • B. Styles are not inherited from any View to every descendant as in CSS.
  • C. The root component does not pass styles down to the app by default.
  • D. Nested Text components do inherit text styles, so the claim that no style is inherited is wrong.

Tip: Only nested Text components inherit text styles; set styles on a View directly.

Question 8Medium

What is the purpose of KeyboardAvoidingView?

  1. To stop the on-screen keyboard from ever opening while on that screen
  2. To move or resize content so the keyboard does not hide inputs
  3. To render a custom keyboard in place of the system one
  4. To dismiss the keyboard whenever the user scrolls the view

Answer: B. To move or resize content so the keyboard does not hide inputs

Explanation

When the keyboard appears, KeyboardAvoidingView moves or resizes its content according to its behavior prop, so focused inputs stay visible.

Step-by-step solution

  1. When the keyboard opens, KeyboardAvoidingView changes the layout of its content.
  2. It moves or resizes the content, based on its behavior prop, so inputs stay visible.
  3. So its purpose is option B.

Why the other options are wrong

  • A. The keyboard still opens; the component only moves the content around it.
  • C. The system keyboard is used; the component does not replace it.
  • D. It does not dismiss the keyboard when the user scrolls.

Tip: Wrap a form in KeyboardAvoidingView with a behavior of padding or height as needed.

Question 9Hard

What does a React Native <View> become on the device at runtime?

  1. An HTML div rendered inside a hidden full-screen WebView
  2. A bitmap that the JavaScript engine paints frame by frame
  3. A canvas element drawn by a bundled browser rendering engine
  4. A real native view: a UIView on iOS and an Android View

Answer: D. A real native view: a UIView on iOS and an Android View

Explanation

React Native maps host components to platform views, which is why apps look and feel native. No WebView or DOM is involved.

Step-by-step solution

  1. React Native maps host components like View to platform views.
  2. On iOS a View becomes a UIView, and on Android it becomes an Android View.
  3. So the runtime object is a real native view, which is option D.

Why the other options are wrong

  • A. No WebView or HTML div is involved in React Native rendering.
  • B. A View is not a bitmap painted by JavaScript.
  • C. There is no canvas element or bundled browser engine.

Tip: This native mapping is why React Native apps look and feel native.

Question 10Hard

A <Switch value={false} onValueChange={() => {}} /> is tapped by the user. What does it display afterwards?

  1. It toggles on and stays on until the screen re-renders
  2. It toggles on, then throws a warning about missing state
  3. It stays off: it is controlled and value never changed
  4. It toggles on permanently, since value only sets the start

Answer: C. It stays off: it is controlled and value never changed

Explanation

Switch is a controlled component: it always renders its value prop. If onValueChange does not update the state that feeds value, it snaps back.

Step-by-step solution

  1. A Switch with value set to false is a controlled component.
  2. The tap calls onValueChange, but the handler does nothing to update the state.
  3. Value never changes, so the Switch renders false again and stays off.

Why the other options are wrong

  • A. The Switch does not stay on, because it always renders the value prop.
  • B. No warning is shown; the Switch just stays off.
  • D. Value is not just a starting value; it controls the Switch on each render.

Tip: For a controlled Switch, update the state in onValueChange so that value follows it.

Practise all 14 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all React Native topics · All topics