Answers for "make image to take size of parrent react native"

2

full width of image and maintain aspect ratio react native

render() {
    let image = this.props.requireSource;
    const { width, height } = Image.resolveAssetSource(image);
    const ratio = height / width;
    const SCREEN_WIDTH = Dimensions.get('window').width;

    return (
        <Image source={image} style={{width: SCREEN_WIDTH, height: SCREEN_WIDTH*ratio}} resizeMode="contain"/>
    );
}
Posted by: Guest on June-21-2021
2

display image as big as possible react native

<Image style={{ flex: 1, width: "100%", resizeMode: "contain" }} source={{ uri: "https://picsum.photos/200" }}></Image>
Posted by: Guest on July-21-2021

Code answers related to "make image to take size of parrent react native"

Code answers related to "Javascript"

Browse Popular Code Answers by Language