React Native

React Native Styling & Layout

Flexbox, absolute positioning, responsive design, safe area, platform-specific styles

18 interview questions·
Junior
1

What is the default flexDirection in React Native?

Answer

In React Native, flexDirection defaults to 'column', unlike on the web where it defaults to 'row'. This means child elements are arranged vertically from top to bottom by default. This difference reflects typical mobile interface conventions, where vertical layouts are more common.

2

How to create a reusable style in React Native?

Answer

StyleSheet.create() is the recommended method for creating styles in React Native. It allows defining a style object that can be reused across multiple components. This approach optimizes performance by validating styles once at startup and referencing them by ID rather than recreating objects on each render.

3

Which property to use to center an element both horizontally AND vertically within its container?

Answer

To center an element in both axes, combine justifyContent: 'center' (main axis) and alignItems: 'center' (cross axis). With the default flexDirection ('column'), justifyContent centers vertically and alignItems centers horizontally. These two properties work together to achieve perfect centering.

4

What is the default unit of measurement used in React Native for dimensions?

5

Which property allows positioning an element absolutely relative to its parent?

+15 interview questions

Master React Native for your next interview

Access all questions, flashcards, technical tests, code review exercises and interview simulators.

Start for free