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

Variant for multi-elements #2136

Open
dittmarconsulting opened this issue Jul 24, 2022 · 0 comments
Open

Variant for multi-elements #2136

dittmarconsulting opened this issue Jul 24, 2022 · 0 comments
Labels

Comments

@dittmarconsulting
Copy link

Hi all,

First of all, thank you for the great lib.

I have a question about applying a variant for multi-elements like this:

import styled from "styled-components/native"
import { variant } from "styled-system"
import { View, Text, ActivityIndicator } from "react-native"

const BaseButton = ({ isLoading }) => (
  <View style={{ flexDirection="row" }}>
    <Text>Foo</Text>
    { isLoading && <ActivityIndicator />
  </View>
)

const Button = styled(BaseButton)(
  variant({
    variants: {
      primary: {
        backgroundColor: "blue",
      },
    },
  })
)

In this example, my View will get a blue background when I apply the variant primary but how can I set the Text color and the color for the ActivityIndicator?

Is that somehow possible?

Thank you in advance.

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

No branches or pull requests

1 participant