GithubHelp home page GithubHelp logo

Comments (5)

MrRedwing avatar MrRedwing commented on August 19, 2024 1

I noticed that for anything that causes the color picker to reload (state of a prop changes or expo fast load update) the component started to work again. Here's a small workaround that I could recommend when I was working on my project.

const [size, setSize] = useState(30);

const generateNewSize = () => {
    // range of possible sizes (can possibly be smaller)
    const min = 29;
    const max = 31;

    // ensures new size is different in order to trigger a reload because the state is now different in the size prop
    let newSize = size;
    while (newSize === size) {
      newSize = Math.random() * (max - min) + min;
    }

    setSize(newSize);
}

return (
    <ColorPicker
        style={styles.colorPickerStyle}
        color={ThemeObj.bgColor}
        onColorChangeComplete={color => {
            selectedPickerColor = color;
         }}
        thumbSize={size}
        sliderSize={size}
        noSnap={false}
        swatches={false}
        row={false}
        gapSize={1000}
        onInteractionStart={generateNewSize}
    />
);

Hopefully, this workaround proves helpful to you and this is eventually patched.

from react-native-wheel-color-picker.

MrRedwing avatar MrRedwing commented on August 19, 2024

I have the same issue. It's a shame because the frequency of this error makes it unusable in my project. I found assigning the thumb-size and slider size a state variable that changing the state to a slightly different size upon interaction can help but it still occurs.

from react-native-wheel-color-picker.

ArtsiomAstrouski avatar ArtsiomAstrouski commented on August 19, 2024

This problem is still relevant

from react-native-wheel-color-picker.

javiermojito avatar javiermojito commented on August 19, 2024

Hey @dharay that fix works, thanks! good job!

from react-native-wheel-color-picker.

Naeemur avatar Naeemur commented on August 19, 2024

Added prop useNativeLayout in v1.3.0 with some additional checking. That should fix the issue.
See README.md please.

from react-native-wheel-color-picker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.