Skip to content

How to fix the style of the image. #2

@igachmov

Description

@igachmov

The library is great, but if you want to change the style of the image, you need to add a prop imageStyle to the component and then you need to go to node_modules/react-native-image-gradient/distribution/index.js and add the imageStyle prop to the ImageBackground component. The code should look like this.

  <ImageGradient imageStyle={styles.imageStyle}/>

return _react2.default.createElement(_reactNative.ImageBackground, { imageStyle: this.props.imageStyle, style: mainStyle, source: localImage ? require(imageUrl) : { uri: imageUrl } }, _react2.default.createElement(_reactNativeLinearGradient2.default, {
            style: gradientStyle,
            start: startPosition,
            end: endPosition,
            colors: ['rgba(' + rgbcsvEnd + ',' + opacityEnd + ')', 'rgba(' + rgbcsvStart + ',' + opacityStart + ')']
        }, this.props.children));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions