Skip to main content

Posts

Showing posts from February, 2020

How To Reduce Your App’s APK Size, Even If You Use Realm Database in React Native

This article is for the developers who’ve heard of or have been using Realm Database in their Android apps. This is a tutorial that aims to help you set up your Android project in a way that takes less space than it normally would. A Time Before Realm… Let’s go back to a time when I’d implemented a normal, boring  SQLite database  in app. The APK size of the app was  4MB . But as most of you know, writing a SQLite database is quite  boring  and consists of a lot of boilerplate code. Changing the database schema meant making a lot of changes in other parts of the code as well. Enter, Realm When I first heard about Realm from someone on Reddit, I was blown away by how easy it was to set it up and get a database up and running, one that even came with cloud syncing functionalities! It was easy to make changes to the database schema without having to change much of the code I’d already written. It was super easy and quick to perform CRUD o...

Progressive Image Loading in React Native

Getting Started To start create a new React Native app (via  react-native init ,  create-react-native-app , or the  expo  cli) and add the following to  App.js . import React from 'react'; import { StyleSheet, View, Dimensions, Image } from 'react-native'; const w = Dimensions.get('window'); const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, }); export default class App extends React.Component { render() { return ( <View style={styles.container}> <Image source={{ uri: `https://images.pexels.com/photos/671557/pexels-photo-671557.jpeg?w=${w.width * 2}&buster=${Math.random()}` }} style={{ width: w.width, height: w.width }} resizeMode="cover" /> </View> ); } } Feel the Pain Like I said before — as a developer you’ve probably got a pretty decent internet connection....