Skip to content

Commit

Permalink
Added state for SegmentedControl (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
PalaashPandey authored Jan 10, 2025
1 parent b8c7c65 commit 9af7299
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/components/sheets/route_planning/InputRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const InputRoute: React.FC<SheetProps> = ({ sheetRef }) => {
// const removeLocationFavorite = removeFavoriteLocationMutation();

const [timeInputFocused, setTimeInputFocused] = useState(false);
const [segmentedIndex, setSegmentedIndex] = useState<number>(0)

// function toggleFavoriteLocation(location: SearchSuggestion) {
// if (favoriteLocations && favoriteLocations.find((item) => suggestionEqual(item, location)))
Expand Down Expand Up @@ -203,8 +204,9 @@ const InputRoute: React.FC<SheetProps> = ({ sheetRef }) => {
<View style={{flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginVertical: 12, paddingHorizontal: 16 }}>
<SegmentedControl
values={['Leave by', 'Arrive by']}
selectedIndex={0}
selectedIndex={segmentedIndex}
onChange={(event) => {
setSegmentedIndex(event.nativeEvent.selectedSegmentIndex)
setDeadline(event.nativeEvent.selectedSegmentIndex == 0 ? "leave" : "arrive")
}}
style={{flex: 1, marginRight: 8}}
Expand Down

0 comments on commit 9af7299

Please sign in to comment.