Files
react-native-svg/elements/Shape.js
2019-01-29 04:51:56 +02:00

29 lines
753 B
JavaScript

import { Component } from 'react';
import SvgTouchableMixin from '../lib/SvgTouchableMixin';
const touchKeys = Object.keys(SvgTouchableMixin);
const touchVals = touchKeys.map(key => SvgTouchableMixin[key]);
const numTouchKeys = touchKeys.length;
export default class Shape extends Component {
constructor() {
super(...arguments);
for (let i = 0; i < numTouchKeys; i++) {
const key = touchKeys[i];
const val = touchVals[i];
if (typeof val === 'function') {
this[key] = val.bind(this);
} else {
this[key] = val;
}
}
this.state = this.touchableGetInitialState();
}
refMethod = ref => {
this.root = ref;
};
setNativeProps = props => {
this.root.setNativeProps(props);
};
}