Fixed some issues for markdown

This commit is contained in:
Mustafa Buyukcelebi 2019-11-23 00:02:38 +03:00
parent e7222c8436
commit 7671c655f0
5 changed files with 57 additions and 22 deletions

View File

@ -19,10 +19,12 @@ import WalletDetailsPlaceHolder from './view/placeHolder/walletDetailsPlaceHolde
import WalletUnclaimedPlaceHolder from './view/placeHolder/walletUnclaimedPlaceHolder';
import ListPlaceHolder from './view/placeHolder/listPlaceHolderView';
import BoostPlaceHolder from './view/placeHolder/boostPlaceHolderView';
import CommentPlaceHolder from './view/placeHolder/commentPlaceHolderView';
export {
Card,
Chip,
CommentPlaceHolder,
GrayWrapper,
LineBreak,
ListItemPlaceHolder,

View File

@ -0,0 +1,35 @@
import React from 'react';
import { View } from 'react-native';
import Placeholder from 'rn-placeholder';
import { ThemeContainer } from '../../../../containers';
import styles from './listItemPlaceHolderStyles';
const CommentPlaceHolderView = () => {
return (
<ThemeContainer>
{({ isDarkTheme }) => {
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
return (
<View style={styles.container}>
<View style={styles.paragraphWithoutMargin}>
<Placeholder.Paragraph
color={color}
lineNumber={3}
textSize={12}
lineSpacing={8}
width="100%"
lastLineWidth="70%"
firstLineWidth="50%"
animate="fade"
/>
</View>
</View>
);
}}
</ThemeContainer>
);
};
export default CommentPlaceHolderView;

View File

@ -16,4 +16,7 @@ export default EStyleSheet.create({
marginTop: 3,
flex: 1,
},
paragraphWithoutMargin: {
flex: 1,
},
});

View File

@ -7,7 +7,7 @@ import EStyleSheet from 'react-native-extended-stylesheet';
import get from 'lodash/get';
import script from './config.js';
import {PostPlaceHolder, ListItemPlaceHolder} from '../../../basicUIElements';
import { PostPlaceHolder, CommentPlaceHolder } from '../../../basicUIElements';
// Constants
import { default as ROUTES } from '../../../../constants/routeNames';
@ -32,16 +32,7 @@ const PostBody = ({
try {
const data = JSON.parse(get(event, 'nativeEvent.data'));
const {
type,
href,
author,
category,
permlink,
tag,
proposal,
videoHref,
} = data;
const { type, href, author, category, permlink, tag, proposal, videoHref } = data;
switch (type) {
case '_external':
@ -137,6 +128,8 @@ const PostBody = ({
}
body {
color: ${EStyleSheet.value('$primaryBlack')};
display: flex;
align-items: center;
}
a {
color: ${EStyleSheet.value('$primaryBlue')};
@ -218,14 +211,14 @@ const PostBody = ({
source={{
html: test,
}}
style={{width: WIDTH - 32}}
style={{ width: isComment ? WIDTH - 61 : WIDTH - 32 }}
customStyle={customStyle}
onMessage={_handleOnLinkPress}
renderLoading={() =>
isComment ? <ListItemPlaceHolder /> : <PostPlaceHolder />
}
customScript={script.toString()}
renderLoading={() => (isComment ? <CommentPlaceHolder /> : <PostPlaceHolder />)}
startInLoadingState={true}
onShouldStartLoadWithRequest={false}
scrollEnabled={false}
/>
</Fragment>
);

View File

@ -162,7 +162,9 @@ class PostDisplayView extends PureComponent {
const isGetComment = scrollHeight + 300 > postHeight;
const formatedTime = post && getTimeFromNow(post.created);
if (isGetComment && !isLoadedComments) this.setState({ isLoadedComments: true });
if (isGetComment && !isLoadedComments) {
this.setState({ isLoadedComments: true });
}
if (isPostUnavailable) {
return (