Big News: Socket Selected for OpenAI's Cybersecurity Grant Program.Details
Socket
Book a DemoSign in
Socket

@imageengine/reactnative

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@imageengine/reactnative

imageengine support for react-native

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
0
Created
Source

ImageEngine React Native

This project provides a React Native package for building optimized image URLs using ImageEngine. It includes utility functions and components to handle responsive images efficiently.

Live Demo

Check out our CodeSandbox demo to see the imageengine-reactnative package in action.

Installation

npm install @imageengine/reactnative

Usage

Utilities (src/utils.ts)

  • generateOptimizedImageUrl: Constructs an optimized image URL based on the provided srcSet, deliveryAddress, and other parameters.
  • chooseAppropriateImage: Selects the best image from a srcSet that fits the available screen width.
  • processUrl: Cleans up the URL by removing unwanted parts and checks for supported image formats.
  • constructUrl: Builds the final image URL using the provided source and directives.

Responsive Component (src/responsive_comp.tsx)

  • ResponsiveImage: A React component that renders an image optimized for the current screen size. It uses generateOptimizedImageUrl to determine the best image URL to use.

Example Application (example/src/App.tsx)

  • App: Demonstrates the usage of the ResponsiveImage component with a predefined srcSet. It logs when the component is rendered and displays a sample image.

Types

  • IEFormat: Enum for supported image formats.
  • IEFit: Enum for image fit options.
  • IEDirectives: Class defining image transformation directives.

Keywords

react-native

FAQs

Package last updated on 02 Dec 2024

Did you know?

Socket

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.

Install

Related posts