gianu / react-fittext

React Plugin to fit text on the screen
http://softwarepsychonaut.com/react-fittext
MIT License
218 stars 51 forks source link

Fails with react 0.14.0-rc1 #10

Closed floriancargoet closed 9 years ago

floriancargoet commented 9 years ago

ReactFittext doesn't work with the latest react version (0.14.0-rc1). Here's the code and error messages:

package.json:

  "dependencies": {
    "react": "^0.14.0-rc1",
    "react-dom": "^0.14.0-rc1",
    "react-fittext": "0.0.5"
  }

main.jsx:

import React from 'react';
import ReactDOM from 'react-dom';
import ReactFitText from 'react-fittext';

const el = document.getElementById('root');

ReactDOM.render(
  <ReactFitText>
    <h1>hello</h1>
  </ReactFitText>,
  el
);

Console messages:

Warning: Failed propType: Invalid prop `children` supplied to `ReactFitText`, expected a ReactElement.
Warning: ReactFitText(...): React component classes must extend React.Component.
Uncaught TypeError: Cannot read property 'firstChild' of undefined
gianu commented 9 years ago

@floriancargoet I just published a new version of react-fittext (version 0.1.1) with support to react 0.14-rc1.

The new example is here: http://softwarepsychonaut.com/react-fittext/

Also, if you fork the project you can run

npm install
gulp dev

and see the same demo working on localhost:8080

Please let me know if this fix works for you.

floriancargoet commented 9 years ago

It works! Thanks.

spaceghostu commented 7 years ago

I am getting this error with react@15.4.1 and react-textfit@0.1.8