Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Modal, Dropdown{*}, PopperContent, Tabs): go to React Async …
…Rendering (#1427) The main purpose of the changes is to move forward to React Async Rendering. The changes include: 1. remove unsafe componentWillReceiveProps and componentWillUpdate in Modal. 2. get rid of findDOMNode in Dropdown. 3. replace legacy context with new Context API in DropdownItem, DropdownToggle, Dropdown, TabContent. 4. upgrade react-popper to '1.3.3', and make the corresponding changes in PopperContent, DropdownItem, DropdownToggle, DropdownMenu, Dropdown. BREAKING CHANGE: using new Context API, react-popper v. '1.3.3'
- Loading branch information
1 parent
4a5a8a3
commit 1afb2c2
Showing
19 changed files
with
345 additions
and
1,964 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
import React from 'react'; | ||
|
||
export function Manager({ tag: Tag = 'div', ...props }) { | ||
return <Tag {...props} />; | ||
export function Manager({ children }) { | ||
return (children); | ||
} | ||
|
||
export function Popper({ component: Tag = 'div', ...props }) { | ||
return <Tag {...props} />; | ||
export function Popper({ children, placement }) { | ||
return children({ ref: () => {}, placement, style: {}, arrowProps: { ref: () => {}, style: {} } }); | ||
} | ||
|
||
export function Arrow({ component: Tag = 'div', ...props }) { | ||
return <Tag {...props} />; | ||
} | ||
|
||
export function Target({ component: Tag = 'div', ...props }) { | ||
return <Tag {...props} />; | ||
export function Reference({ children }) { | ||
return children({ ref: () => {} }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
|
||
/** | ||
* DropdownContext | ||
* { | ||
* toggle: PropTypes.func.isRequired, | ||
* isOpen: PropTypes.bool.isRequired, | ||
* direction: PropTypes.oneOf(['up', 'down', 'left', 'right']).isRequired, | ||
* inNavbar: PropTypes.bool.isRequired, | ||
* } | ||
*/ | ||
export const DropdownContext = React.createContext({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Breaks positionFixed prop on DropdownMenu - it's no longer being passed to Popper.