In React Native, the flex property is used to specify how an item should grow or shrink to fill the available space. It is commonly used to create responsive layouts that adapt to different screen sizes.

Here's an example of how to use flex to create a simple layout with two items:

import React from 'react';
import { View, Text } from 'react-native';

const MyComponent = () => {
  return (
    <View style={{ flex: 1 }}>
<View style={{ flex: 1, backgroundColor: 'red' }}>
<Text>Item 1</Text>
</View>
<View style={{ flex: 2, backgroundColor: 'blue' }}>
<Text>Item 2</Text>
</View>
</View> ); }; export default MyComponent;

In this example, we have a parent View with flex: 1 set, which means it will take up all the available space. Inside the parent View, we have two child Views. The first child View has flex: 1 set, which means it will take up 1/3 of the available space. The second child View has flex: 2 set, which means it will take up 2/3 of the available space.

We've also given each child View a background color and added some text inside them so we can see how they're rendered on the screen.

By using flex, we can create responsive layouts that adjust to different screen sizes and orientations.