1598871540
A recent project came with some big challenges. The client wanted a demo experience that would display a range of different websites within a branded ‘container’. These demo websites would be interactive within a mock desktop or mobile device, each with its own individual theme. In this article, I will dive deeper into:
This was challenging enough, but on top of this, we needed to give the user the ability to toggle between the mocked ‘desktop’ display and ‘mobile’ display modes, all within this static container, without using media queries. I will address this challenge in a follow up article.
Here are two illustrations of what we produced:
Mobile view
Desktop View
The first step here was figuring out how many themes we were going to need, and secondly, how to set up these themes. It was crucial that we set this up correctly from the beginning, to save us a lot of grief in the long run.
#programming #typescript #javascript #styled-components #react
1598839687
If you are undertaking a mobile app development for your start-up or enterprise, you are likely wondering whether to use React Native. As a popular development framework, React Native helps you to develop near-native mobile apps. However, you are probably also wondering how close you can get to a native app by using React Native. How native is React Native?
In the article, we discuss the similarities between native mobile development and development using React Native. We also touch upon where they differ and how to bridge the gaps. Read on.
Let’s briefly set the context first. We will briefly touch upon what React Native is and how it differs from earlier hybrid frameworks.
React Native is a popular JavaScript framework that Facebook has created. You can use this open-source framework to code natively rendering Android and iOS mobile apps. You can use it to develop web apps too.
Facebook has developed React Native based on React, its JavaScript library. The first release of React Native came in March 2015. At the time of writing this article, the latest stable release of React Native is 0.62.0, and it was released in March 2020.
Although relatively new, React Native has acquired a high degree of popularity. The “Stack Overflow Developer Survey 2019” report identifies it as the 8th most loved framework. Facebook, Walmart, and Bloomberg are some of the top companies that use React Native.
The popularity of React Native comes from its advantages. Some of its advantages are as follows:
Are you wondering whether React Native is just another of those hybrid frameworks like Ionic or Cordova? It’s not! React Native is fundamentally different from these earlier hybrid frameworks.
React Native is very close to native. Consider the following aspects as described on the React Native website:
Due to these factors, React Native offers many more advantages compared to those earlier hybrid frameworks. We now review them.
#android app #frontend #ios app #mobile app development #benefits of react native #is react native good for mobile app development #native vs #pros and cons of react native #react mobile development #react native development #react native experience #react native framework #react native ios vs android #react native pros and cons #react native vs android #react native vs native #react native vs native performance #react vs native #why react native #why use react native
1598871540
A recent project came with some big challenges. The client wanted a demo experience that would display a range of different websites within a branded ‘container’. These demo websites would be interactive within a mock desktop or mobile device, each with its own individual theme. In this article, I will dive deeper into:
This was challenging enough, but on top of this, we needed to give the user the ability to toggle between the mocked ‘desktop’ display and ‘mobile’ display modes, all within this static container, without using media queries. I will address this challenge in a follow up article.
Here are two illustrations of what we produced:
Mobile view
Desktop View
The first step here was figuring out how many themes we were going to need, and secondly, how to set up these themes. It was crucial that we set this up correctly from the beginning, to save us a lot of grief in the long run.
#programming #typescript #javascript #styled-components #react
1593511347
I
am pretty sure that a lot of people, including me, are huge fans of color theming. Although every single device that I own is set to the dark mode I love that feeling of being able to choose rather than being forced to use that bright white theme at the 3:48 AM day before the release. (I love you stripe ❤)
I’m not going to go in depths with context, typescript, or styled-components, I will just guide you through one of many solutions that I find comfortable using.
Let’s start by creating the app first. I’m going to do the minimal setup of the project, that said I’m just going to use the good old “create-react-app”.
If you don’t trust me about this part just go through the docs or skip the next part.
$ npx create-react-app auto-theme --template typescript
I sincerely suggest you using eslint and prettier with typescript because it’s a killer combo.
As far as styled-components are concerned I’ll follow through their official documentation as well.
You start by adding
$ yarn add styled-components
And because we’re doing this with typescript we’re going to have to add types as well.
$ yarn add -D @types/styled-components
Okay, so you should’ve ended up with something like this
Now we’ll be removing the CSS files and that test, you can just paste the command in the root of your project and it’ll do it for you.
$ rm -rf src/App.css src/App.test.tsx src/index.css src/logo.svg
#styled-components #react-context #react #typescript #programming
1591207740
To keep things simple and concise, we’ll start fresh with npx create-react-app dark-toggle . While we’re in our command line, let’s get the npm packages out of the way as well:
npm install styled-components styled-theming redux react-redux
styled-components: we’ll use this library to create isolated components that encapsulate their own styling
styled-theming: this library offers a very clean API to work with multiple themes in your styled components
redux and react-redux will do the heavy lifting regarding state management
#styled-components #react #react-hook #dark-theme #redux #react-native
1636236360
In this lesson we look at how to add #cypress with code coverage support for a Create #React App application with #TypeScript.
In the end you will have a developer flow that can save you a bunch of time in testing effort