From the course: React Native Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Changing UI based on game status

Changing UI based on game status - React Native Tutorial

From the course: React Native Essential Training

Start my 1-month free trial

Changing UI based on game status

- [Instructor] Let's simply make the target green or red based on the gameStatus. So I can add another style here for the target to set maybe the background color to either green or red based on the gameStatus. So I'll make this into an array so that we can add another style. And in here I'm going to actually use another function to compute the style of this target panel based on the gameStatus. So let's do exactly that. Let's call this function, targetPanelStyle. We can just pass the gameStatus here directly to this targetPanelStyle so that we don't compute it again. Let me format this a little bit. And now we can write targetPanelStyle. So targetPanelStyle is a function and this function is going to receive the gameStatus here. So this is the gameStatus. And based on the gameStatus, it's going to return a style sheet. Well, you know what? I think we can do this with an easier way. Instead of introducing a new…

Contents