Categories
React Native Answers

How to add absolute position and in a flexbox container in React Native?

Spread the love

Sometimes, we want to add absolute position and in a flexbox container in React Native.

In this article, we’ll look at how to add absolute position and in a flexbox container in React Native.

How to add absolute position and in a flexbox container in React Native?

To add absolute position and in a flexbox container in React Native, we can set position to 'absolute' and set the left, top, right, and bottom values.

For instance, we write

const styles = StyleSheet.create({
  container: {
    position: "absolute",
    left: 0,
    top: 0,
    right: 0,
    bottom: 0,
  },
});

to set the position to 'absolute'.

And then we set the left, top, right, and bottom values to position the component with the styles in pixels.

Conclusion

To add absolute position and in a flexbox container in React Native, we can set position to 'absolute' and set the left, top, right, and bottom values.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *