Anjula Samarasinghe
Anjula Samarasinghe

Reputation: 237

React native image resizing crops the image

I'm just getting started with react native. There's an image I want to resize but adding width and height acts like image cropping. this is how it looks

Here's the code,

const App = () => {
  return (
    <SafeAreaView>
      <View>
        <Text>Hello world!</Text>
        <Image
          source={require('./assets/logos/logo.png')}
          style={styles.logo}
        />
      </View>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  sectionContainer: {
    marginTop: 32,
    paddingHorizontal: 24,
  },
  logo: {
    height: 50,
  },
  highlight: {
    fontWeight: '700',
  },
});

Upvotes: 0

Views: 1062

Answers (1)

ZealousWeb
ZealousWeb

Reputation: 1751

There are many image props available. Have a look at them from official documentation. Try the resizeMode prop.

Upvotes: 1

Related Questions