Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rax-image

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rax-image

Image component for Rax.

  • 0.3.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
118
decreased by-51.04%
Maintainers
1
Weekly downloads
 
Created
Source

Image

npm

Based on the realization of the type of image, a better picture can be displayed using Picture components.

Install

$ npm install rax-image --save

Import

import Image from 'rax-image';

Props

nametypedefaultdescribe
scoureObject''set image uri
styleObject''if picture is not set wide high default is 0x0
resizeModeString''Decide how to resize the image when the component size and picture size are out of proportion

Support any custom attributes.

resizeMode supported values include:contain、cover、stretch、center、repeat

Local image sample

Before you use it, check that image-source-loader is already enabled in webpack.config.js

import {createElement, Component, render} from 'rax';
import Image from 'rax-image';

class App extends Component {
  render() {
    return (
      <Image source={require('./path/to/your/image.png')}
        resizeMode="cover"
      />
    );
  }
}

render(<App />);

URL image sample

// demo
import {createElement, Component, render} from 'rax';
import Image from 'rax-image';

class App extends Component {
  render() {
    return (
      <Image source={{
          uri: 'https://gw.alicdn.com/tfs/TB1g6AvPVXXXXa7XpXXXXXXXXXX-215-215.png'
        }}
        style={{
          width: 100,
          height: 100,
        }}
        resizeMode="cover"
      />
    );
  }
}

render(<App />);

Keywords

FAQs

Package last updated on 21 Jun 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc