11import { Dimensions } from 'react-native'
22import { Orientation , StyleDependency } from '../../types'
3- import { RNStyle , Style , StyleSheets } from '../types'
3+ import { ComponentState , RNStyle , Style , StyleSheets } from '../types'
44import { parseBoxShadow , parseFontVariant , parseTransformsMutation , resolveGradient } from './parsers'
55import { UniwindRuntime } from './runtime'
66
@@ -30,7 +30,7 @@ export class UniwindStoreBuilder {
3030 }
3131 }
3232
33- getStyles ( className ?: string ) {
33+ getStyles ( className ?: string , state ?: ComponentState ) {
3434 if ( className === undefined ) {
3535 return {
3636 styles : { } as RNStyle ,
@@ -56,7 +56,7 @@ export class UniwindStoreBuilder {
5656 } )
5757 . filter ( Boolean )
5858
59- return this . resolveStyles ( styles as Array < [ string , Style ] > )
59+ return this . resolveStyles ( styles as Array < [ string , Style ] > , state )
6060 }
6161
6262 reload = ( ) => {
@@ -67,7 +67,7 @@ export class UniwindStoreBuilder {
6767 dependencies . forEach ( dep => this . listeners [ dep ] . forEach ( listener => listener ( ) ) )
6868 }
6969
70- private resolveStyles ( styles : Array < [ string , Style ] > ) {
70+ private resolveStyles ( styles : Array < [ string , Style ] > , state ?: ComponentState ) {
7171 const dependencies = [ ] as Array < StyleDependency >
7272 const filteredStyles = styles . filter ( ( [ , style ] ) => {
7373 dependencies . push ( ...style . dependencies )
@@ -78,6 +78,9 @@ export class UniwindStoreBuilder {
7878 || ( style . theme !== null && this . runtime . currentThemeName !== style . theme )
7979 || ( style . orientation !== null && this . runtime . orientation !== style . orientation )
8080 || ( style . rtl !== null && this . runtime . rtl !== style . rtl )
81+ || ( style . active !== null && state ?. isPressed !== style . active )
82+ || ( style . focus !== null && state ?. isFocused !== style . focus )
83+ || ( style . disabled !== null && state ?. isDisabled !== style . disabled )
8184 ) {
8285 return false
8386 }
0 commit comments