Reputation: 683
When I press on an <TouchableHighlight />
, with an <Image/>
component inside, a white square appears even though I have set underlayColor
prop's opacity value to 0.
What is causing this and how can I fix it?
<TouchableHighlight underlayColor="rgba(255,255,255,0)" onPress={() => this.props.navigation.goBack()} style={{width: 50, height: 50, position: "absolute", top:15, left: 15, elevation: 10, zIndex: 10}}>
<Image
style={{ width: 50, height: 50,}}
source={backArrow}
/>
</TouchableHighlight>
Upvotes: 0
Views: 365
Reputation: 30360
Perhaps you could take a different approach, by using TouchableOpacity
with activeOpacity
set to 0
like so:
<TouchableOpacity activeOpacity={0} onPress={() => this.props.navigation.goBack()} style={{ width: 50, height: 50, position: "absolute", top:15, left: 15, elevation: 10, zIndex: 10}}>
<Image style={{ width: 50, height: 50 }} source={backArrow} />
</TouchableOpacity>
If I understand your requirements correctly, then you should find this use of the activeOpacity
prop achieves what you want. For more information on activeOpacity
, see this documentation
Upvotes: 1