Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
fix: change initial position style based on positionFixed prop (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkuzmic authored Feb 25, 2020
1 parent f0b9040 commit 4ddde9d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Popper.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type PopperState = {
};

const initialStyle = {
position: 'absolute',
top: 0,
left: 0,
opacity: 0,
Expand Down Expand Up @@ -113,14 +112,18 @@ export class InnerPopper extends React.Component<PopperProps, PopperState> {
},
});

getPopperStyle = () =>
!this.popperNode || !this.state.data
? initialStyle
getPopperStyle = () => {
const computedInitialStyle = {
...initialStyle,
position: this.props.positionFixed ? 'fixed' : 'absolute',
}
return !this.popperNode || !this.state.data
? computedInitialStyle
: {
position: this.state.data.offsets.popper.position,
...this.state.data.styles,
};

}
getPopperPlacement = () =>
!this.state.data ? undefined : this.state.placement;

Expand Down

0 comments on commit 4ddde9d

Please sign in to comment.