Skip to content
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

[FEAT] onScroll event handler #122

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,7 @@ android/keystores/debug.keystore

# generated by bob
lib/

# *.lock | *.lockb
*.lockb
*.lock
Comment on lines +79 to +82
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Potential Issue: Missing yarn.lock File

The project is using Yarn ([email protected]) as the package manager, but no lock file (yarn.lock) was found in the repository.

  • Consistency: Lock files ensure that all developers and environments use the same dependency versions, preventing unexpected issues.
  • Reproducible Builds: Without a lock file, builds might not be reproducible, leading to potential discrepancies between development and production environments.

Please verify if the omission of the yarn.lock file is intentional. If not, consider committing the lock file to maintain consistent dependency management across all environments.

🔗 Analysis chain

Approve changes with suggestions for improvement

The new entries correctly implement the intended ignore patterns for lock files. However, I have a few suggestions:

  1. The commented line # *.lock | *.lockb is redundant and can be removed for clarity.

  2. While ignoring lock files can be beneficial in some scenarios, it's important to consider the implications:

    • Ignoring lock files may lead to inconsistencies across different development environments.
    • It could potentially cause issues with reproducible builds.

Please verify if ignoring these lock files aligns with your project's dependency management strategy. If you're using tools like npm or Yarn, it's often recommended to commit the lock files to ensure consistent installations across all environments.

Consider applying this change:

-# *.lock | *.lockb
 *.lockb
 *.lock

To ensure this change doesn't conflict with your project's setup, you can run the following command to check if there are any lock files in your project:

This will help you verify if ignoring these files is appropriate for your project structure and package manager configuration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for the presence of lock files in the project

echo "Searching for lock files..."
fd -e lock -e lockb

echo "Checking package manager..."
if [ -f "package.json" ]; then
    jq '.packageManager' package.json
fi

Length of output: 224

11 changes: 10 additions & 1 deletion src/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function Dropdown(props: DropdownProps, ref: React.Ref<DropdownRef>) {
disabled = false,
error = false,
onSelect,
onScroll,
onScrollBeginDrag,
onScrollEndDrag,
CustomDropdownItem = DropdownItem,
CustomDropdownInput = DropdownInput,
CustomMenuHeader = DropdownHeader,
Expand Down Expand Up @@ -99,7 +102,13 @@ function Dropdown(props: DropdownProps, ref: React.Ref<DropdownRef>) {
multiSelect={false}
/>
)}
<ScrollView style={scrollViewStyle} bounces={false}>
<ScrollView
style={scrollViewStyle}
bounces={false}
onScroll={onScroll}
onScrollBeginDrag={onScrollBeginDrag}
onScrollEndDrag={onScrollEndDrag}
>
{options.map((option, index) => {
return (
<CustomDropdownItem
Expand Down
11 changes: 10 additions & 1 deletion src/multi-select-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ function MultiSelectDropdown(
disabled = false,
error = false,
onSelect,
onScroll,
onScrollBeginDrag,
onScrollEndDrag,
CustomMultiSelectDropdownItem = MultiSelectDropdownItem,
CustomMultiSelectDropdownInput = DropdownInput,
CustomMenuHeader = DropdownHeader,
Expand Down Expand Up @@ -109,7 +112,13 @@ function MultiSelectDropdown(
multiSelect
/>
)}
<ScrollView style={scrollViewStyle} bounces={false}>
<ScrollView
style={scrollViewStyle}
bounces={false}
onScroll={onScroll}
onScrollBeginDrag={onScrollBeginDrag}
onScrollEndDrag={onScrollEndDrag}
>
{options.map((option, index) => {
return (
<CustomMultiSelectDropdownItem
Expand Down
15 changes: 14 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { ForwardRefExoticComponent } from 'react';
import { DimensionValue, PressableProps, View, ViewStyle } from 'react-native';
import {
DimensionValue,
NativeScrollEvent,
NativeSyntheticEvent,
PressableProps,
View,
ViewStyle,
} from 'react-native';
import { TextInputLabelProp } from 'react-native-paper/lib/typescript/components/TextInput/types';
import { TextInputProps } from 'react-native-paper';

Expand Down Expand Up @@ -36,6 +43,9 @@ export type DropdownProps = {
CustomMenuHeader?: (props: DropdownHeaderProps) => JSX.Element;
CustomDropdownItem?: (props: DropdownItemProps) => JSX.Element;
CustomDropdownInput?: (props: DropdownInputProps) => JSX.Element;
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
onScrollBeginDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
onScrollEndDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
} & Pick<
TextInputProps,
'placeholder' | 'label' | 'mode' | 'disabled' | 'error'
Expand All @@ -61,6 +71,9 @@ export type MultiSelectDropdownProps = {
props: MultiSelectDropdownItemProps
) => JSX.Element;
CustomMultiSelectDropdownInput?: (props: DropdownInputProps) => JSX.Element;
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
onScrollBeginDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
onScrollEndDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
} & Pick<
TextInputProps,
'placeholder' | 'label' | 'mode' | 'disabled' | 'error'
Expand Down
Loading