如何在子视图中消除父视图的背景色效果?反应原生

  • 本文关键字:视图 背景色 原生 react-native
  • 更新时间 :
  • 英文 :


如何消除父对象在子对象中的背景色效果。下面我有评论。

下面我有附件图像1

https://drive.google.com/file/d/1B7LcuZLOPxbW2ovYd6yuIF7xjeZKYycI/view?usp=sharing

<RNCamera
ref={cameraRef}
style={{ flex: 1, }}
type={RNCamera.Constants.Type[cameraType]}
autoFocus={'on'}
barCodeTypes={[RNCamera.Constants.BarCodeType.qr]}
captureAudio={false}
zoom={cameraZoom}
flashMode={RNCamera.Constants.FlashMode[flashMode]}
onBarCodeRead={onBarCodeRead}
>
{() => {
return (
<View style={styles.container}> //here I specify the color 


//doesn't want the background color effect which I have specify in parent view "rgba(0,0,0,0.5)" here, I want bright and clean the LottieView.
<LottieView style={{  
height: hp('40%')
}}
source={require('../Asserts/Animations/scanner2.json')}
autoPlay
loop
/>
</RNCamera>

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor:'rgba(0,0,0,0.5)'  //specify color here
}
});

您是否尝试为子组件提供背景。如果你想让它透明,你可以试试backgroundColor: 'transparent'backgroundColor: 'rgba(52, 52, 52, alpha)'.

最新更新