Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
mottox2 committed Nov 7, 2018
1 parent 4623d51 commit 1996e49
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions Libraries/Components/Touchable/Touchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const View = require('View');
const keyMirror = require('fbjs/lib/keyMirror');
const normalizeColor = require('normalizeColor');

import type {PressEvent, SyntheticEvent, LayoutEvent} from 'CoreEventTypes';
import type {SyntheticEvent} from 'CoreEventTypes';
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';

/**
Expand Down Expand Up @@ -470,21 +470,21 @@ const TouchableMixin = {
/**
* Place as callback for a DOM element's `onResponderRelease` event.
*/
touchableHandleResponderRelease: function(e: PressEvent) {
touchableHandleResponderRelease: function(e: Event) {
this._receiveSignal(Signals.RESPONDER_RELEASE, e);
},

/**
* Place as callback for a DOM element's `onResponderTerminate` event.
*/
touchableHandleResponderTerminate: function(e: PressEvent) {
touchableHandleResponderTerminate: function(e: Event) {
this._receiveSignal(Signals.RESPONDER_TERMINATED, e);
},

/**
* Place as callback for a DOM element's `onResponderMove` event.
*/
touchableHandleResponderMove: function(e: PressEvent) {
touchableHandleResponderMove: function(e: Event) {
// Not enough time elapsed yet, wait for highlight -
// this is just a perf optimization.
if (
Expand Down Expand Up @@ -697,12 +697,12 @@ const TouchableMixin = {
);
},

_handleDelay: function(e: LayoutEvent) {
_handleDelay: function(e: Event) {
this.touchableDelayTimeout = null;
this._receiveSignal(Signals.DELAY, e);
},

_handleLongDelay: function(e: LayoutEvent) {
_handleLongDelay: function(e: Event) {
this.longPressDelayTimeout = null;
const curState = this.state.touchable.touchState;
if (
Expand Down Expand Up @@ -730,7 +730,7 @@ const TouchableMixin = {
* @throws Error if invalid state transition or unrecognized signal.
* @sideeffects
*/
_receiveSignal: function(signal: Signal, e: LayoutEvent) {
_receiveSignal: function(signal: Signal, e: Event) {
const responderID = this.state.touchable.responderID;
const curState = this.state.touchable.touchState;
const nextState = Transitions[curState] && Transitions[curState][signal];
Expand Down Expand Up @@ -777,7 +777,7 @@ const TouchableMixin = {
);
},

_savePressInLocation: function(e: LayoutEvent) {
_savePressInLocation: function(e: Event) {
const touch = TouchEventUtils.extractSingleTouch(e.nativeEvent);
const pageX = touch && touch.pageX;
const pageY = touch && touch.pageY;
Expand Down Expand Up @@ -812,7 +812,7 @@ const TouchableMixin = {
curState: State,
nextState: State,
signal: Signal,
e: LayoutEvent,
e: Event,
) {
const curIsHighlight = this._isHighlight(curState);
const newIsHighlight = this._isHighlight(nextState);
Expand Down Expand Up @@ -868,12 +868,12 @@ const TouchableMixin = {
UIManager.playTouchSound();
},

_startHighlight: function(e: LayoutEvent) {
_startHighlight: function(e: Event) {
this._savePressInLocation(e);
this.touchableHandleActivePressIn && this.touchableHandleActivePressIn(e);
},

_endHighlight: function(e: LayoutEvent) {
_endHighlight: function(e: Event) {
if (this.touchableHandleActivePressOut) {
if (
this.touchableGetPressOutDelayMS &&
Expand Down Expand Up @@ -915,12 +915,8 @@ const Touchable = {
for (const key in hitSlop) {
debugHitSlopStyle[key] = -hitSlop[key];
}
const normalizedColor = normalizeColor(color);
const hexColor =
'#' +
(normalizedColor
? '00000000' + normalizedColor.toString(16).substr(-8)
: '');
const normalizedColor: number = normalizeColor(color);
const hexColor = '#' + '00000000' + normalizedColor.toString(16).substr(-8);
const styles = {
position: 'absolute',
borderColor: hexColor.slice(0, -2) + '55', // More opaque
Expand Down

0 comments on commit 1996e49

Please sign in to comment.