Skip to content

Commit

Permalink
fix(web): fix HOC components variants + psuedo/media merge
Browse files Browse the repository at this point in the history
  • Loading branch information
natew committed Apr 18, 2023
1 parent ca91256 commit c6c1a43
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
18 changes: 17 additions & 1 deletion apps/kitchen-sink/src/features/home/screen.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { variableToString } from '@tamagui/core'
import { styled, variableToString } from '@tamagui/core'
import { ChevronRight, Moon, Sun } from '@tamagui/lucide-icons'
import { ScrollView } from 'react-native'
import { UseLinkProps, useLink } from 'solito/link'
Expand All @@ -18,6 +18,20 @@ import {

import { useThemeControl } from '../../useKitchenSinkTheme'

const BetaButton = styled(Button, {
debug: 'verbose',

variants: {
primary: {
true: {
pressStyle: {
backgroundColor: 'red',
},
},
},
},
})

export function HomeScreen() {
return (
<ScrollView>
Expand All @@ -26,6 +40,8 @@ export function HomeScreen() {
Demos
</H1>

<BetaButton primary>test</BetaButton>

<YStack theme="yellow" bc="$background" p="$3" br="$4" bw={1} boc="$borderColor">
<Paragraph>Welcome to the Tamagui Kitchen Sink!</Paragraph>
</YStack>
Expand Down
8 changes: 8 additions & 0 deletions packages/web/src/helpers/getSplitStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,14 @@ export const getSplitStyles: StyleSplitter = (
viewProps[key] = props[key] ?? val
}

// have to run this logic again here
const isHOCShouldPassThrough = staticConfig.isHOC && isMediaOrPseudo
if (isHOCShouldPassThrough && !(key in usedKeys)) {
usedKeys[key] = 1
viewProps[key] = val
continue
}

// pseudo
if (isPseudo) {
if (!val) continue
Expand Down

0 comments on commit c6c1a43

Please sign in to comment.