Skip to content

Commit 48cd085

Browse files
pass whole popperConfig to PopperJS (#748) (#750)
* pass whole popperConfig to PopperJS (#748) * pass whole popperConfig to PopperJS (#748) * use options.popperConfig to initiate PopperJS * pass whole popperConfig to PopperJS (#748) * fixed pass popperConfig option * Revert "pass whole popperConfig to PopperJS (#748)" This reverts commit 453ff44 * use popperOptions in usePopper (#748) Co-authored-by: Jimmy Jia <[email protected]>
1 parent 26c1f4f commit 48cd085

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/DropdownMenu.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export function useDropdownMenu(options = {}) {
4242
const modifiers = toModifierMap(popperConfig.modifiers);
4343

4444
const popper = usePopper(toggleElement, menuElement, {
45+
...popperConfig,
4546
placement,
4647
enabled: !!(shouldUsePopper && show),
4748
modifiers: {

src/usePopper.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ export function toModifierArray(map) {
6464
* @param {String} options.placement The popper element placement relative to the reference element
6565
* @param {Boolean} options.positionFixed use fixed positioning
6666
* @param {Boolean} options.eventsEnabled have Popper listen on window resize events to reposition the element
67+
* @param {Function} options.onCreate called when the popper is created
68+
* @param {Function} options.onUpdate called when the popper is updated
6769
*/
6870
export default function usePopper(
6971
referenceElement,
@@ -74,6 +76,7 @@ export default function usePopper(
7476
strategy = 'absolute',
7577
eventsEnabled = true,
7678
modifiers: userModifiers,
79+
...popperOptions
7780
} = {},
7881
) {
7982
const popperInstanceRef = useRef();
@@ -152,6 +155,7 @@ export default function usePopper(
152155
}
153156

154157
popperInstanceRef.current = createPopper(referenceElement, popperElement, {
158+
...popperOptions,
155159
placement,
156160
strategy,
157161
modifiers: [...modifiers, updateModifier],

0 commit comments

Comments
 (0)