freiksenet/react-kinetic

<Text> doesn't work

Closed this issue · 3 comments

doesn't work

The problem is that Kinetic requires width to be passed to text, it seems.

Quick hackish fix (need to update two files):
//in KineticFactory.js replace the createKineticNode function with the code below
createKineticNode: function () {
return kineticClass === "Text" ? new KinetickineticClass : new Kinetic[kineticClass];
},
// in KineticBaseMixin.js add/paste the code below just before line for (propKey in prevProps) {
// this makes sure prevProps ain't empty
if (this.nodeName === 'Text' && !prevProps.hasOwnProperty('text')) {
prevProps['text'] = '';
}

// Now use as follow (minimum props for it to work)
// [ ReactKinetic.Text x={10} y={10} text='voila' fill='black' /]

NB: I was not able to use <, > so i used brackets!

Fixed.