@@ -44,6 +44,7 @@ interface IProps {
4444 placeholder ?: string ;
4545 ImageComponent ?: any ;
4646 TextComponent ?: any ;
47+ disableAbsolute : boolean ;
4748 arrowImageStyle ?: ImageStyle ;
4849 menuItemTextStyle ?: TextStyle ;
4950 menuBarContainerHeight ?: number ;
@@ -53,16 +54,6 @@ interface IProps {
5354 onSelect : ( selectedItem : ISingleSelectDataType ) => void ;
5455}
5556
56- interface IState {
57- query : string ;
58- dataBackup ?: Array < ISingleSelectDataType > ;
59- dataSource ?: Array < ISingleSelectDataType > ;
60- menuToggled : boolean ;
61- borderRadius : Animated . Value ;
62- menuBarYTranslate : Animated . Value ;
63- selectedItem ?: ISingleSelectDataType | null ;
64- }
65-
6657let iconRef : any = undefined ;
6758const RNSingleSelect = ( props : IProps ) => {
6859 const [ query , setQuery ] = React . useState ( "" ) ;
@@ -86,7 +77,11 @@ const RNSingleSelect = (props: IProps) => {
8677 ] = React . useState < Animated . Value > ( new Animated . Value ( 0 ) ) ;
8778 const [ theme , setTheme ] = React . useState ( DARK ) ;
8879
89- const { ImageComponent = Image , TextComponent = Text } = props ;
80+ const {
81+ disableAbsolute = false ,
82+ ImageComponent = Image ,
83+ TextComponent = Text ,
84+ } = props ;
9085
9186 React . useEffect ( ( ) => {
9287 if ( props . darkMode ) setTheme ( DARK ) ;
@@ -193,10 +188,9 @@ const RNSingleSelect = (props: IProps) => {
193188 < TextComponent > { selectedItem ?. value } </ TextComponent >
194189 </ TextInput >
195190 < Icon
196- ref = { ( ref : Icon ) => ( iconRef = ref ) }
197191 theme = { theme }
192+ ref = { ( ref : Icon ) => ( iconRef = ref ) }
198193 style = { [ styles . arrowImageStyle , props . arrowImageStyle ] }
199- { ...props }
200194 />
201195 </ View >
202196 </ Animated . View >
@@ -221,7 +215,6 @@ const RNSingleSelect = (props: IProps) => {
221215 resizeMode = "contain"
222216 source = { imageSource }
223217 style = { _imageStyle ( imageHeight , imageWidth ) }
224- { ...props }
225218 />
226219 ) }
227220 < TextComponent style = { [ _menuItemTextStyle ( theme ) , menuItemTextStyle ] } >
@@ -243,7 +236,7 @@ const RNSingleSelect = (props: IProps) => {
243236 _menuBarContainer ( theme , props . menuBarContainerHeight || 150 ) ,
244237 {
245238 transform : [ { scaleY : rotate } ] ,
246- display : menuToggled ? "flex" : "none" ,
239+ display : disableAbsolute ? "flex" : menuToggled ? "flex" : "none" ,
247240 } ,
248241 props . menuBarContainerStyle ,
249242 ] }
0 commit comments