反应原生的数据表

时间:2017-02-25 17:14:51

标签: react-native react-native-android react-native-listview

有人可以建议任何反应原生的数据表组件,它可以动态添加行并具有可编辑的单元格。我在谷歌搜索完成。提前谢谢。

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

我为此功能引入了自己的库!

import DataTable, {COL_TYPES} from 'react-native-datatable-component';
    
const someCom = () => {

     //You can pass COL_TYPES.CHECK_BOX Column's value in true/false, by default it will be false means checkBox will be uncheck!
     
     const data = [
           { menu: 'Chicken Biryani', select: false }, //If user select this row then this whole object will return to you with select true in this case
           { menu: 'Chiken koofta', select: true },
           { menu: 'Chicken sharwma', select: false }
     ]
     
     const nameOfCols = ['menu', 'select'];
     
     return(
          <DataTable
               onRowSelect={(row) => {console.log('ROW => ',row)}}
               data={data}
               colNames={nameOfCols}
               colSettings={[{name: 'select', type: COL_TYPES.CHECK_BOX}]}
          />
     )
}

enter image description here enter image description here

https://github.com/MuhammadRafeh/react-native-datatable-component