Add markdown and emoji support
This commit is contained in:
parent
4c5adc5dc9
commit
038e28c40b
|
@ -2,6 +2,8 @@ import React from 'react';
|
|||
import PropTypes from 'prop-types';
|
||||
import { View, Text, StyleSheet } from 'react-native';
|
||||
import { CachedImage } from 'react-native-img-cache';
|
||||
import Markdown from 'react-native-easy-markdown';
|
||||
import { emojify } from 'react-emojione';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
message: {
|
||||
|
@ -46,6 +48,8 @@ export default class Message extends React.PureComponent {
|
|||
extraStyle.opacity = 0.3;
|
||||
}
|
||||
|
||||
const msg = emojify(this.props.item.msg || 'asd', { output: 'unicode' });
|
||||
|
||||
return (
|
||||
<View style={[styles.message, extraStyle]}>
|
||||
<View style={styles.avatarContainer}>
|
||||
|
@ -55,12 +59,9 @@ export default class Message extends React.PureComponent {
|
|||
<Text onPress={this._onPress} style={styles.username}>
|
||||
{this.props.item.u.username}
|
||||
</Text>
|
||||
<Text style={styles.msg}>
|
||||
{this.props.item.msg}
|
||||
</Text>
|
||||
{/* <Markdown whitelist={['link', 'url']}>
|
||||
{this.props.item.msg}
|
||||
</Markdown> */}
|
||||
<Markdown>
|
||||
{msg}
|
||||
</Markdown>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Text, View, FlatList, StyleSheet } from 'react-native';
|
||||
// import Markdown from 'react-native-simple-markdown';
|
||||
import realm from '../lib/realm';
|
||||
import RocketChat from '../lib/rocketchat';
|
||||
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
"dependencies": {
|
||||
"prop-types": "^15.5.10",
|
||||
"react": "16.0.0-alpha.12",
|
||||
"react-emojione": "^3.1.10",
|
||||
"react-native": "0.46.1",
|
||||
"react-native-easy-markdown": "git+https://github.com/lappalj4/react-native-easy-markdown.git",
|
||||
"react-native-fetch-blob": "^0.10.8",
|
||||
"react-native-img-cache": "^1.4.0",
|
||||
"react-native-meteor": "^1.1.0",
|
||||
|
|
Loading…
Reference in New Issue