响应本机图像大小调整裁剪图像

时间:2021-05-26 12:30:17

标签: android ios reactjs image react-native

我刚刚开始使用 React Native。有一个图像我想调整大小,但添加宽度和高度就像图像裁剪一样。 this is how it looks

这是代码,

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',
  },
});

1 个答案:

答案 0 :(得分:1)

有许多可用的图像道具。从官方文档中查看它们。试试 resizeMode 道具。