React Native

React Native Styling & Layout

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

18 domande da colloquio·
Junior
1

What is the default flexDirection in React Native?

Risposta

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?

Risposta

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?

Risposta

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 domande da colloquio

Padroneggia React Native per il tuo prossimo colloquio

Accedi a tutte le domande, flashcards, test tecnici, esercizi di code review e simulatori di colloquio.

Inizia gratis