Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
react-native-turbo-image
Advanced tools
You can find more examples in example folder
Performant image component for React Native. Powered by Nuke and Coil
npm install react-native-turbo-image
cd ios && pod install
import TurboImage from 'react-native-turbo-image';
<TurboImage
source={{ uri: "https://github.com/duguyihou/react-native-turbo-image/assets/9347790/7955aa00-0b53-44d1-88bd-9b5e320db21e" }}
style={{ width: 300, height: 300 }}
/>;
Name | Type | Description | Default |
---|---|---|---|
source | Source | (Required) an object containing a uri string | - |
style | ImageStyle | Styles to be applied to the image. | - |
placeholder | Placeholder | show placeholder while loading | - |
cachePolicy | CachePolicy | Determines how to cache the image | urlCache |
resizeMode | String | Resize the image with one of the options: contain cover stretch center | contain |
indicator | object | style : medium (default) or large . color : number / ColorValue | - |
fadeDuration | number | The transition duration of the image. Note: To avoid flicking, it will be set to 0 when a placeholder is provided | 300(iOS) / 100(Android) |
resize | number | Scales an image to the given width preserving aspect ratio | - |
blur | number | The blur radius of the blur filter added to the image | - |
monochrome | number / ColorValue | The color applied to the image. note: For iOS and Android Q+, it works with any color. For Android Q-, it only supports grayscale | - |
tint | number / ColorValue | The color is applied to every non-transparent pixel, causing the image’s shape to adopt that color. This effect is not applied to placeholders | - |
showPlaceholderOnFailure | boolean | Show the placeholder image in the case of a failure | false |
rounded | boolean | Round the image into a circle | false |
enableLiveTextInteraction | boolean | Enables Live Text interaction with the image (iOS 16+ only) | false |
allowHardware | boolean | Setting this to false this will reduce performance on API 26 and above. Only disable this if necessary. Coil's docs (Android only) | false |
format | string | Specify the format for special image, e.g. svg , gif and apng . In general, TurboImage will determine the decoder automatically. | - |
onStart | Function | The function to call when the image is fetching. | - |
onSuccess | Function | The function to call when the image is successfully loaded | - |
onFailure | Function | The function to call when the request failed | - |
onCompletion | Function | The function to call when the request is completed | - |
prefetch
await TurboImage.prefetch([Source]);
dispose
await TurboImage.dispose([Source]);
clearMemoryCache
await TurboImage.clearMemoryCache();
clearDiskCache
await TurboImage.clearDiskCache();
Name | Type | Description |
---|---|---|
uri | string | the url of the image |
headers | Record<string, string> | An object representing the HTTP headers to send along with the request for a remote image |
cacheKey | string | The cache key used to query and store this specific image. If not provided, the uri is used also as the cache key |
Name | Type | Description |
---|---|---|
thumbhash | string | A string used to generate the image placeholder. For more information, see thumbhash |
blurhash | string | A string used to generate the image placeholder. For more information, see woltapp/blurhash. |
memoryCacheKey | string | Using the key of previous request as placeholder. For more information, see Memory Cache Key |
thumbhash | blurhash | memoryCacheKey |
---|---|---|
Name | Type | Description |
---|---|---|
urlCache | string | Allows the server to manage caching precisely through cache-control HTTP headers. You can determine which images to cache and caching duration |
dataCache | string | Ignores HTTP cache control |
See the contributing guide to learn how to contribute to the repository and the development workflow.
TurboImage is released under the MIT license. Some of the dependencies are licensed differently, with the Apache-2.0 license, for example.
FAQs
Performant image for React native
The npm package react-native-turbo-image receives a total of 8,042 weekly downloads. As such, react-native-turbo-image popularity was classified as popular.
We found that react-native-turbo-image demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.