I’m building a to-do list and was wondering if it’s possible to strikethrough the title section of a collection (list) when the task has been completed?
Most of the older posts here suggest that it’s only possible to display strikethrough in a rich text component but I just want to try my luck and see if anyone has managed to do this.
function strikethrough(text) {
return text
.split("")
.map(char => char + "\u0336") // Add a combining long stroke to each character
.join("");
}
return strikethrough(p1);
function strikethrough(text, taskCompleted) {
if (taskCompleted) {
return text
.split("")
.map(char => char + "\u0336") // Add a combining long stroke to each character
.join("");
}
return text; // Return the original text if the boolean is false
}
return strikethrough(p1, p2);
Assuming you have a boolean as the “complete” value for your task, you can do it like this.