Check out example codes for "change selection color uitableviewcell swift". It will help you in understanding the concepts better.
Code Example 1
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
if selected {
contentView.backgroundColor = UIColor.green
} else {
contentView.backgroundColor = UIColor.blue
}
}
Learn ReactJs, React Native from akashmittal.com