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

react-native-image-overlay-prop-types-fixed

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-image-overlay-prop-types-fixed

Add overlays on top of ImageBackground proptypes commented out due to bug with react-native 0.69.6

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-image-overlay

React Native ImageBackground is useful. But you know what's even more useful?
ImageBackground with overlay. This is exactly it.

Header image


npm

Get Started

Installation

$ npm install --save react-native-image-overlay

Usage

import ImageOverlay from "react-native-image-overlay";

export class MyApp extends Component {
    render () {
        return (
            // For external image
            <ImageOverlay source={{ uri:"http://example.com/img/cool.jpg" }} />
            // For local asset
            <ImageOverlay source={require("../../assets/banner.png")} />
        )
    }
}

Props

PropDescriptionTypeDefault
blurRadiusThe blur radius of the blur filter added to the imageNumberundefined
containerStyleAdditional styling for the componentViewStyleundefined
contentPositionPosition of title text or child component (if any).String ("top","center" or "bottom")"center"
heightThe height of the whole componentNumber300
overlayColorThe color to be used for the overlay on top of the imageString"#000000"
overlayAlphaOpacity value of the overlay. From 0 to 1Number0.5
roundedValue for borderRadius to be applied to the componentNumberundefined
sourceThe image source (either a remote URL or a local file resource).ImageSource
titleText to be displayed over the imageStringundefined
titleStyleAdditional styling for the title textTextStyleundefined

Example

1. Simple overlay color

The most basic use-case of this module is to add colored overlay on top of your image.

<ImageOverlay source={{ uri:"http://example.com/img/cool.jpg" }} />

Default overlay is color is #000000 with 0.5 opacity. You can customize it to any color

<ImageOverlay
    source={{ uri:"http://example.com/img/cool.jpg" }}
    overlayColor="cyan"
    overlayAlpha={0.8} />

2. Overlay with title text

Title text image

If you want to display a simple white text on top of the image, you can use the title prop.

<ImageOverlay
    source={{ uri:"http://example.com/img/cool.jpg" }}
    title="This is the title" />

The title will be center-ed by default. You can move it to the top or bottom using the contentPosition prop

<ImageOverlay
    source={{ uri:"http://example.com/img/cool.jpg" }}
    title="This is the title"
    contentPosition="bottom" />

Additionally, you can change the styling by passing the titleStyle along

<ImageOverlay
    source={{ uri:"http://example.com/img/cool.jpg" }}
    title="This is the title"
    titleStyle={{ color: 'yellow', fontWeight: 'bold' }} />

3. Overlay with child component

Child component image

You can pass extra components to be displayed on top of your image.

<ImageOverlay
  source={{ uri:"http://example.com/img/cool.jpg" }}
  height={0.7 * height} 
  contentPosition="bottom">
    <View>
        <Image style={styles.avatar} source={{uri:"http://example.com/user/avatar.png"}} />
        <Text style={styles.name}>Amelia Edwards</Text>
        <Text style={styles.location}>Kuala Lumpur, Malaysia</Text>
        <Button text="Follow me" />
    </View>
</ImageOverlay>

Note: When you are using child component, title prop will be ignored.

Keywords

FAQs

Package last updated on 30 Sep 2022

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