Listview with alternating color in react native

后端 未结 4 814
一整个雨季
一整个雨季 2021-01-14 05:47

I have array of objects like the example below;

[{
        \"id\" : 13100,
        \"key\" : \"Emlak Vergisi\",
        \"y\" : 135638.98
    }, {
        \"         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-14 06:16

    You can use the rowId provided in the renderRow function. I've set up a working example here

    Render row method :

      renderRow = (rowData, sectionId, rowId) => {
        if (rowId % 2) {
          return (
            
              {rowData.id}
            
          );
        } else {
          return (
            
              {rowData.id}
            
          );
        }
      };
    

提交回复
热议问题