Là một công cụ xử lý ảnh, DylanVann/react-native-fast-image đã đạt 8.4k sao trên GitHub, ngôn ngữ TypeScript. 🚩 FastImage, performant React Native image component.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
React Native's Image component handles image caching like browsers
for the most part.
If the server is returning proper cache control
headers for images you'll generally get the sort of built in
caching behavior you'd have in a browser.
Even so many people have noticed:
Flickering.
Cache misses.
Low performance loading from cache.
Low performance in general.
FastImage is an Image replacement that solves these issues.
FastImage is a wrapper around
SDWebImage (iOS)
and
Glide (Android).
Features
Aggressively cache images.
Add authorization headers.
Prioritize images.
Preload images.
GIF support.
Border radius.
Usage
Note: You must be using React Native 0.60.0 or higher to use the most recent version of react-native-fast-image.
yarn add react-native-fast-image
cd ios && pod install
Are you using Glide already using an AppGlideModule?
Are you using Glide already using an AppGlideModule? (you might have problems if you don't read this)
Are you using Proguard?
If you use Proguard you will need to add these lines to android/app/proguard-rules.pro:
-keep public class com.dylanvann.fastimage.* {*;}
-keep public class com.dylanvann.fastimage.** {*;}
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
Properties
source?: object
Source for the remote image to load.
source.uri?: string
Remote url to load the image from. e.g. 'https://facebook.github.io/react/img/logo_og.png'.
source.headers?: object
Headers to load the image with. e.g. { Authorization: 'someAuthToken' }.
source.priority?: enum
FastImage.priority.low - Low Priority.
FastImage.priority.normal(Default) - Normal Priority.
FastImage.priority.high - High Priority.
source.cache?: enum
FastImage.cacheControl.immutable - (Default) - Only updates if url changes.
FastImage.cacheControl.web - Use headers and follow normal caching procedures.
FastImage.cacheControl.cacheOnly - Only show images from cache, do not make any network requests.
defaultSource?: number
An asset loaded with require(...).
Note that like the built-in Image implementation, on Android defaultSource does not work in debug mode. This is due to the fact that assets are sent from the dev server, but RN's functions only know how to load it from res.
resizeMode?: enum
FastImage.resizeMode.contain - Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).
FastImage.resizeMode.cover(Default) - Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding).
FastImage.resizeMode.stretch - Scale width and height independently, This may change the aspect ratio of the src.
FastImage.resizeMode.center - Do not scale the image, keep centered.
onLoadStart?: () => void
Called when the image starts to load.
onProgress?: (event) => void
Called when the image is loading.
e.g. onProgress={e => console.log(e.nativeEvent.loaded / e.nativeEvent.total)}
onLoad?: (event) => void
Called on a successful image fetch. Called with the width and height of the loaded image.
e.g. onLoad={e => console.log(e.nativeEvent.width, e.nativeEvent.height)}
onError?: () => void
Called on an image fetching error.
onLoadEnd?: () => void
Called when the image finishes loading, whether it was successful or an error.
style
A React Native style. Supports using borderRadius.
fallback: boolean
If true will fallback to using Image.
In this case the image will still be styled and laid out the same way as FastImage.
tintColor?: number | string
If supplied, changes the color of all the non-transparent pixels to the given color.
If you have any problems using this library try the steps in troubleshooting and see if they fix it.
Development
Follow these instructions to get the example app running.
Supported React Native Versions
This project only aims to support the latest version of React Native.
This simplifies the development and the testing of the project.
If you require new features or bug fixes for older versions you can fork this project.
Credits
The idea for this modules came from
vovkasm's
react-native-web-image
package.
It also uses Glide and SDWebImage, but didn't have some features I needed (priority, headers).
Thanks to @mobinni for helping with the conceptualization
DylanVann/react-native-fast-image thuộc nhóm Image Tools trên TopGit, cùng 8 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về DylanVann/react-native-fast-image ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/DylanVann/react-native-fast-image là nguồn chính thức.
DylanVann/react-native-fast-image có bao nhiêu sao?
DylanVann/react-native-fast-image có 8.4k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/DylanVann/react-native-fast-image. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
DylanVann/react-native-fast-image có phải mã nguồn mở không?
Có — DylanVann/react-native-fast-image phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/DylanVann/react-native-fast-image.
DylanVann/react-native-fast-image có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho DylanVann/react-native-fast-image. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
DylanVann/react-native-fast-image là gì?
DylanVann/react-native-fast-image (DylanVann/react-native-fast-image) là dự án TypeScript trên GitHub. Theo mô tả gốc: 🚩 FastImage, performant React Native image component.
DylanVann/react-native-fast-image so với các dự án Image Tools khác thế nào?
DylanVann/react-native-fast-image được TopGit xếp vào nhóm Image Tools, với 8.4k sao GitHub và viết bằng TypeScript. Xem trang chủ đề Image Tools trên TopGit để so sánh với các dự án tương tự theo số sao và mức độ hoạt động.
Đọc đầy đủ README ở tab phía trên.
react-native-fast-image có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về react-native-fast-image.