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

Switch component: Possibility to style handle and track individually #2402

Open
federicoportoghese opened this issue Aug 22, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@federicoportoghese
Copy link

Description

Since the component is directly imported from react native, it doesn't have descendants (such as _track or _thumb) it is impossible to give particular styles to the single elements. It would be nice to have this possibility

Problem Statement

Screenshot 2024-08-22 at 13 55 18

For example: is there a way to add such a particular border or outline around the handle for particular states?

Proposed Solution or API

Is something like this somehow possible?

export function createSwitch<
  SwitchProps,
  HandleProps,
  TrackProps,
>({
  Root,
  Handle,
  Track
}: {
  Root: React.ComponentType<SwitchProps>;
  Handle: React.ComponentType<HandleProps>;
  Track: React.ComponentType<TrackProps>;
}) {
  const Switch = SwitchMain(Root) as any;
  Switch.Handle = SwitchHandle(Handle);
  Switch.Track = SwitchTrack(Track);

  Switch.displayName = 'Switch';
  Switch.Handle.displayName = 'Switch.Handle';
  Switch.Track.displayName = 'Switch.Track';

  return Switch as ISwitchComponentType<
    SwitchProps,
    HandleProps,
    TrackProps,
  >;
}

Alternatives

No response

Additional Information

No response

@rajat693
Copy link
Collaborator

hi @federicoportoghese thanks for reporting the issue, We are working on custom switch component which will have all of this options.

@federicoportoghese
Copy link
Author

federicoportoghese commented Sep 2, 2024

Thanks for your reply @rajat693. Is there by any chance an estimated date for that to happen? Thanks

@rajat693
Copy link
Collaborator

rajat693 commented Sep 3, 2024

Hi @federicoportoghese , thank you for your patience. We have this on our roadmap and will address it as soon as our core issues are resolved.

@sra1kumar-NULL sra1kumar-NULL added the enhancement New feature or request label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

3 participants