Skip to content

Commit 65d7c5c

Browse files
committed
fix(HTML): prevent crashes with css functions, "normal" & "unset" keywords
1 parent 0eea307 commit 65d7c5c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/HTMLStyles.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ function cssToRNStyle (css, styleset, { emSize, ptSize, ignoredStyles, allowedSt
182182
}
183183

184184
if (typeof value === 'string') {
185+
if (value.search('inherit') !== -1 || value.search('calc') !== -1 || value.search('normal') !== -1) {
186+
return undefined;
187+
}
185188
value = value.replace('!important', '');
186189
// See if we can use the percentage directly
187190
if (value.search('%') !== -1 && PERC_SUPPORTED_STYLES.indexOf(key) !== -1) {

src/HTMLUtils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export const ABSOLUTE_FONT_SIZE = {
3838
'larger': 16,
3939
'length': null,
4040
'initial': null,
41-
'inherit': null
41+
'inherit': null,
42+
'unset': null
4243
};
4344

4445
export const IGNORED_TAGS = ['head', 'scripts', 'audio', 'video', 'track', 'embed', 'object', 'param', 'source', 'canvas', 'noscript',

0 commit comments

Comments
 (0)