@@ -176,6 +176,10 @@ const TouchableHighlight = createReactClass({
176176 * @platform ios
177177 */
178178 tvParallaxProperties : PropTypes . object ,
179+ /**
180+ * Handy for snapshot tests.
181+ */
182+ testOnly_pressed : PropTypes . bool ,
179183 } ,
180184
181185 mixins : [ NativeMethodsMixin , Touchable . Mixin ] ,
@@ -184,11 +188,23 @@ const TouchableHighlight = createReactClass({
184188
185189 getInitialState : function ( ) {
186190 this . _isMounted = false ;
187- return {
188- ...this . touchableGetInitialState ( ) ,
189- extraChildStyle : null ,
190- extraUnderlayStyle : null ,
191- } ;
191+ if ( this . props . testOnly_pressed ) {
192+ return {
193+ ...this . touchableGetInitialState ( ) ,
194+ extraChildStyle : {
195+ opacity : this . props . activeOpacity ,
196+ } ,
197+ extraUnderlayStyle : {
198+ backgroundColor : this . props . underlayColor ,
199+ } ,
200+ } ;
201+ } else {
202+ return {
203+ ...this . touchableGetInitialState ( ) ,
204+ extraChildStyle : null ,
205+ extraUnderlayStyle : null ,
206+ } ;
207+ }
192208 } ,
193209
194210 componentDidMount : function ( ) {
@@ -280,6 +296,9 @@ const TouchableHighlight = createReactClass({
280296 _hideUnderlay : function ( ) {
281297 clearTimeout ( this . _hideTimeout ) ;
282298 this . _hideTimeout = null ;
299+ if ( this . props . testOnly_pressed ) {
300+ return ;
301+ }
283302 if ( this . _hasPressHandler ( ) ) {
284303 this . setState ( {
285304 extraChildStyle : null ,
0 commit comments