Skip to content

Unwanted cropping in iOS only when combining web and local images #86

@samuelvisscher

Description

@samuelvisscher

We are using react-native-nitro-image to show both local and web images:

const localImage = require("assets/some-local-image.png")
const webImage = { url: "https://example.com/image.png" }

When within one of our tabs, we move to one page with a localImage, and after that to another page with a webImage at the top, we correctly get to see our web image, but it will be cropped according to the dimensions of the localImage.

For example, we have this Image component:

import { StyleProp, View, ViewStyle } from "react-native";
import { NitroImage, NitroImageProps } from "react-native-nitro-image";

export type ImageProps = {
  containerStyle?: StyleProp<ViewStyle>;
} & NitroImageProps;

export const Image = ({ containerStyle, ...props }: ImageProps) => {
  return (
    <View style={[{ backgroundColor: "yellow" }, containerStyle]}>
      <NitroImage {...props} />
    </View>
  );
};

And whenever we've visited the page with the local image, suddenly our image is cropped, and while before no yellow was visible, we now see that our page has been cropped to fit the local image on the previous screen, revealing the yellow background.

Image

The same thing doesn't happen on Android, or with alternative image libraries.

Relevant dependencies:

"react-native": "0.82.1",
"react-native-nitro-image": "^0.9.0",
"react-native-nitro-modules": "^0.31.10",
"react-native-nitro-web-image": "^0.9.0",

Any idea what this may be? If you're available to look at it, I could try to make you an example app. I can reproduce the issue in our app with 100% accuracy.

Note that not all images appear to be affected, and that assigning keys did not help.

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