Skip to content

Commit

Permalink
fix(@uform/next/antd): fix FormButtonGroup will throw error when root…
Browse files Browse the repository at this point in the history
… component rerendering
  • Loading branch information
janryWang committed Mar 5, 2019
1 parent 137d56b commit ccd9334
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 46 deletions.
48 changes: 25 additions & 23 deletions packages/antd/src/components/formButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,31 @@ export const FormButtonGroup = styled(

if (sticky) {
return (
<FormConsumer>
{({ inline, FormRef } = {}) => {
if (!FormRef) return
return (
<Sticky
edge='bottom'
triggerDistance={this.props.triggerDistance}
offsetDistance={this.props.offsetDistance}
zIndex={this.props.zIndex}
getStickyBoundary={this.getStickyBoundaryHandler(FormRef)}
style={{
borderTop: '1px solid #eee',
background: (style && style.background) || '#fff',
padding: (style && style.padding) || '20px 0'
}}
>
<div className={className} style={style}>
{content}
</div>
</Sticky>
)
}}
</FormConsumer>
<div>
<FormConsumer>
{({ inline, FormRef } = {}) => {
if (!FormRef) return
return (
<Sticky
edge='bottom'
triggerDistance={this.props.triggerDistance}
offsetDistance={this.props.offsetDistance}
zIndex={this.props.zIndex}
getStickyBoundary={this.getStickyBoundaryHandler(FormRef)}
style={{
borderTop: '1px solid #eee',
background: (style && style.background) || '#fff',
padding: (style && style.padding) || '20px 0'
}}
>
<div className={className} style={style}>
{content}
</div>
</Sticky>
)
}}
</FormConsumer>
</div>
)
}

Expand Down
48 changes: 25 additions & 23 deletions packages/next/src/components/formButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,31 @@ export const FormButtonGroup = styled(

if (sticky) {
return (
<FormConsumer>
{({ inline, FormRef } = {}) => {
if (!FormRef) return
return (
<Sticky
edge='bottom'
triggerDistance={this.props.triggerDistance}
offsetDistance={this.props.offsetDistance}
zIndex={this.props.zIndex}
getStickyBoundary={this.getStickyBoundaryHandler(FormRef)}
style={{
borderTop: '1px solid #eee',
background: (style && style.background) || '#fff',
padding: (style && style.padding) || '20px 0'
}}
>
<div className={className} style={style}>
{content}
</div>
</Sticky>
)
}}
</FormConsumer>
<div>
<FormConsumer>
{({ inline, FormRef } = {}) => {
if (!FormRef) return
return (
<Sticky
edge='bottom'
triggerDistance={this.props.triggerDistance}
offsetDistance={this.props.offsetDistance}
zIndex={this.props.zIndex}
getStickyBoundary={this.getStickyBoundaryHandler(FormRef)}
style={{
borderTop: '1px solid #eee',
background: (style && style.background) || '#fff',
padding: (style && style.padding) || '20px 0'
}}
>
<div className={className} style={style}>
{content}
</div>
</Sticky>
)
}}
</FormConsumer>
</div>
)
}

Expand Down

0 comments on commit ccd9334

Please sign in to comment.