2021年3月24日星期三

Change color of the pressed item

I have a component that has:

            {                  tSlots.map((time, index) =>                      <TouchableOpacity onPress={() => {                            var pieces = time.split(':')                            hour = parseInt(pieces[0], 10);                          minute = parseInt(pieces[1], 10);                            selectTimeHandler(hour, minute)                        }}>                          <Text style={[styles.timeText, { color: WHAT_TO_DO_HERE }]} key={index}>{time}</Text>                      </TouchableOpacity>                  )              }  

tSlots is an array that has time slots in string. I don't know how to change the color of text I've marked it WHAT_TO_DO_HERE in the code snippet above.

https://stackoverflow.com/questions/66792928/change-color-of-the-pressed-item March 25, 2021 at 12:06PM

没有评论:

发表评论