Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/overlay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {StyleSheet, Image, ImageProps, ImageSourcePropType} from 'react-native';
import {Colors} from '../../style';
import View from '../view';
import Assets from '../../assets';
import Constants from '../../commons/Constants';

const OVERLY_TYPES = {
VERTICAL: 'vertical',
Expand Down Expand Up @@ -85,7 +86,7 @@ class Overlay extends PureComponent<OverlayTypes> {
};

renderImage = (style: any, source: ImageSourcePropType) => {
return <Image style={[styles.container, style]} resizeMode={'stretch'} source={source}/>;
return <Image style={[styles.container, Constants.isWeb && styles.containerWeb, style]} resizeMode={'stretch'} source={source}/>;
};

getImageSource = (type?: OverlayTypeType, intensity?: OverlayTypes['intensity']) => {
Expand Down Expand Up @@ -128,6 +129,9 @@ const styles = StyleSheet.create({
...StyleSheet.absoluteFillObject,
width: undefined
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try to move the Constants.isWeb here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed, working fine.

},
containerWeb: {
width: '100%'
},
top: {
bottom: undefined,
height: '75%'
Expand Down
2 changes: 1 addition & 1 deletion webDemo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"react-native-shimmer-placeholder": "^2.0.8",
"react-native-svg": "15.11.2",
"react-native-svg-transformer": "1.5.0",
"react-native-ui-lib": "8.0.0",
"react-native-ui-lib": "8.0.0-snapshot.7447",
"react-native-web": "^0.18.6",
"typescript": "^4.4.2"
},
Expand Down
54 changes: 54 additions & 0 deletions webDemo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Slider from 'react-native-ui-lib/Slider';
import Stepper from 'react-native-ui-lib/Stepper';
import Icon from 'react-native-ui-lib/Icon';
import DateTimePicker from 'react-native-ui-lib/DateTimePicker';
import UIImage from 'react-native-ui-lib/Image';
// import FloatingButton from 'react-native-ui-lib/FloatingButton'
import Chip from 'react-native-ui-lib/Chip';
import Badge from 'react-native-ui-lib/Badge';
Expand Down Expand Up @@ -307,6 +308,59 @@ const itemsToRender: ItemToRender[] = [
title: 'Image',
FC: Image
},
{
title: 'Image with Overlay',
FC: () => {
const imageSource = {
uri: 'https://images.pexels.com/photos/248412/pexels-photo-248412.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=200'
};

return (
<View row spread gap-s2>
<View center>
<Text marginB-5 text80>Top</Text>
<UIImage
source={imageSource}
width={100}
height={100}
overlayType={UIImage.overlayTypes.TOP}
overlayIntensity={UIImage.overlayIntensityType.MEDIUM}
/>
</View>
<View center>
<Text marginB-5 text80>Bottom</Text>
<UIImage
source={imageSource}
width={100}
height={100}
overlayType={UIImage.overlayTypes.BOTTOM}
overlayIntensity={UIImage.overlayIntensityType.MEDIUM}
/>
</View>
<View center>
<Text marginB-5 text80>Vertical</Text>
<UIImage
source={imageSource}
width={100}
height={100}
overlayType={UIImage.overlayTypes.VERTICAL}
overlayIntensity={UIImage.overlayIntensityType.MEDIUM}
/>
</View>
<View center>
<Text marginB-5 text80>Solid</Text>
<UIImage
source={imageSource}
width={100}
height={100}
overlayType={UIImage.overlayTypes.SOLID}
overlayIntensity={UIImage.overlayIntensityType.MEDIUM}
/>
</View>
</View>
);
}
},
{
title: 'Progressive Image',
FC: ProgressiveImage
Expand Down