Skip to content

tw.style should accept falsey values in object syntax #338

@ferretwithaberet

Description

@ferretwithaberet

Migrated from nativewind + classnames. tw.style is awesome, but, unlike classnames, it does not accept any value when using object syntax, it only accepts boolean.
Is this intentional? Or can this be changed to match the behavior of classnames?

Example

export type ComponentProps = {
  vertical?: boolean;
}

export const Component = (props: ComponentProps) => {
  const { vertical } = props

  return <View style={tw.style({
    'flex-row': !vertical,    
    'flex-col': vertical,
  })}>
    <Text>Test1</Text>
    <Text>Test2</Text>
  </View>
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions