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

All Buttons inside ButtonGroup have same status #724

Closed
1 of 2 tasks
28harishkumar opened this issue Nov 11, 2019 · 9 comments
Closed
1 of 2 tasks

All Buttons inside ButtonGroup have same status #724

28harishkumar opened this issue Nov 11, 2019 · 9 comments
Assignees
Labels
💡 Proposal 📱 Components components module-specific

Comments

@28harishkumar
Copy link

28harishkumar commented Nov 11, 2019

Issue type

I'm submitting a ... (check one with "x")

  • bug report
  • feature request

Issue description

Current behavior:
Button elements in ButtonGroup have same status

Expected behavior:
Each Button should have its own status

Steps to reproduce:

<ButtonGroup>
     <Button status='success'>
         A
     </Button>
     <Button>
        B
     </Button>
     <Button>
        C
     </Button>
</ButtonGroup>

Related code:

insert short code snippets here

Other information:

OS, device, package version

package: 4.3.0
@artyorsh artyorsh self-assigned this Nov 11, 2019
@artyorsh artyorsh added help wanted 📱 Components components module-specific labels Nov 11, 2019
@artyorsh
Copy link
Collaborator

artyorsh commented Nov 11, 2019

Hi @28harishkumar 👋
You can achieve this by passing appearance or status property to ButtonGroup

import React from 'react';
import { ButtonGroup, Button } from 'react-native-ui-kitten';

const SameStatusButtonGroup = () => (
  <ButtonGroup status='success'>
    <Button>A</Button>
    <Button>B</Button>
    <Button>C</Button>
  </ButtonGroup>
);

const SameAppearanceButtonGroup = () => (
  <ButtonGroup appearance='outline'>
    <Button>A</Button>
    <Button>B</Button>
    <Button>C</Button>
  </ButtonGroup>
);

@28harishkumar
Copy link
Author

Hi @artyorsh

I typed appearance instead of status.
My point is different status inside ButtonGroup

<ButtonGroup>
     <Button status='success'>
         A
     </Button>
     <Button>
        B
     </Button>
     <Button status='danger'>
        C
     </Button>
</ButtonGroup>

@28harishkumar 28harishkumar changed the title All Buttons inside ButtonGroup have same appearance All Buttons inside ButtonGroup have same status Nov 12, 2019
@artyorsh artyorsh reopened this Nov 12, 2019
@artyorsh
Copy link
Collaborator

@28harishkumar can you share a bit more information about the use-case? Such changes need discussion with our design team

@28harishkumar
Copy link
Author

28harishkumar commented Nov 12, 2019

Currently I am not able to give inline Action Buttons with different colors.
Simple use case is providing Save, Save & Add Another and Delete options for some entry. Save with primary status, Save & Add Another with info status and Delete with danger status.

Another use case is providing OK and Cancel buttons.

Although all use cases can be covered by replacing ButtonGroup with View and writing extra style. But it will be better if ButtonGroup does not restrict individual Button property.

Additionally I found one more issue. ButtonGroup is accepting white status and it is passing it to Button. Button does not accept white status. It accepts basic status that is not accepted by
ButtonGroup.
It raises following warning:

Button: unsupported configuration.
Check one of the following prop values {
  "appearance": "filled",
  "variants": [
    "white",
    "medium"
  ],
  "states": []
}
📖 Documentation: https://akveo.github.io/react-native-ui-kitten/docs/components/button/api

@artyorsh
Copy link
Collaborator

@28harishkumar we don't think ButtonGroup should be used for this case. Instead, just use multiple Buttons without wrapping into ButtonGroup. See our vision of it.

I found one more issue

Thanks for reporting 👍 We've already got fix for this. Will be available in next release

@pjnovas
Copy link

pjnovas commented Mar 27, 2020

@artyorsh hey, I came up with a similar case; what I'm trying to do is like the old pagination from bootstrap

image

Snack has that feature for selecting the platform too:

image

My first attemp was to set up a ButtonGroup and changing one to the children Button's state as a "Selected one". Is there a way of accomplish that on the current version of the library?

Thanks!

@artyorsh
Copy link
Collaborator

artyorsh commented Mar 30, 2020

@pjnovas Actually, ButtonGroup is not about selection mode. For this case, you may see a gist I use in my project

@garrettg123
Copy link

@artyorsh this would be a great element to include in a future release.

@Luard
Copy link

Luard commented May 5, 2020

You can also achieve this by changing the button style instead of the status, for example:

<ButtonGroup status="basic" appearance="outline" >
	<Button 
		textStyle={ selected ? { color: "white" } : null }
		style={ selected ? styles.buttonSelected : null }>
			L
	</Button>
	<Button>M</Button>
	<Button>R</Button>
</ButtonGroup>

Also, I realised that using status="basic" on the ButtonGroup on Dark Mode is showing a highlighten white instead on a gray. Is that correct?

Example, using Dark Mode, the border of the basic status is has strong as the control status:

<ButtonGroup status="basic" appearance="outline" >
	<Button>L</Button>
	<Button>M</Button>
	<Button>R</Button>
</ButtonGroup>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Proposal 📱 Components components module-specific
Projects
None yet
Development

No branches or pull requests

5 participants