From 83b4106a68138ccf87a92ec35d22cb188175a502 Mon Sep 17 00:00:00 2001 From: Mohit Date: Sun, 21 Feb 2021 21:15:31 +0530 Subject: [PATCH 1/2] ts changes + skip transform --- build/Sheet.js | 3 ++- build/Sugar.d.ts | 2 +- lib/Sheet.ts | 3 ++- lib/Sugar.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build/Sheet.js b/build/Sheet.js index a326fb0..445707e 100644 --- a/build/Sheet.js +++ b/build/Sheet.js @@ -1,5 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +const SKIP_KEYS = ["transform", "transformMatrix"]; class Sheet { constructor(sourceFn) { this.source = sourceFn; @@ -25,7 +26,7 @@ class Sheet { const styles = restyle[key]; Object.keys(styles).forEach((styleKey) => { const styleValue = styles[styleKey]; - if (styleValue && Array.isArray(styleValue)) { + if (styleValue && Array.isArray(styleValue) && !SKIP_KEYS.includes(styleKey)) { // length is checked to allow undefined to set as styleValue if (activeIndex >= styleValue.length) { const selectedValue = styleValue[styleValue.length - 1]; diff --git a/build/Sugar.d.ts b/build/Sugar.d.ts index 9a681f0..23e92ee 100644 --- a/build/Sugar.d.ts +++ b/build/Sugar.d.ts @@ -99,7 +99,7 @@ export default class Sugar { _refresh(): void; build(themeObj: T): void; configure(newConstants: Partial): void; - create

| NamedStyles>(objFn: Fn): StyleSheetType

; + create

| NamedStyles>(objFn: Fn | P): StyleSheetType

; _calculateActiveIndex(): void; _calcSheets(): void; _callListeners(event: buildEventType): void; diff --git a/lib/Sheet.ts b/lib/Sheet.ts index 10477cd..37b751a 100644 --- a/lib/Sheet.ts +++ b/lib/Sheet.ts @@ -1,5 +1,6 @@ import type { ConstantsType, Fn, NamedStyles, StyleSheetType } from './type'; +const SKIP_KEYS = ["transform", "transformMatrix"]; export default class Sheet< T, P extends NamedStyles

| NamedStyles> { @@ -38,7 +39,7 @@ export default class Sheet< const styles = restyle[key]; Object.keys(styles).forEach((styleKey) => { const styleValue = styles[styleKey]; - if (styleValue && Array.isArray(styleValue)) { + if (styleValue && Array.isArray(styleValue) && !SKIP_KEYS.includes(styleKey)) { // length is checked to allow undefined to set as styleValue if (activeIndex >= styleValue.length) { const selectedValue = styleValue[styleValue.length - 1]; diff --git a/lib/Sugar.ts b/lib/Sugar.ts index 293eb15..ffb6046 100644 --- a/lib/Sugar.ts +++ b/lib/Sugar.ts @@ -146,7 +146,7 @@ export default class Sugar { } create

| NamedStyles>( - objFn: Fn + objFn: Fn | P ): StyleSheetType

{ if (typeof objFn === 'function') { const sheet = new Sheet(objFn); From 58e5be543b6de0ffb5deb6fe11e1dae92603522d Mon Sep 17 00:00:00 2001 From: Mohit Date: Sun, 21 Feb 2021 21:16:35 +0530 Subject: [PATCH 2/2] v0.1.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 42d5b68..b6d8009 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-sugar-style", - "version": "0.1.6", + "version": "0.1.7", "description": "React Native Stylesheet alternative with theme support", "author": "mohit23x", "license": "MIT",