haya-select 1.0.48 → 1.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/select/index.jsx +13 -5
package/package.json
CHANGED
package/src/select/index.jsx
CHANGED
|
@@ -573,7 +573,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
573
573
|
const {optionsContainerRef} = this.tt
|
|
574
574
|
const {optionsAbsolute} = this.p
|
|
575
575
|
const {selectContainerLayout, loadedOptions, endOfSelectLayout, optionsContainerLayout, optionsPlacement, optionsVisibility} = this.s
|
|
576
|
-
let top
|
|
576
|
+
let left, top
|
|
577
577
|
|
|
578
578
|
const style = this.stylingFor("optionsContainer", {
|
|
579
579
|
position: "absolute",
|
|
@@ -593,22 +593,30 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
|
|
|
593
593
|
} else if (optionsPlacement == "below") {
|
|
594
594
|
if (Platform.OS == "web") {
|
|
595
595
|
// onLayout top value is sometimes negative so use browser JS to get it instead
|
|
596
|
-
top = digg(this.tt.endOfSelectRef.current.getBoundingClientRect(), "top")
|
|
596
|
+
top = digg(this.tt.endOfSelectRef.current.getBoundingClientRect(), "top") + document.documentElement.scrollTop + 2
|
|
597
|
+
|
|
598
|
+
// onLayout left values doesn't always update when changed
|
|
599
|
+
left = digg(this.tt.endOfSelectRef.current.getBoundingClientRect(), "left") + document.documentElement.scrollLeft + 2
|
|
597
600
|
} else {
|
|
601
|
+
left = this.s.endOfSelectLayout.left
|
|
598
602
|
top = selectContainerLayout.top
|
|
599
603
|
}
|
|
600
604
|
|
|
601
|
-
style.left =
|
|
605
|
+
style.left = left
|
|
602
606
|
style.top = top - 2
|
|
603
607
|
} else if (optionsPlacement == "above") {
|
|
604
608
|
if (Platform.OS == "web") {
|
|
605
609
|
// onLayout top value is sometimes negative so use browser JS to get it instead
|
|
606
|
-
top = digg(this.tt.selectContainerRef.current.getBoundingClientRect(), "top")
|
|
610
|
+
top = digg(this.tt.selectContainerRef.current.getBoundingClientRect(), "top") + document.documentElement.scrollTop - 1
|
|
611
|
+
|
|
612
|
+
// onLayout left values doesn't always update when changed
|
|
613
|
+
left = digg(this.tt.selectContainerRef.current.getBoundingClientRect(), "left") + document.documentElement.scrollLeft - 1
|
|
607
614
|
} else {
|
|
615
|
+
left = endOfSelectLayout.left
|
|
608
616
|
top = selectContainerLayout.top
|
|
609
617
|
}
|
|
610
618
|
|
|
611
|
-
style.left =
|
|
619
|
+
style.left = left
|
|
612
620
|
style.top = top - optionsContainerLayout.height + 1
|
|
613
621
|
} else {
|
|
614
622
|
throw new Error(`Unkonwn options placement: ${optionsPlacement}`)
|