如何在 React Native 中以表格格式显示数据? [英] How can I show data in a table format in react native?

查看:66
本文介绍了如何在 React Native 中以表格格式显示数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的应用中以表格格式显示数据.我想要这样的东西"

I need to show data in a Table format in my app. I want something like this"

如何在表格的第一个标题旁边添加下拉图标并设计与上图类似的代码?

How can I add a dropdown icon next to the first header in the table and design my code similar to the above image?

推荐答案

您可以使用 DataTable 来自 react-native-paper 库.

You can use DataTable from react-native-paper library.

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

const MyComponent = () => (
  <DataTable>
    <DataTable.Header>
      <DataTable.Title
        sortDirection='descending'>Dessert</DataTable.Title>
      <DataTable.Title numeric>Calories</DataTable.Title>
      <DataTable.Title numeric>Fat (g)</DataTable.Title>
    </DataTable.Header>
    </DataTable> );

sortDirection='descending' 将帮助您在标题旁边添加下拉图标.

sortDirection='descending' will help you add drop down icon next to your header.

这篇关于如何在 React Native 中以表格格式显示数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆