Files
booster/docs/tips/image.md
Zhigang Fang 7bd8afbb4c Jan 3 2020 release (#29)
* chore: cleanup (#8)

* chore: clean up repo

* restore bundle id

* upgrade versions from react-native-firebase

* chore: upgrade gradle

* chore: remove perf

* chore: upgrade react native

* chore: update podfile.lock

* fix: deploy script

* chore: upgrade android dependencies

* chore: add crashlytics maven source

* fix: android

* fix: messaging

* feat: add default wording

* fix: adminsdk in functions

* chore: upgrade deps

* feat: integrate basic chat (#9)

* fix: test

* chore: wip add chat

* chore: add basic chat

* chore: update lock files

* chore: add android signing

* chore: only sign release build

* chore: fix react-native-progress-display

* fix: only support 21 and up

* chore: update fix on react-native-progress-display

* chore: add database

* fix: build

* chore: attemp on fix google sign in

* fix: google login

* chore: add appcenter

* feat: switch to appcenter

* fix: typo

* chore: add group

* docs: bootstrap documentation site (#12)

* chore: remove old README.md

* chore: init with docsify

* feat: add basic quick start

* docs: wip - add firebase config

* feat: add more docs

* docs: add structure

* feat: add back root read me

* Remove Examples etc from Root README.md

* docs: update wording (#13)

* chore: remove old README.md

* chore: init with docsify

* feat: add basic quick start

* docs: wip - add firebase config

* feat: add more docs

* docs: add structure

* feat: add back root read me

* docs: update wording

* docs: add 🚧

* docs: rename social login

* fix: navigation bar on lower version of android (#14)

* chore: fix debug sign and google sign in

* chore: update deps to avoid security risks

* chore: remove unused yarn.lock

* docs: add stores release

* wip add code push docs

* chore: add code push

* doc: add code push documentation

* doc: update wording

* doc: targeting release branch for general usage.

* fix: disable image processing

* chore: remove fonts icons

* chore: remove font from resources

* fix: build on android

* chore: disable github action

Will implement with new version of github later on

* chore: remove pages

* feat: upgrade to latest version of RN

* fix: pod install

* remove podfile.lock from booster

* remove test for run

* feat: hardcode name to booster

* fix: typescript

* feat: add get started

* feat: add colors

* use safearea

* add bootstrap

* add ci

* fix: iOS buid

* fix: android build

* feat: add basic

* chore: add browser and geolocation

* feat: use phone number input

* feat: add search page

* feat: add country select

* feat: add phone auth

* feat: add SMS code input

* fix: build

* feat: add dummy profile types

* fix: build

* chore: move strings.xml to env config

* feat: update docs

* chore: add jetify

* feat: set init version to 1.0.0 for codepush

* add use task

* fix: name

* feat: enhance appstore distribution

* add binary path

* increase java mem for build

* chore: ignore logs

* upload dsym to appcenter as well

* set xcode version to 10.3

* add store build

* feat: add border to phone number input

* feat: add verification code

* feat: complete sms onboarding

* revert testing

* run webhooks

* set CI to true on server

* chore: add eslint to functions

* switch all to eslint

* chore: add tipsi stripe

* fix: typing

* typo

* chore: add script

* using copy

* feat: add server json

* fix: android build

* fix: build

* feat: add code push doc

* chore: add server.json to ignore

* feat: add cicd draft

* chore: add release.keystore for multiple env

* feat: add multiple env

* docs: add switch to prod

* chore: add facebook

* chore: fix build

* chore: add login with facebook

* chore: add redirect

* fix: login

* feat: add landing

* chore: bump version

* chore: remove gemfile in android

* chore: add version and lazy functions

* chore: add version.json to git

* bump ruby version

* Add version tap

* Update run-the-app.md

* Update run-the-app.md

* chore: remove js from ignore

* chore: add eslint

* chore: add update version

* chore: update

* chore: change script to rename

* chore: bump cocoapods

* chore: migrate to v6 of rn firebase

* chore: remove task

* chore: upgrade rn

* chore: fix build

* chore: clear lib on build

* chore: add firebase token

* feat: add Reveal for Debug

* chore: update deps

* remove fbsdk in podfile

* chore: bump fbsdk version

* fix: fbsdk

* fix: replace

* chore: install deps

* feat: add tracking route

* chroe: revert to screens 1

* chore: bump paper to 3

* chore: update deps

* doc: update docs

* chore: remove fonts

* fix: search bar

* chore: remove IQKeyboard manager

* chore: remove test and tv target

* fix: disable IQKeyboardManager

* wip - add storybook

* chore: add example

* chore: add example project follow up

* upgrade react navigation to v5

still broken

* upgrade react navigation to v5

* fix: ci

* feat: upgrade rn version

* chore: disable codepush on __DEV__

* fix: web version

* refactor: route

* chore: add tailwind css

* chore: update android key

* chore: add .idea file

* wip- add site

* remove typed reference

* upgrade prettier used in eslint

* upgrade deps

* feat: add AppRouteContext for reset

* feat: add home nav

* feat: move all components to booster

* feat: move logout to user page

* feat: add note on node10

* doc: refactor and add image doc

* fix: typo

* doc: add booster release documentation

* doc: add master usage
2020-01-03 20:42:22 +08:00

1.8 KiB

FastImage

Always use FastImage for remote images, it has much better caching and performance.

But always use react-native/Image for local images, because FastImage will load sequentially which means that a remote image might block a local image display.

Use svg for vector images

Preferably, we should always use svg for local assets.

In booster, we integrated with svg out of the box

So you can easily import svg files as components

import SearchIcon from "./asset/searchIcon.svg";

There are certain limits on what kind of svg properties react-native support, but it our usages, it was more than good.

Also, you should use tools like OMGSVG to slim down svg files exported from Sketch. It can usually reduce the svg size by more than 50%

Image resize

Booster integrates with react-native-image-resizer, so you can resize you image before upload.

This is useful when you want to cap user upload image to a certain size.

Image thumbnails

Its always a good idea to load small thumbnails over origin image.

  • It's faster to download
  • It consumes less memory in the app

Booster comes with a image flexible thumbnail service out of the box, in the form of a firebase cloud function.

It will be a API like this

https://us-central1-mercy-dev.cloudfunctions.net/image-resize?url=${encodeURIComponent(imageURL)}&width=300&height=300

This will download your image, resize it and then cache it in firebase storage, and then later on serves from storage directly if the url, width and height is the same.