mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-28 07:55:08 +03:00
added rules for markdwon
This commit is contained in:
parent
dad00cc7bc
commit
130c9c2eed
@ -1,8 +1,8 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import {
|
import {
|
||||||
View, TextInput, KeyboardAvoidingView, ScrollView, FlatList,
|
View, TextInput, KeyboardAvoidingView, ScrollView, FlatList, Text,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import Markdown from 'react-native-markdown-renderer';
|
import Markdown, { getUniqueID } from 'react-native-markdown-renderer';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import Formats from './formats/formats';
|
import Formats from './formats/formats';
|
||||||
@ -63,11 +63,25 @@ export default class MarkdownEditorView extends Component {
|
|||||||
|
|
||||||
_renderPreview = () => {
|
_renderPreview = () => {
|
||||||
const { text } = this.state;
|
const { text } = this.state;
|
||||||
|
const rules = {
|
||||||
|
heading1: (node, children, parent, styles) => (
|
||||||
|
<Text key={getUniqueID()} style={styles.heading1}>
|
||||||
|
{children}
|
||||||
|
</Text>
|
||||||
|
),
|
||||||
|
heading2: (node, children, parent, styles) => (
|
||||||
|
<Text key={getUniqueID()} style={styles.heading2}>
|
||||||
|
{children}
|
||||||
|
</Text>
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.textWrapper}>
|
<View style={styles.textWrapper}>
|
||||||
<ScrollView removeClippedSubviews>
|
<ScrollView removeClippedSubviews>
|
||||||
<Markdown style={markdownStyle}>{text === '' ? '...' : text}</Markdown>
|
<Markdown rules={rules} style={markdownStyle}>
|
||||||
|
{text === '' ? '...' : text}
|
||||||
|
</Markdown>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
@ -6,7 +6,7 @@ export default EStyleSheet.create({
|
|||||||
fontFamily: 'Courier',
|
fontFamily: 'Courier',
|
||||||
fontWeight: '500',
|
fontWeight: '500',
|
||||||
marginLeft: 20,
|
marginLeft: 20,
|
||||||
color: '#788187',
|
color: '$primaryDarkGray',
|
||||||
},
|
},
|
||||||
del: {
|
del: {
|
||||||
backgroundColor: '#000000',
|
backgroundColor: '#000000',
|
||||||
@ -14,18 +14,22 @@ export default EStyleSheet.create({
|
|||||||
em: {
|
em: {
|
||||||
fontStyle: 'italic',
|
fontStyle: 'italic',
|
||||||
},
|
},
|
||||||
|
strong: {
|
||||||
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
text: {
|
text: {
|
||||||
fontSize: 10,
|
|
||||||
color: '#3c4449',
|
color: '#3c4449',
|
||||||
},
|
},
|
||||||
heading: {
|
heading1: {
|
||||||
fontSize: 32,
|
fontSize: 32,
|
||||||
color: 'purple',
|
color: '$primaryBlack',
|
||||||
|
},
|
||||||
|
heading2: {
|
||||||
|
fontSize: 24,
|
||||||
|
color: '$primaryBlack',
|
||||||
},
|
},
|
||||||
strikethrough: {
|
strikethrough: {
|
||||||
textDecorationLine: 'line-through',
|
textDecorationLine: 'line-through',
|
||||||
color: '#FF0000',
|
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
textDecorationLine: 'underline',
|
textDecorationLine: 'underline',
|
||||||
|
@ -77,6 +77,6 @@ export default createSwitchNavigator({
|
|||||||
stackNavigatior,
|
stackNavigatior,
|
||||||
[ROUTES.SCREENS.LOGIN]: { screen: RootComponent()(Login) },
|
[ROUTES.SCREENS.LOGIN]: { screen: RootComponent()(Login) },
|
||||||
[ROUTES.SCREENS.PINCODE]: { screen: RootComponent()(PinCode) },
|
[ROUTES.SCREENS.PINCODE]: { screen: RootComponent()(PinCode) },
|
||||||
[ROUTES.SCREENS.SPLASH]: { screen: Splash },
|
[ROUTES.SCREENS.SPLASH]: { screen: Editor },
|
||||||
[ROUTES.SCREENS.STEEM_CONNECT]: { screen: RootComponent()(SteemConnect) },
|
[ROUTES.SCREENS.STEEM_CONNECT]: { screen: RootComponent()(SteemConnect) },
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user