png 图像的透明部分显示白色

Far*_*rwa 6 javascript react-native

我在 Image 标签中有一个 png 图像。部分图像具有透明背景。在我的 android 手机中,它显示为白色。我希望移除白色部分并使其透明。

这是我的代码 -

export default class LoginScreen extends Component {
  render() {
    return (
      <View style={styles.container}>
        <View style = {styles.topContainer}>
        <Image style = {styles.logoContainer}
        source = {require('../images/black_header.png')} />
      </View>
     </View>
    );
  }
}


const styles = StyleSheet.create({
  logoContainer: {
    resizeMode: 'contain',
    backgroundColor: "rgba(0,0,0,0)",
    width: null,
    height: 254,
  },
  container: {
    backgroundColor: "#f7f7f7"
  },
  topContainer: {
    backgroundColor: "rgba(0,0,0,0)"
  }
});
Run Code Online (Sandbox Code Playgroud)

小智 -1

我不知道你是否有和我一样的问题,但我有一些类似的问题并解决了它添加StyleSheet.absoluteFillObjectlogoContainer.