How to draw a horizontal rule in React Native?

Sometimes, we want to draw a horizontal rule in React Native.

In this article, we’ll look at how to draw a horizontal rule in React Native.

How to draw a horizontal rule in React Native?

To draw a horizontal rule in React Native, we can add a View with a border color and width.

For instance, we write:

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

import { Card } from 'react-native-paper';

const App = () => {
  return (
    <View style={{ flex: 1 }}>
      <Text>hello</Text>
      <View
        style={{
          borderBottomColor: 'black',
          borderBottomWidth: 1,
        }}
      />
      <Text>world</Text>
    </View>
  );
};
export default App;

to add the View between 2 Text components.

We set the borderBottomColor to 'black' to add a border color.

And then we set borderBottomWidth to 1 to add a border width in pixels.

Conclusion

To draw a horizontal rule in React Native, we can add a View with a border color and width.