add touchable support for shape elements

This commit is contained in:
Horcrux
2016-06-09 23:30:10 +08:00
parent 16b4f741f5
commit 7307715712
12 changed files with 123 additions and 67 deletions
+12 -5
View File
@@ -1,19 +1,26 @@
import {responderProps} from '../props';
import {responderProps, touchableProps} from '../props';
import _ from 'lodash';
export default function (props) {
let responsible;
let touchable;
return _.reduce(props, (prev, value, key) => {
if (value && responderProps[key]) {
if (value && (responderProps[key] || touchableProps[key])) {
prev[key] = value;
if (!touchable) {
if (!responsible) {
responsible = true;
prev.responsible = true;
}
if (!touchable && touchableProps[key]) {
touchable = true;
prev.touchable = true;
}
}
return prev;
}, {});
}, {
responsible: false,
touchable: false
});
}