Render text box with transparent background on top of image in React Native iOS

后端 未结 4 437
天涯浪人
天涯浪人 2021-01-30 16:54

I\'m trying to render a block with white text on top of an image in my testing of React Native. But instead i get a black block on top of my image with white text in it. Not wha

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 17:53

    Internally, I see that React Native does translate alpha values and the special case of transparent into the correct UIColor with alpha values, so that aspect of this is working and it's easy to validate this experimentally.

    Notice that if you set the backgroundColor of your container to transparent (or rgba(0,0,0,0)), you also get a transparent text block - that knowledge should help you work around this problem. However I think it's possible to interpret this as a bug since that's not the behaviour one would expect, it feels like some kind of stacking problem.

提交回复
热议问题