From 2a84d7994eb2886316adbafbc8e0194be411d55a Mon Sep 17 00:00:00 2001 From: u-e Date: Fri, 18 Jan 2019 12:44:44 +0300 Subject: [PATCH] closed #275 --- .../postElements/body/view/postBodyView.js | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/postElements/body/view/postBodyView.js b/src/components/postElements/body/view/postBodyView.js index 084edaa3b..41d2d9500 100644 --- a/src/components/postElements/body/view/postBodyView.js +++ b/src/components/postElements/body/view/postBodyView.js @@ -1,7 +1,5 @@ import React, { PureComponent, Fragment } from 'react'; -import { - Dimensions, Linking, Alert, -} from 'react-native'; +import { Dimensions, Linking, Alert } from 'react-native'; import { withNavigation } from 'react-navigation'; import { injectIntl } from 'react-intl'; @@ -16,7 +14,7 @@ import { default as ROUTES } from '../../../../constants/routeNames'; const WIDTH = Dimensions.get('window').width; const CUSTOM_RENDERERS = { // example - //center: () => ugur, + // center: () => ugur, }; const DEFAULT_PROPS = { renderers: CUSTOM_RENDERERS, @@ -101,6 +99,26 @@ class PostBody extends PureComponent { if (node.name === 'img') { node.attribs.style = 'text-align: center;'; } + + if (node.name === 'div' && node.attribs && node.attribs.class) { + const _className = node.attribs.class; + + if (_className === 'pull-right') { + node.attribs.style = 'text-align: right;'; + } + + if (_className === 'pull-left') { + node.attribs.style = 'text-align: left;'; + } + + if (_className === 'text-justify') { + node.attribs.style = 'text-align: justify; text-justify: inter-word; letter-spacing: 1.2px;'; + } + + if (_className === 'phishy') { + node.attribs.style = 'color: red'; + } + } }; render() {