This post is 3rd in a the Full Stack Product Series Series. If you just landed here, it might be worthwhile checking out the series overview.
As you have gotten a chance to play a little with React Native, you may have noticed that it comes with a pretty barebones UI toolkit. At first is enough to get away with the basics, but can be a lot of work to later update with consistent branding (event worse for future rebrandings) and expand to create dynamic experiences that most people have come to expect.
In this section we will add a UI kit that will give us some flexibility for consistent and useful UIs.
There are a number of different UI kits for React Native available, we will be working with UI Kitten. It is a nice component library based on the Eva Design System. It makes it easy to work with designs created in Sketch, which allows designers to mock up and wireframe UIs before writing code.
Start a new React Native spike and Follow the Manual Installation tutorial to get the basics for UI Kitten installed. You can go with the fully automated version, but this is a good logical fragmentation point to understand what react native. Continue though the “Branding” and “Icon Package” sections minimally.
⚠️ Make sure to read about how to install the svg package.
Take some time to play with light vs dark themes, and generating your own. Read though the Components Overview to get a sense for what additional components are available and try some of them out.
In VS Code you should see some TypeScript issues presented. It will be pretty common to get TypeScript errors along the way throughout this series. Take some time to try to resolve them, but since they are primarily there for developer benefit, timebox this effort to stay on track.
Before moving on, you should be able to:
Follow the same process as above to:
Take a look at the reference product CoachMe-App @ 94d1c8b to see if you have something similar.
Internalizing concepts like Sandi Metz’s Breaking Up the Behemoth and Martin Fowler’s Design Stamina Hypothesis, we should start with the simplest thing possible and evolve the design as necessary. There are a series of commits that do this for the home screen and login button.
Reviewing the Reference App’s History:
Text
component in action. Looks much better.Text
component has a category
parameter, React Native’s does not.Button
directly is reasonable. As a component gains more complexity it makes sense to break it out into a custom component (i.e. LoginButton
).LoginIcon
is a wrapper for Icon
. The accessoryLeft
property of Button
looks for a functional component, not an instance (review the Button API for more details).Parameter 'props' implicitly has an 'any'
) for LoginIcon
. To fix this error we need to give it a parameter definition. The easiest way is to do this with the existing IconProps
type from UI Kitten. If the library did not have a definition, we would need to create one or ignore the error.App
component is becoming pretty heavy with a lot of responsibilities. Refactoring out a HomeScreen
component gives a clearer separation of concerns.App
component to be a bit more uniform with a more terse function definition.HomeScreen
component into a separate file reduces the complexity for the App
component and creates a clearer separation of concerns. The components
directory is a common place to find these types of things.Before moving on, you should be able to: