Skip to content

Merge VK UI from 4 to 5 #5078

Closed Answered by inomdzhon
Vlad-Remnev asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!

You could do something like this:

import { type PlatformType, classNames, usePlatform } from "@vkontakte/vkui";

function getClassNameWithPlatform(platform: PlatformType) {
  switch (platform) {
    case 'android':
      return 'Example--android';
    case 'ios':
      return 'Example--ios';
    default:
      return;
  }
}

const Example = () => {
  const platform = usePlatform();

  return <div className={classNames('Example', getClassNameWithPlatform(platform)} />
};

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by inomdzhon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants