Posts

Showing posts from October, 2017

Styling in React Native

When you first jump into React Native, styling can seem a little confusing; it’s in JavaScript, it has some but not all features of css, certain styles can only be used on certain components, and the list goes on. I’m aiming to be of aid to the initial confusion. Instead of going too deep into how React Native styles work, I want to keep this post as pragmatic as possible. I’ll simply share some practical points that I would have wanted to know, prior to styling in React Native. – Use StyleSheet You can write your styles inline but that’s usually not the best idea. There are times to take advantage of inline styles but when in doubt, use StyleSheet,  import { StyleSheet } from 'react-native' . It’s often worth splitting your styles from your component code and importing them into your component. Using StyleSheet is an easy way to handle the maintainability of your front-end codebase. Too many inline styles will cause bloated component code and unfortunately you can’t just