Skip to content

Commit

Permalink
Merge pull request #1604 from ever-co/bug/selecting-active-task-when-…
Browse files Browse the repository at this point in the history
…scrolling

when user is scrolling no longer active task is set
  • Loading branch information
evereq authored Oct 20, 2023
2 parents cc45b01 + 38b1117 commit 339e2ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/mobile/app/components/HamburgerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const HamburgerMenu = observer((props: any) => {
marginTop: 4,
}}
>
{user?.email}s
{user?.email}
</Text>
{activeTeam ? (
<DropDown
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable camelcase */
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable react-native/no-color-literals */
import React, { FC } from "react"
import React, { FC, useState } from "react"
import { Text } from "react-native-paper"
import { View, StyleSheet, TouchableWithoutFeedback, Pressable, FlatList } from "react-native"
import { Ionicons } from "@expo/vector-icons"
Expand All @@ -20,6 +20,7 @@ export interface Props {

const ComboBox: FC<Props> = observer(function ComboBox({ tasksHandler, closeCombo, setEditMode }) {
const { colors } = useAppTheme()
const [isScrolling, setIsScrolling] = useState<boolean>(false)

return (
<TouchableWithoutFeedback>
Expand Down Expand Up @@ -54,13 +55,16 @@ const ComboBox: FC<Props> = observer(function ComboBox({ tasksHandler, closeComb
</View>
<View style={{ maxHeight: 315 }}>
<FlatList
onScrollBeginDrag={() => setIsScrolling(true)}
onScrollEndDrag={() => setIsScrolling(false)}
showsVerticalScrollIndicator={false}
data={tasksHandler.filteredTasks}
renderItem={({ item, index }) => (
<IndividualTask
key={index}
onReopenTask={() => tasksHandler.handleReopenTask(item)}
task={item}
isScrolling={isScrolling}
handleActiveTask={tasksHandler.setActiveTeamTask}
closeCombo={closeCombo}
setEditMode={setEditMode}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ export interface Props {
closeCombo?: () => unknown
onReopenTask: () => unknown
setEditMode: (val: boolean) => void
isScrolling: boolean
}

const IndividualTask: FC<Props> = observer(
({ task, handleActiveTask, closeCombo, onReopenTask, setEditMode }) => {
({ task, handleActiveTask, closeCombo, onReopenTask, setEditMode, isScrolling }) => {
const { colors } = useAppTheme()
const [showDel, setShowDel] = useState(false)
const { updateTask } = useTeamTasks()
Expand Down Expand Up @@ -54,7 +55,7 @@ const IndividualTask: FC<Props> = observer(
>
<View
onTouchEnd={() => {
handleActiveTask(task)
!isScrolling && handleActiveTask(task)
}} // added it here because doesn't work when assigned to the parent
style={{
flexDirection: "row",
Expand All @@ -76,7 +77,7 @@ const IndividualTask: FC<Props> = observer(
</View>
<View
onTouchEnd={() => {
handleActiveTask(task)
!isScrolling && handleActiveTask(task)
}} // added it here because doesn't work when assigned to the parent
style={{
flexDirection: "row",
Expand Down

0 comments on commit 339e2ef

Please sign in to comment.