dohooo / react-native-table-component

🌱Build table for react native
MIT License
731 stars 188 forks source link

show my data #98

Open iamir4g opened 5 years ago

iamir4g commented 5 years ago

hi this is my data :

1: {NICKNAME: "ایران 78 - 875 ع 73", SENTDATE: "12:49", XPOINT: 53.963928, YPOINT: 32.24068, POSDESCRIPTION: "ايران: يزد: ميبد", …}
2: {NICKNAME: "ایران 78 - 875 ع 73", SENTDATE: "12:44", XPOINT: 53.963928, YPOINT: 32.24068, POSDESCRIPTION: "ايران: يزد: ميبد", …}
3: {NICKNAME: "ایران 78 - 875 ع 73", SENTDATE: "12:39", XPOINT: 53.963928, YPOINT: 32.24068, POSDESCRIPTION: "ايران: يزد: ميبد", …}
4: {NICKNAME: "ایران 78 - 875 ع 73", SENTDATE: "12:34", XPOINT: 53.99361, YPOINT: 32.191703, POSDESCRIPTION: "ايران: استان يزد - محور ميبد به ندوشن - 5 كيلومتر از  ميبد", …}
5: {NICKNAME: "ایران 78 - 875 ع 73", SENTDATE: "12:29", XPOINT: 54.060798, YPOINT: 32.139923, POSDESCRIPTION: "ايران: يزد: ميبد، به سمت جنوب شرقی، 11 کیلومتر", …}
6: {NICKNAME: "ایران 78 - 875 ع 73", SENTDATE: "12:24", XPOINT: 54.117355, YPOINT: 32.106632, POSDESCRIPTION: "ايران: استان يزد - محور يزد به اردكان - 32 كيلومتر از  يزد", …}
7: {NICKNAME: "ایران 78 - 875 ع 73", SENTDATE: "12:19", XPOINT: 54.183261, YPOINT: 32.06414, POSDESCRIPTION: "ايران: استان يزد - محور يزد به اردكان - 25 كيلومتر از  يزد", …}
8: {NICKNAME: "ایران 78 - 875 ع 73", SENTDATE: "12:14", XPOINT: 54.217983, YPOINT: 32.017246, POSDESCRIPTION: "ايران: استان يزد - اشگذر", …}
9: {NICKNAME: "ایران 78 - 875 ع 73", SENTDATE: "12:09", XPOINT: 54.262409, YPOINT: 31.98723, POSDESCRIPTION: "ايران: استان يزد - زارچ", …}

and this is my code : tableData.map((rowData, index) => ( <Row key={index} data={this.props.data?this.props.data:rowData} widthArr={this.state.widthArr} style={[styles.row, index%2 && {backgroundColor: '#F7F6E7'}]} textStyle={styles.text} /> )) and i get this error
Invariant Violation: Objects are not valid as a React child (found: object with keys {NICKNAME, SENTDATE, XPOINT, YPOINT, POSDESCRIPTION, SPEED, TRUCKSTATE, MESSAGETIME, SIGNATURE, DIRECTION, MOVINGSTATE}). If you meant to render a collection of children, use an array instead. how to show this on table ?

Bill-Dagg commented 4 years ago

The row data property takes an array of values, not an object. You just want the values from your object for each row, not the object itself.