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 - React Native Tutorial
From the course: React Native Essential Training
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
-
-
-
-
-
(Locked)
Introduction and preview42s
-
(Locked)
Initializing the TargetSum app4m 36s
-
(Locked)
Configuring ESLint1m 47s
-
The game component with a random target3m 54s
-
(Locked)
Generating the random play numbers9m 41s
-
(Locked)
Styling the random play numbers2m 23s
-
(Locked)
Using TouchableOpacity for press events6m 17s
-
(Locked)
Changing UI based on selected numbers7m 31s
-
(Locked)
Adding shared behavior to numbers6m 21s
-
(Locked)
Using React DevTools with React Native4m 24s
-
(Locked)
Computing dynamic values where needed5m 14s
-
(Locked)
Changing UI based on game status4m 5s
-
(Locked)
Working with timers6m 16s
-
(Locked)
Caching to optimize computable values8m
-
(Locked)
Remounting a component to reset it7m 30s
-
(Locked)
-
-
-
-