Skip to content

Commit aab1a20

Browse files
fix sticky issue
1 parent 07860a8 commit aab1a20

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/components/Sticky.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,26 @@ export default class Sticky extends React.Component {
77
super(props)
88
this.mountSticky = (sticky) => { this.sticky = sticky }
99
this.handleScroll = this.handleScroll.bind(this)
10+
this.updateSticky = this.updateSticky.bind(this)
1011
}
1112

1213
componentDidMount() {
1314
window.addEventListener('scroll', this.handleScroll)
15+
document.addEventListener('refreshsticky', this.updateSticky)
1416
}
1517

1618
componentWillUnmount() {
1719
window.removeEventListener('scroll', this.handleScroll)
20+
document.removeEventListener('refreshsticky', this.updateSticky)
21+
}
22+
23+
updateSticky() {
24+
setTimeout(() => {
25+
if (this.sticky) {
26+
this.sticky.updateInitialDimension()
27+
this.sticky.update()
28+
}
29+
})
1830
}
1931

2032
handleScroll() {

src/components/TeamManagement/TeamManagement.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,21 @@ class TeamManagement extends React.Component {
5252
}
5353

5454
topcoderTeamInviteButtonClick() {
55+
this.refreshStickyComp()
5556
this.setState({topcoderTeamInviteButtonExpanded: !this.state.topcoderTeamInviteButtonExpanded})
5657
}
5758

5859
projectTeamInviteButtonClick() {
60+
this.refreshStickyComp()
5961
this.setState({projectTeamInviteButtonExpanded: !this.state.projectTeamInviteButtonExpanded})
6062
}
63+
64+
refreshStickyComp() {
65+
const event = document.createEvent('Event')
66+
event.initEvent('refreshsticky', true, true)
67+
document.dispatchEvent(event)
68+
}
69+
6170
componentWillReceiveProps(nextProps) {
6271
if (this.props.processingMembers !== nextProps.processingMembers && (!nextProps.processingMembers)) {
6372
this.props.onJoin(false)

src/projects/detail/containers/DashboardContainer.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class DashboardContainer extends React.Component {
212212
<MediaQuery minWidth={SCREEN_BREAKPOINT_MD}>
213213
{(matches) => {
214214
if (matches) {
215-
return <Sticky top={60}>{leftArea}</Sticky>
215+
return <Sticky top={60} bottomBoundary="#wrapper-main">{leftArea}</Sticky>
216216
} else {
217217
return leftArea
218218
}

0 commit comments

Comments
 (0)