Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support specific update/resize #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/Textfit.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,21 @@ export default class TextFit extends React.Component {
this.pid = uniqueId();
}

handleWindowResize = () => {
this.process();
handleWindowResize = (fitIndexesArray = undefined) => {
this.process(fitIndexesArray);
}

process() {
process(fitIndexesArray = undefined) {

// if have specific Textfit to resize, and this one is not one of them..
const fitElements =
fitIndexesArray &&
fitIndexesArray.detail &&
fitIndexesArray.detail.fitElements;
if (fitElements && !fitElements.includes(this._parent)) {
return;
}

const { min, max, mode, forceSingleModeWidth, onReady } = this.props;
const el = this._parent;
const wrapper = this._child;
Expand Down