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

Issue with ColorPicker and Panel3 in React Native #78

Open
rahuldev761 opened this issue May 17, 2024 · 1 comment
Open

Issue with ColorPicker and Panel3 in React Native #78

rahuldev761 opened this issue May 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@rahuldev761
Copy link

rahuldev761 commented May 17, 2024

Description

I am experiencing an issue with the ColorPicker component when used with Panel3. Specifically, the ColorPicker scrolls along with the page when it should remain stationary.

Here are the details:

Scrolling Issue: The ColorPicker moves when scrolling within a KeyboardAwareScrollView. I also tried using react-native-gesture-handler's ScrollView but encountered the same problem.

Function Callbacks: We are using two functions, onChange and onComplete. When the scrolling issue occurs, the onComplete function does not get called.

Problems:

  1. The ColorPicker scrolls along with the content when it should remain fixed.
  2. When the ColorPicker scrolls, the onComplete function is not triggered.

I am sharing the problem video for a better understanding.

Screen.Recording.2024-05-17.at.1.28.54.PM.mov

here is my code:


 <View style={styles.container}>

            <GestureHandlerRootView style={{ paddingBottom: 150 }}>
                <KeyboardAwareScrollView
                    enableOnAndroid
                    bounces={false}
                    showsVerticalScrollIndicator={false}
                    contentContainerStyle={{ paddingBottom: normalize(36) }}
                    keyboardShouldPersistTaps="handled"
                    enableResetScrollToCoords={false}
                >
                    <View style={styles.colorWheelContainer}>
                        <ColorPicker
                            value={defaultColor}
                            thumbInnerStyle={[styles.thumbStyle, thumbStyle]}
                            onChange={onChange}
                            onComplete={(color) => {
                                onComplete(color?.hex)
                            }}
                        >
                            <Panel3 style={[styles.panelStyle, colorWheelStyle]} />
                        </ColorPicker>
                    </View>

                </KeyboardAwareScrollView>
            </GestureHandlerRootView>

        </View>

Steps to reproduce

To reproduce do the same thing which is in the video, Just press press and drag.

Screen.Recording.2024-05-17.at.1.28.54.PM.mov

Snack or a link to a repository

No response

Reanimated Color Picker version

3.4.2

React Native version

0.70.10

React Native Reanimated version

2.14.0

React Native Gesture Handler version

2.5.0

Platforms

Android, iOS

JavaScript runtime

JSC

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

@rahuldev761 rahuldev761 added the bug Something isn't working label May 17, 2024
@rahuldev761 rahuldev761 changed the title Color picker is not working properly with scroll view Issue with ColorPicker and Panel3 in React Native May 17, 2024
@alabsi91
Copy link
Owner

I recommend using the color picker inside a modal as a popup. This is because you are relying on RNGH to decide which gestures to cancel and which to allow. While RNGH scroll view works most of the time, it does not seem to work in your case. However, you can add a new gesture to disable and enable the scroll view, and then attach it to Panel3 see gestures and software-mansion/react-native-gesture-handler#2616

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants