Skip to content

Commit 9b70703

Browse files
committed
fix background issue with incubator TouchableOpacity
1 parent a03a689 commit 9b70703

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/incubator/TouchableOpacity.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class TouchableOpacity extends Component {
5151
isAnimating = new Value(0);
5252
clock = new Clock();
5353
_scale = new Value(1);
54-
_color = new Value(1);
54+
// _color = new Value(1);
5555

5656
_opacity = block([cond(eq(this.pressState, State.BEGAN), this.props.activeOpacity, 1)]);
5757

@@ -69,6 +69,20 @@ class TouchableOpacity extends Component {
6969
return backgroundColorProp || backgroundColor;
7070
}
7171

72+
get animatedStyle() {
73+
const {feedbackColor} = this.props;
74+
const style = {
75+
opacity: this._opacity,
76+
transform: [{scale: this._scale}]
77+
};
78+
79+
if (feedbackColor) {
80+
style.backgroundColor = this._color;
81+
}
82+
83+
return style;
84+
}
85+
7286
onStateChange = event([
7387
{
7488
nativeEvent: {state: this.pressState}
@@ -91,7 +105,8 @@ class TouchableOpacity extends Component {
91105
margins,
92106
alignments,
93107
style,
94-
{backgroundColor: this._color, opacity: this._opacity, transform: [{scale: this._scale}]}
108+
this.animatedStyle
109+
// {backgroundColor: this._color, opacity: this._opacity, transform: [{scale: this._scale}]}
95110
]}
96111
>
97112
{this.props.children}

0 commit comments

Comments
 (0)