forked from mochixuan/react-native-drag-sort
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
<DragSortableView
dataSource={subSubjects}
parentWidth={width}
keyExtractor={(item, index) => item.subjectId}
childrenWidth={width * 0.305}
childrenHeight={40}
renderItem={(item, index) => {
return (
<CustomButton
onPress={() => {
if (isEdit) {
if (subSubjects.length === 1) {
showToast('至少要选择一个感兴趣的分类')
return
}
subSubjects.forEach((subItem, index) => {
if (subItem.subjectId === item.subjectId) {
subSubjects.splice(index, 1)
}
})
const subSubjectIds = subSubjects.map((item) => item.subjectId)
subjects.map((item) => {
return item.subSubjects.map((subItem) => {
subItem.isActive = false
if (subSubjectIds.includes(subItem.subjectId)) {
subItem.isActive = true
}
return subItem
})
})
setSubSubjects([...subSubjects])
} else {
setCourseSubSubjects(
JSON.stringify({ index: index + 1, subjectId: item.subjectId, name: item.name })
)
DeviceEventEmitter.emit('updateXinLiCategoryVisible')
}
}}
key={item.subjectId}
showX={item.isActive}
title={item.name}
containerStyle={{
backgroundColor: gtuiTheme.colors.brand50,
width: width * 0.305,
marginBottom: 16
}}
titleStyle={{
color: gtuiTheme.colors.brand500
}}
/>
)
}}
/>Metadata
Metadata
Assignees
Labels
No labels