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

Color wheel misbehaves when placed in flexbox View #48

Open
tkanarsky opened this issue Jun 16, 2020 · 2 comments
Open

Color wheel misbehaves when placed in flexbox View #48

tkanarsky opened this issue Jun 16, 2020 · 2 comments

Comments

@tkanarsky
Copy link

If I create a ColorWheel component as a child of a flexbox View component, like so:

<View style={{display: "flex", flexDirection: "column", justifyContent: "flex-start"}}>
   <Text>Alpha</Text>
   <Text>Beta</Text>
   <Text>Gamma</Text>
    <ColorWheel
      initialColor="#ee0000"
      onColorChange={color => console.log({color})}
      onColorChangeComplete={color => onChange(color)}
      style={{width: Dimensions.get('window').width}}
      thumbStyle={{ height: 30, width: 30, borderRadius: 30}}
    />
  </View>

the color wheel's height and width are set to zero -- only the thumb slider remains visible:
Screenshot_20200615-230417

By changing line 224 of ColorWheel.js from flex: 1, to display: flex,, the color wheel is properly sized and positioned in the flexbox:
Screenshot_20200615-230442

Let me know if this change fixes any issues or if I'm using the component wrong. Thanks in advance!

tkanarsky added a commit to tkanarsky/react-native-color-wheel that referenced this issue Jun 16, 2020
@RickeyWard
Copy link
Collaborator

flex:1 has to do with the view itself. display:flex has to do with its children. Though I find it odd that this change was necessary. passing styles into the ColorWheel component's style attribute, passing display:flex there would have worked without editing the library internally.

Have you noticed your change causing any issues when the component isnt in a flex container?

@NilsBaumgartner1994
Copy link

Facing similar issues, when placing multiple Views with flex next to each other and ColorWheel in between

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants