@@ -38,8 +38,7 @@ const _activeOpacityAnimationDuration = 0;
3838const _hideUnderlayTimeout = 100 ;
3939const _underlayInactive = 'transparent' ;
4040
41- function nop ( ) {
42- }
41+ function noop ( ) { /* noop */ }
4342
4443function applyMixin ( thisObj : any , mixin : { [ propertyName : string ] : any } , propertiesToSkip : string [ ] ) {
4544 Object . getOwnPropertyNames ( mixin ) . forEach ( name => {
@@ -54,8 +53,8 @@ function applyMixin(thisObj: any, mixin: {[propertyName: string]: any}, properti
5453}
5554
5655export class Button extends RX . Button < { } > {
57- private _mixin_componentDidMount : ( ) => void ;
58- private _mixin_componentWillUnmount : ( ) => void ;
56+ private _mixin_componentDidMount = RN . Touchable . Mixin . componentDidMount || noop ;
57+ private _mixin_componentWillUnmount = RN . Touchable . Mixin . componentWillUnmount || noop ;
5958
6059 touchableGetInitialState : ( ) => RN . Touchable . State ;
6160 touchableHandleStartShouldSetResponder : ( ) => boolean ;
@@ -74,9 +73,6 @@ export class Button extends RX.Button<{}> {
7473
7574 constructor ( props : Types . ButtonProps ) {
7675 super ( props ) ;
77-
78- this . _mixin_componentDidMount = RN . Touchable . Mixin . componentDidMount || nop ;
79- this . _mixin_componentWillUnmount = RN . Touchable . Mixin . componentWillUnmount || nop ;
8076 applyMixin ( this , RN . Touchable . Mixin , [
8177 // Properties that Button and RN.Touchable.Mixin have in common. Button needs
8278 // to dispatch these methods to RN.Touchable.Mixin manually.
@@ -88,19 +84,19 @@ export class Button extends RX.Button<{}> {
8884 }
8985
9086 render ( ) {
91- // Accessibility props.
92- const importantForAccessibility = AccessibilityUtil . importantForAccessibilityToString ( this . props . importantForAccessibility ,
87+ // Accessibility props.
88+ const importantForAccessibility = AccessibilityUtil . importantForAccessibilityToString ( this . props . importantForAccessibility ,
9389 _defaultImportantForAccessibility ) ;
9490 const accessibilityTrait = AccessibilityUtil . accessibilityTraitToString ( this . props . accessibilityTraits ,
9591 _defaultAccessibilityTrait ) ;
96- const accessibilityComponentType = AccessibilityUtil . accessibilityComponentTypeToString ( this . props . accessibilityTraits ,
92+ const accessibilityComponentType = AccessibilityUtil . accessibilityComponentTypeToString ( this . props . accessibilityTraits ,
9793 _defaultAccessibilityTrait ) ;
9894
9995 const opacityStyle = ! this . props . disableTouchOpacityAnimation && this . _opacityAnimatedStyle ;
10096
10197 return (
10298 < RN . Animated . View
103- ref = { this . _onButtonRef }
99+ ref = { this . _onButtonRef }
104100 style = { Styles . combine ( _styles . defaultButton , [ this . props . style , opacityStyle ] ,
105101 this . props . disabled && _styles . disabled ) }
106102 accessibilityLabel = { this . props . accessibilityLabel || this . props . title }
@@ -123,7 +119,7 @@ export class Button extends RX.Button<{}> {
123119 componentDidMount ( ) {
124120 this . _mixin_componentDidMount ( ) ;
125121 this . _isMounted = true ;
126- }
122+ }
127123
128124 componentWillUnmount ( ) {
129125 this . _mixin_componentWillUnmount ( ) ;
@@ -168,7 +164,7 @@ export class Button extends RX.Button<{}> {
168164 clearTimeout ( this . _hideTimeout ) ;
169165 this . _hideTimeout = setTimeout ( this . _hideUnderlay , _hideUnderlayTimeout ) ;
170166 }
171-
167+
172168 if ( ! this . props . disableTouchOpacityAnimation && ( this . props . activeOpacity || ! this . props . underlayColor ) ) {
173169 this . _opacityInactive ( _inactiveOpacityAnimationDuration ) ;
174170 }
@@ -230,7 +226,7 @@ export class Button extends RX.Button<{}> {
230226 this . setOpacityTo ( this . props . activeOpacity || _defaultActiveOpacity , duration ) ;
231227 }
232228
233- private _opacityInactive ( duration : number ) {
229+ private _opacityInactive ( duration : number ) {
234230 this . setOpacityTo ( this . _defaultOpacityValue , duration ) ;
235231 }
236232
@@ -253,7 +249,7 @@ export class Button extends RX.Button<{}> {
253249 duration : duration ,
254250 easing : Animated . Easing . InOut ( )
255251 }
256- ) . start ( ) ;
252+ ) . start ( ) ;
257253 }
258254
259255 private _hasPressHandler ( ) {
0 commit comments