run hitTest only if necessary

This commit is contained in:
Horcrux
2016-05-18 20:15:29 +08:00
parent bf5d6c8a8b
commit f34c0c209a
10 changed files with 51 additions and 7 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ export default function(props, options = {stroke: true, transform: true, fill: t
}
if (options.transform) {
extractedProps.transform = extractTransform(props);
extractedProps.trans = extractTransform(props);
}
if (options.responder) {
+15 -2
View File
@@ -1,6 +1,19 @@
import {responderPropsKeys} from '../props';
import {responderProps} from '../props';
import _ from 'lodash';
export default function (props) {
return _.pick(props, responderPropsKeys);
let touchable;
return _.reduce(props, (prev, value, key) => {
if (value && responderProps[key]) {
prev[key] = value;
if (!touchable) {
touchable = true;
prev.touchable = true;
}
}
return prev;
}, {});
}