haya-select 1.0.48 → 1.0.50

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haya-select",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,6 +10,7 @@
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "classnames": "^2.3.1",
13
+ "conjointment": "^0.1.1",
13
14
  "debounce": "^2.1.0",
14
15
  "diggerize": "^1.0.4",
15
16
  "fetching-object": "^1.0.1",
@@ -9,7 +9,7 @@ import OptionGroup from "./option-group"
9
9
  import PropTypes from "prop-types"
10
10
  import propTypesExact from "prop-types-exact"
11
11
  import RenderHtml from "react-native-render-html"
12
- import {Portal} from "react-native-portalize"
12
+ import {Portal} from "conjointment"
13
13
  import {memo, useEffect, useRef} from "react"
14
14
  import {shapeComponent, ShapeComponent} from "set-state-compare/src/shape-component.js"
15
15
  import {Platform, Pressable, Text, TextInput, View} from "react-native"
@@ -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 = this.s.endOfSelectLayout.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 = endOfSelectLayout.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}`)