在下面的数组“活动”中有 4 个值,我正在尝试映射这个值并在 ui 上显示消息和日期。这很好,但每次日期都在重复。就像
2019-07-11
Hello 1
2019-07-11
hello 2
2019-07-10
hello 3
如果日期相同,我必须按日期显示值,但不要重复日期。就像
2019-07-11
Hello1
Hellow2
2019-07-10
hello 3
hello 4
active: Array(4)
0:
created_at: "2019-07-11"
date: "Today"
message: "<p> Hello 1 </p>
status: 1
time: "07:01:41"
title: "Telephone"
__typename: "NotificationList"
1:
created_at: "2019-07-11"
date: "Today"
message: "<p> Hello 2 </p>
status: 1
time: "06:59:38"
title: "MSISDN"
__typename: "NotificationList"
2:
created_at: "2019-07-10"
date: "Today"
message: "<p> Hello 3 </p>
status: 1
time: "06:57:08"
title: "Telecom BSS"
__typename: "NotificationList"
3:
created_at: "2019-07-10"
date: "Today"
message: "<p> Hello 4 </p>
status: 1
time: "06:57:08"
title: "Telecom BSS"
__typename: "NotificationList"
// Here am maping active array
{notifications.notificationList.active.map((data,index) =>{
const datahtml=data.message;
const datee=formatDateTime(data.created_at);
return(
<View key={index}>
<View style={{flexDirection:'column', backgroundColor:'white'}}>
<Label text= {`${datee}`}/>
<Heading title={`${data.title}`} time={`${data.time}`}/>
<HTML html={datahtml} imagesMaxWidth={Dimensions.get('window').width} />
</View>
</View>
)
})}
谢谢