Sometimes, we have a long list, and then we want to locate the list to one of the items that got a change but not currently been shown in the viewport, let’s see how to do that in React.
v2 is a library for handling navigation in
React Native. When you are using Tab / Screen, maybe you only want to render it when it is been displayed. Otherwise, something like re-rendering multiple lists in multiple tabs. That’s a disaster… Let’s see how to do that.
React native is amazing. But things could be tough for times. Here are something I’ve from project to project that I want to share with you, which may save you some time in the future.
There are times when some data is updated, you want to update multiple UI, be them activities or fragments. You can update them manually but that code will look messy. Or you can use the observable pattern to update the UI every time the source data gets updated. Today I will show you how to use
LiveData from Google’s new architecture component to achieve this. You can use
RxJava to do the same thing. architecture component will be easier and less error-prone. Because they are life-cycle aware.
The library that we are going to talk about in this blog is
ViewModel from the official architecture component,
dagger-android for managing dependency injection. If you want to learn
dagger-android in a quick and easy way, I’ve got a blog covered.
Previously, we talked about how to do mock using dagger 2 and dagger-android. But as the wise man said:
If You Didn't Test It, It Doesn't Work. So let’s see how to do the test. An important part of doing the UI test is mock, we don’t really want to deal with network request even it allows us to. Today, I share the knowledge of how to mock the injections from
dagger-android in the UI test (instrumented tests). I write this because most of the online tutorials are using
dagger-android in a
dagger 2 way which leads to more code, or even worse, some mixed up usage will make people even more confused. Even though
confuse is a word that tends to be bound with
dagger. :D Oh, well, it’s a bad joke.
Permission handling should be simple, but not the case in Android. Or at least before you know a lot about it. This article aims to solve that problem. And we will use
Anko here to make it better.
When I say dynamic UI I mean the UI you generated from a library like
Anko or just plain Android API.
DI is a pattern to decouple your code. You don’t need to have a DI framework to handle the injection, but using such will make your application better. Things like singleton and initialization. Let’s see how to do that in Android using Dagger. Even you don’t what DI is, we will go through it pretty fast and clear. We will use Kotlin, plain Dagger and Android Studio here.