Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #347 from gluestack/fix/release-inline-props
Browse files Browse the repository at this point in the history
fix: release inline props
  • Loading branch information
Viraj-10 authored Aug 25, 2023
2 parents ca0932c + 99d65b0 commit 1346937
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 20 deletions.
16 changes: 8 additions & 8 deletions packages/react/src/resolver/getComponentStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { OrderedSXResolved } from '../types';
export function getComponentResolvedBaseStyle(
orderedResolved: OrderedSXResolved
) {
const componentOrderResolvedBaseStyle: Array<any> = [];
const componentOrderResolvedBaseStateStyle: Array<any> = [];
const componentOrderResolvedBaseStyle: OrderedSXResolved = [];
const componentOrderResolvedBaseStateStyle: OrderedSXResolved = [];

orderedResolved &&
orderedResolved.forEach((item: any) => {
Expand All @@ -31,8 +31,8 @@ export function getComponentResolvedBaseStyle(
export function getComponentResolvedVariantStyle(
orderedResolved: OrderedSXResolved
) {
const componentOrderResolvedVariantStyle: Array<any> = [];
const componentOrderResolvedVariantStateStyle: Array<any> = [];
const componentOrderResolvedVariantStyle: OrderedSXResolved = [];
const componentOrderResolvedVariantStateStyle: OrderedSXResolved = [];

orderedResolved &&
orderedResolved.forEach((item: any) => {
Expand All @@ -57,8 +57,8 @@ export function getComponentResolvedVariantStyle(
export function getDescendantResolvedBaseStyle(
orderedResolved: OrderedSXResolved
) {
const descendantOrderResolvedBaseStyle: Array<any> = [];
const descendantOrderResolvedBaseStateStyle: Array<any> = [];
const descendantOrderResolvedBaseStyle: OrderedSXResolved = [];
const descendantOrderResolvedBaseStateStyle: OrderedSXResolved = [];

orderedResolved &&
orderedResolved.forEach((item: any) => {
Expand All @@ -85,8 +85,8 @@ export function getDescendantResolvedBaseStyle(
export function getDescendantResolvedVariantStyle(
orderedResolved: OrderedSXResolved
) {
const descendantOrderResolvedVariantStyle: Array<any> = [];
const descendantOrderResolvedVariantStateStyle: Array<any> = [];
const descendantOrderResolvedVariantStyle: OrderedSXResolved = [];
const descendantOrderResolvedVariantStateStyle: OrderedSXResolved = [];

orderedResolved &&
orderedResolved.forEach((item: any) => {
Expand Down
44 changes: 32 additions & 12 deletions packages/react/src/resolver/injectComponentAndDescendantStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,56 @@ export function injectComponentAndDescendantStyles(
styleTagId?: string,
type: 'boot' | 'inline' = 'boot'
) {
const componentOrderResolvedBaseStyle =
getComponentResolvedBaseStyle(orderedResolved);
const componentOrderResolvedVariantStyle =
getComponentResolvedVariantStyle(orderedResolved);
const [
componentOrderResolvedBaseStyle,
componentOrderResolvedBaseStateStyle,
] = getComponentResolvedBaseStyle(orderedResolved);
const [
componentOrderResolvedVariantStyle,
componentOrderResolvedVariantStateStyle,
] = getComponentResolvedVariantStyle(orderedResolved);

const descendantOrderResolvedBaseStyle =
getDescendantResolvedBaseStyle(orderedResolved);
const descendantOrderResolvedVariantStyle =
getDescendantResolvedVariantStyle(orderedResolved);
const [
descendantOrderResolvedBaseStyle,
descendantOrderResolvedBaseStateStyle,
] = getDescendantResolvedBaseStyle(orderedResolved);
const [
descendantOrderResolvedVariantStyle,
descendantOrderResolvedVariantStateStyle,
] = getDescendantResolvedVariantStyle(orderedResolved);

const componentOrderResolvedBaseStyleIds = GluestackStyleSheet.declare(
componentOrderResolvedBaseStyle,
[
...componentOrderResolvedBaseStyle,
...componentOrderResolvedBaseStateStyle,
],
type + '-base',
styleTagId ? styleTagId : 'css-injected-boot-time',
false
);
const descendantOrderResolvedBaseStyleIds = GluestackStyleSheet.declare(
descendantOrderResolvedBaseStyle,
[
...descendantOrderResolvedBaseStyle,
...descendantOrderResolvedBaseStateStyle,
],
type + '-descendant-base',
styleTagId ? styleTagId : 'css-injected-boot-time-descendant',
{}
);
const componentOrderResolvedVariantStyleIds = GluestackStyleSheet.declare(
componentOrderResolvedVariantStyle,
[
...componentOrderResolvedVariantStyle,
...componentOrderResolvedVariantStateStyle,
],
type + '-variant',
styleTagId ? styleTagId : 'css-injected-boot-time',
{}
);
const descendantOrderResolvedVariantStyleIds = GluestackStyleSheet.declare(
descendantOrderResolvedVariantStyle,
[
...descendantOrderResolvedVariantStyle,
...descendantOrderResolvedVariantStateStyle,
],
type + '-descendant-variant',
styleTagId ? styleTagId : 'css-injected-boot-time-descendant',
{}
Expand Down

0 comments on commit 1346937

Please sign in to comment.