import React, {Component} from 'react';
import {StyleSheet, ScrollView} from 'react-native';
import {View, Text, Image, Card, Constants, Colors} from 'react-native-ui-lib'; // eslint-disable-line
const image = require('../../assets/images/card-example.jpg');
const customOverlayImage = require('../../assets/icons/star.png');
const customOverlayImage2 = require('../../assets/icons/cameraSelected.png');
const uri = {
uri: 'https://images.pexels.com/photos/140234/pexels-photo-140234.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260'
};
export default class OverlaysScreen extends Component {
getImageWithOverlay = (type: string | undefined, text: string, customOverlay?: JSX.Element) => {
return (
{text}
);
};
renderCustomOverlay() {
return ;
}
renderCustomOverlay2() {
return (
);
}
render() {
return (
Image Overlays
{this.getImageWithOverlay(Image.overlayTypes.VERTICAL, 'vertical')}
{this.getImageWithOverlay(Image.overlayTypes.SOLID, 'solid')}
{this.getImageWithOverlay(Image.overlayTypes.TOP, 'top')}
{this.getImageWithOverlay(Image.overlayTypes.BOTTOM, 'bottom')}
Image Overlays (absolute)
Custom Overlay
{this.getImageWithOverlay(undefined, 'cutom overlay only', this.renderCustomOverlay())}
{this.getImageWithOverlay(Image.overlayTypes.SOLID, 'solid + custom', this.renderCustomOverlay2())}
{this.getImageWithOverlay(Image.overlayTypes.VERTICAL, 'vertical + custom', this.renderCustomOverlay2())}
{this.getImageWithOverlay(Image.overlayTypes.BOTTOM, 'bottom + custom', this.renderCustomOverlay())}
Card.Image Overlay
{Image.overlayTypes.VERTICAL}
Ipsum nostrud officia deserunt irure eu.
Image Overlay (cover, remote, custom overlay)
Image Overlay (cover, asset)
Image Overlay (fill, specific height)
);
}
}
const styles = StyleSheet.create({
image: {
width: 150,
height: 150,
margin: 10
},
overlayImageAbsoluteContainer: {
width: Constants.screenWidth,
height: 380,
marginLeft: -20
},
overlayImageAbsoluteVertical: {
position: 'absolute',
top: 30,
left: 10,
width: 150,
height: 150,
margin: 5
},
overlayImageAbsoluteSolid: {
position: 'absolute',
top: 30,
right: 10,
width: 150,
height: 150,
margin: 5
},
overlayImageAbsoluteTop: {
position: 'absolute',
bottom: 20,
left: 10,
width: 150,
height: 150,
margin: 5
},
overlayImageAbsoluteBottom: {
position: 'absolute',
bottom: 20,
right: 10,
width: 150,
height: 150,
margin: 5
},
cardImage: {
width: 100,
borderRadius: 4
},
imageFillContainer: {
height: 100
},
customOverylay: {
position: 'absolute',
left: 137,
top: 134,
width: 25,
height: 25,
tintColor: Colors.yellow20,
borderWidth: 1,
borderColor: Colors.yellow20,
borderRadius: 100,
backgroundColor: Colors.rgba(Colors.yellow20, 0.2)
},
customOverylay2: {
width: 40,
height: 40,
tintColor: Colors.white
}
});