Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions src/components/SelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const SelectionList = (props: ListProperties): React.JSX.Element => {
<Modal
visible={props.display}
transparent={true}
statusBarTranslucent={true}
onRequestClose={() => {
setPosReady(false);
props.hide();
Expand All @@ -65,7 +66,6 @@ const SelectionList = (props: ListProperties): React.JSX.Element => {
'landscape-left',
'landscape-right',
]}
animationType={windowWidth > windowHeight ? 'slide' : 'none'}
>
<TouchableOpacity
activeOpacity={1}
Expand Down Expand Up @@ -100,17 +100,28 @@ const SelectionList = (props: ListProperties): React.JSX.Element => {
top: keyboardHeight > 0 && listBottom > windowHeight - keyboardHeight
? windowHeight - keyboardHeight - currentListHeight - 5
: isAbove
? props.selectorRect.y - currentListHeight
: props.selectorRect.y + props.selectorRect.height,
? props.selectorRect.y - currentListHeight + 50
: props.selectorRect.y + props.selectorRect.height + 45,
opacity: posReady ? 1 : 0,
}
: {//phone is held horizontal
height: windowHeight - sidewaysTopMargin,
marginTop: sidewaysTopMargin,
marginHorizontal: sidewaysHorizontalMargin,
borderRadius: sidewaysBorderRadius,
borderBottomLeftRadius: sidewaysBorderRadiusBL,
borderBottomRightRadius: sidewaysBorderRadiusBR,
: {
left: props.styles.list?.alignSelf === 'center'
? 0
: props.styles.list?.width
? props.selectorRect.x
+ (typeof props.selectorRect.width === 'string'
? Number(props.selectorRect.width.slice(0, -1)) * windowWidth
: props.selectorRect.width
- currentListWidth) / 2
: props.selectorRect.x,
width: props.styles.list?.width ?? props.selectorRect.width,
maxHeight: props.listHeight,
top: keyboardHeight > 0 && listBottom > windowHeight - keyboardHeight
? windowHeight - keyboardHeight - currentListHeight - 5
: isAbove
? props.selectorRect.y - currentListHeight + 50
: props.selectorRect.y + props.selectorRect.height + 50,
opacity: posReady ? 1 : 0,
},
]}
>
Expand Down Expand Up @@ -177,15 +188,18 @@ const SelectionList = (props: ListProperties): React.JSX.Element => {
windowHeight > windowWidth
? {//phone upright
top: listBottom < windowHeight
? props.selectorRect.y - uprightTopMargin
: props.selectorRect.y + props.selectorRect.height,
left: props.selectorRect.x - uprightTopMargin,
? props.selectorRect.y + 10
: props.selectorRect.y + props.selectorRect.height + Number(style.clearButton.height) + 10,
left: props.selectorRect.x - Number(style.clearButton.height),
marginLeft: props.selectorRect.width,
opacity: keyboardHeight === 0 && posReady ? 1 : 0,
}
: {//phone sideways
top: sidewaysTopMargin,
right: sidewaysBorderRadius,
: {
top: listBottom < windowHeight
? props.selectorRect.y + 10
: props.selectorRect.y + props.selectorRect.height + Number(style.clearButton.height) + 10,
left: props.selectorRect.x + Number(props.selectorRect.width) - Number(style.clearButton.height),
opacity: keyboardHeight === 0 && posReady ? 1 : 0,
}

]}
Expand Down