Skip to content

Commit

Permalink
Merge pull request #97 from archriss/dev
Browse files Browse the repository at this point in the history
v3.8.1
  • Loading branch information
Exilz authored Feb 8, 2018
2 parents 9adae7c + d820ef2 commit bb8fbfa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"react": "16.2.0",
"react-native": "0.52.0",
"react-native-render-html": "3.8.0"
"react-native-render-html": "3.8.1"
},
"devDependencies": {
"babel-jest": "22.0.6",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-render-html",
"version": "3.8.0",
"version": "3.8.1",
"author": "Archriss",
"license": "BSD-2-Clause",
"repository": "https://github.com/archriss/react-native-render-html",
Expand Down
6 changes: 4 additions & 2 deletions src/HTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,20 @@ export default class HTML extends PureComponent {

for (let i = 0; i < styles.length; i++) {
const styleAttribute = styles[i];
const tagToCheck = tagName === 'rawtext' ? parentTag : tagName;
const styleAttributeWithCSSDashes = styleAttribute.replace(/[A-Z]/, (match) => { return `-${match.toLowerCase()}`; });
const overridenFromStyle = attribs && attribs.style && attribs.style.search(styleAttributeWithCSSDashes) !== -1;
const overridenFromParentStyle = parent && parent.attribs && parent.attribs.style && parent.attribs.style.search(styleAttributeWithCSSDashes) !== -1;

const overridenFromTagStyle = tagName && tagsStyles[tagName] && tagsStyles[tagName][styleAttribute];
const overridenFromTagStyle = tagToCheck && tagsStyles[tagToCheck] && tagsStyles[tagToCheck][styleAttribute];
const overridenFromParentTagStyle = parentTag && tagsStyles[parentTag] && tagsStyles[parentTag][styleAttribute];

const overridenFromClassStyles = classStyles && classStyles[styleAttribute];
const overridenFromDefaultStyles = this.defaultTextStyles[tagToCheck] && this.defaultTextStyles[tagToCheck][styleAttribute];

const notOverriden = !overridenFromStyle && !overridenFromParentStyle &&
!overridenFromTagStyle && !overridenFromParentTagStyle &&
!overridenFromClassStyles;
!overridenFromClassStyles && !overridenFromDefaultStyles;

if (notOverriden) {
appliedStyles[styleAttribute] = baseFontStyle[styleAttribute];
Expand Down

0 comments on commit bb8fbfa

Please sign in to comment.