Gathering detailed insights and metrics for babel-plugin-react-native-classname-to-dynamic-style
Gathering detailed insights and metrics for babel-plugin-react-native-classname-to-dynamic-style
Transform JSX className property to a style property that gets calculated at runtime in React Native. The plugin is used to match style objects containing parsed CSS media queries and CSS viewport units with React Native.
npm install babel-plugin-react-native-classname-to-dynamic-style
Typescript
Module System
Node Version
NPM Version
36.2
Supply Chain
51.2
Quality
66
Maintenance
50
Vulnerability
94.1
License
JavaScript (100%)
Total Downloads
30,776
Last Day
5
Last Week
50
Last Month
376
Last Year
5,437
13 Stars
61 Commits
7 Forks
3 Watching
8 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
0.22.0
Package Id
babel-plugin-react-native-classname-to-dynamic-style@0.22.0
Unpacked Size
15.05 kB
Size
3.98 kB
File Count
4
NPM Version
6.4.1
Node Version
8.15.0
Cumulative downloads
Total Downloads
Last day
25%
5
Compared to previous day
Last week
-26.5%
50
Compared to previous week
Last month
33.3%
376
Compared to previous month
Last year
-48.2%
5,437
Compared to previous year
1
Transform JSX className
property to a style
property that gets calculated at runtime in React Native. The plugin is used to match style objects containing parsed CSS media queries and CSS viewport units with React Native.
1yarn add --dev babel-plugin-react-native-classname-to-dynamic-style
or
1npm install --save-dev babel-plugin-react-native-classname-to-dynamic-style
.babelrc
{
"presets": [
"react-native"
],
"plugins": [
"react-native-classname-to-dynamic-style"
]
}
Example:
1<Text className={styles.myClass} />
↓ ↓ ↓ ↓ ↓ ↓
1var _reactNativeDynamicStyleProcessor = require("react-native-dynamic-style-processor"); 2 3<Text style={_reactNativeDynamicStyleProcessor.process(styles).myClass} />;
...or with className
and style
:
1<Text className={styles.myClass} style={{ color: "blue" }} />
↓ ↓ ↓ ↓ ↓ ↓
1var _reactNativeDynamicStyleProcessor = require("react-native-dynamic-style-processor"); 2 3<Text 4 style={[ 5 _reactNativeDynamicStyleProcessor.process(styles).myClass, 6 { color: "blue" } 7 ]} 8/>;
[styles.class1, styles.class2].join(" ")
syntaxExample:
1<Text className={[styles.class1, styles.class2].join(" ")} />
↓ ↓ ↓ ↓ ↓ ↓
1var _reactNativeDynamicStyleProcessor = require("react-native-dynamic-style-processor"); 2 3<Text 4 style={[ 5 _reactNativeDynamicStyleProcessor.process(styles).class1, 6 _reactNativeDynamicStyleProcessor.process(styles).class2 7 ]} 8/>;
...or with className
and style
:
1<Text 2 className={[styles.class1, styles.class2].join(" ")} 3 style={{ color: "blue" }} 4/>
↓ ↓ ↓ ↓ ↓ ↓
1var _reactNativeDynamicStyleProcessor = require("react-native-dynamic-style-processor"); 2 3<Text 4 style={[ 5 _reactNativeDynamicStyleProcessor.process(styles).class1, 6 _reactNativeDynamicStyleProcessor.process(styles).class2, 7 { color: "blue" } 8 ]} 9/>;
Example:
1<Text className={`${styles.class1} ${styles.class2}`} />
↓ ↓ ↓ ↓ ↓ ↓
1var _reactNativeDynamicStyleProcessor = require("react-native-dynamic-style-processor"); 2 3<Text 4 style={[ 5 _reactNativeDynamicStyleProcessor.process(styles).class1, 6 _reactNativeDynamicStyleProcessor.process(styles).class2 7 ]} 8/>;
...or with className
and style
:
1<Text 2 className={`${styles.class1} ${styles.class2}`} 3 style={{ color: "blue" }} 4/>
↓ ↓ ↓ ↓ ↓ ↓
1var _reactNativeDynamicStyleProcessor = require("react-native-dynamic-style-processor"); 2 3<Text 4 style={[ 5 _reactNativeDynamicStyleProcessor.process(styles).class1, 6 _reactNativeDynamicStyleProcessor.process(styles).class2, 7 { color: "blue" } 8 ]} 9/>;
Example:
1<Text className={isTrue ? styles.class1 : styles.class2} />
↓ ↓ ↓ ↓ ↓ ↓
1var _reactNativeDynamicStyleProcessor = require("react-native-dynamic-style-processor"); 2 3<Text 4 style={ 5 isTrue 6 ? _reactNativeDynamicStyleProcessor.process(styles).class1 7 : _reactNativeDynamicStyleProcessor.process(styles).class2 8 } 9/>;
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/5 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
60 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More