-
Notifications
You must be signed in to change notification settings - Fork 0
Issue 39: Reduce code duplication #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ian-zyh
wants to merge
13
commits into
main
Choose a base branch
from
rhit-zhuy17/39-Reduce-Code-Duplication
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0f28e9d
Upload images, still need to modify to support svg
ian-zyh b65fb72
Change icons to svg format done, delete some images
ian-zyh bd47499
Mergin main to this branch for updating versions
ian-zyh 7eb580b
Change 'x' icon to svg format
ian-zyh f78b7fa
Update some dependencies information
ian-zyh 5598adf
Add comments for svg components
ian-zyh 4287c2c
Add utils file, reduce code duplication
ian-zyh 6dcc7c4
Merge branch 'main' into rhit-zhuy17/39-Reduce-Code-Duplication
ian-zyh db5f2f7
Merge main into this branch, and solve all merge conflict
ian-zyh 56525d8
Merge branch 'main' into rhit-zhuy17/39-Reduce-Code-Duplication
ian-zyh befb7f2
Update format to match the main branch format for svg icon notes, and…
ian-zyh f63304e
Merge Main into this branch
ian-zyh 7548942
Change SelectionList back to the main version
ian-zyh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
ian-zyh marked this conversation as resolved.
Show resolved
Hide resolved
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /* this file has all the common selector utils for Select and MultiSelect */ | ||
| import React from 'react'; | ||
| import { ColorValue, View } from 'react-native'; | ||
| import Svg, { Path } from 'react-native-svg'; | ||
| import type { Data, SelectorRect } from '../types'; | ||
|
|
||
| export const createMeasureHandler = ( | ||
| ref: React.RefObject<any>, | ||
ian-zyh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| setRefRect: React.Dispatch<React.SetStateAction<SelectorRect>>, | ||
| setListDisplay: React.Dispatch<React.SetStateAction<boolean>>, | ||
| boxStyleWidth?: number | string, | ||
| refRectYOffset: number = 5, | ||
| ) => { | ||
| return (display = false) => { | ||
| ref.current?.measureInWindow((x: number, y: number, width: number, height: number) => { | ||
| setRefRect({ | ||
| x: x, | ||
| y: y - refRectYOffset, | ||
| width: boxStyleWidth ?? width, | ||
| height: height + refRectYOffset * 2, | ||
| }); | ||
|
|
||
| if (display && setListDisplay) { | ||
fulformc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| setListDisplay(true); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| export const updatePriorities = (data: Data[]) => [ | ||
| ...data.filter((d: Data) => d.priority), | ||
| ...data.filter((d: Data) => !d.priority), | ||
| ]; | ||
|
|
||
| export const renderDropdownArrow = (listDisplay: boolean, arrowColor: ColorValue) => ( | ||
| <View style={{ position: 'absolute', right: 0, paddingBottom: 4 }}> | ||
| {listDisplay ? ( | ||
| // This is the up arrow "ᨈ" | ||
| <Svg width={25} height={25} viewBox="0 0 25 25" fill="none"> | ||
| <Path | ||
| d="M17 14l-5-5-5 5" | ||
| stroke={arrowColor} | ||
| strokeWidth={2} | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| </Svg>) : ( | ||
| // This is the up arrow "ᨆ" | ||
| <Svg width={25} height={25} viewBox="0 0 25 25" fill="none"> | ||
| <Path | ||
| d="M7 10l5 5 5-5" | ||
| stroke={arrowColor} | ||
| strokeWidth={2} | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
|
|
||
| </Svg> | ||
| )} | ||
| </View> | ||
| ) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.