Skip to content

ResizeMode is broken #2498

Open
Open
@ospfranco

Description

@ospfranco

Environment

react-native -v: 0.78.2
npm ls react-native-macos: 0.78.3
node -v: 20.19
npm -v: -
yarn --version: -
xcodebuild -version: 16.2

Steps to reproduce the bug

import React from 'react';
import type {PropsWithChildren} from 'react';
import {useColorScheme, View, Image} from 'react-native';

import {Colors} from 'react-native/Libraries/NewAppScreen';
import testImage from './test.jpg';

type SectionProps = PropsWithChildren<{
  title: string;
}>;

function App(): React.JSX.Element {
  const isDarkMode = useColorScheme() === 'dark';

  const backgroundStyle = {
    backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
  };

  return (
    <View style={backgroundStyle}>
      <Image
        source={testImage}
        style={{width: 200, height: 300}}
        resizeMode="contain"
      />
    </View>
  );
}

export default App;

resizeMode is not correctly resizing the image. I tested an image that is taller than wider and it still looks distorted

Image

Expected Behavior

ResizeMode to work

Actual Behavior

Reproducible Demo

Provided a small sample code above

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions