Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion src/lib/ReflexContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ export default class ReflexContainer extends React.Component {
this.computeAvailableOffset(
splitterIdx, dir * offset)

this.state.isSetPropSize = data.isSetPropSize
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't a proper react way to alter the state. if isSetPropSize isn't used for rendering, then just a separate variable could be used instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I corrected the thing that you pointed out.
Thanks.


this.elements = null

if (availableOffset) {
Expand All @@ -390,6 +392,7 @@ export default class ReflexContainer extends React.Component {
// TODO handle exception ...
console.log(ex)
}
delete this.state.isSetPropSize
})
}

Expand Down Expand Up @@ -595,7 +598,7 @@ export default class ReflexContainer extends React.Component {

const newSize = Math.max(size + offset, 0)

const currentFlex = this.state.flexData[idx].flex
const currentFlex = this.state.isSetPropSize ? 0 : this.state.flexData[idx].flex

const newFlex = (currentFlex > 0)
? currentFlex * newSize / size
Expand Down
5 changes: 3 additions & 2 deletions src/lib/ReflexElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ class ReflexElement extends React.Component {
await this.props.events.emit('element.size', {
index: this.props.index,
size: this.props.size,
direction
direction,
isSetPropSize: true
})
}
}
Expand Down Expand Up @@ -200,4 +201,4 @@ export default React.forwardRef((props, ref) => {
return (
<ReflexElement innerRef={ref} {...props}/>
)
})
})