Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
RocketChat
Rocket.Chat.ReactNative
Commits
f3972ef4
Commit
f3972ef4
authored
Oct 04, 2019
by
Djorkaeff Alexandre
Committed by
Diego Mello
Oct 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Some issues on preview message (#1271)
parent
6fd722a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
21 deletions
+37
-21
app/containers/markdown/AtMention.js
app/containers/markdown/AtMention.js
+4
-3
app/containers/markdown/Hashtag.js
app/containers/markdown/Hashtag.js
+4
-3
app/containers/markdown/Link.js
app/containers/markdown/Link.js
+4
-3
app/containers/markdown/index.js
app/containers/markdown/index.js
+25
-12
No files found.
app/containers/markdown/AtMention.js
View file @
f3972ef4
...
...
@@ -5,7 +5,7 @@ import { Text } from 'react-native';
import
styles
from
'
./styles
'
;
const
AtMention
=
React
.
memo
(({
mention
,
mentions
,
username
,
navToRoomInfo
,
style
=
[]
mention
,
mentions
,
username
,
navToRoomInfo
,
preview
,
style
=
[]
})
=>
{
let
mentionStyle
=
styles
.
mention
;
if
(
mention
===
'
all
'
||
mention
===
'
here
'
)
{
...
...
@@ -33,8 +33,8 @@ const AtMention = React.memo(({
return
(
<
Text
style
=
{[
mentionStyle
,
...
style
]}
onPress
=
{
handlePress
}
style
=
{[
preview
?
styles
.
text
:
mentionStyle
,
...
style
]}
onPress
=
{
preview
?
undefined
:
handlePress
}
>
{
`@
${
mention
}
`
}
<
/Text
>
...
...
@@ -46,6 +46,7 @@ AtMention.propTypes = {
username
:
PropTypes
.
string
,
navToRoomInfo
:
PropTypes
.
func
,
style
:
PropTypes
.
array
,
preview
:
PropTypes
.
bool
,
mentions
:
PropTypes
.
oneOfType
([
PropTypes
.
array
,
PropTypes
.
object
])
};
...
...
app/containers/markdown/Hashtag.js
View file @
f3972ef4
...
...
@@ -5,7 +5,7 @@ import { Text } from 'react-native';
import
styles
from
'
./styles
'
;
const
Hashtag
=
React
.
memo
(({
hashtag
,
channels
,
navToRoomInfo
,
style
=
[]
hashtag
,
channels
,
navToRoomInfo
,
preview
,
style
=
[]
})
=>
{
const
handlePress
=
()
=>
{
const
index
=
channels
.
findIndex
(
channel
=>
channel
.
name
===
hashtag
);
...
...
@@ -19,8 +19,8 @@ const Hashtag = React.memo(({
if
(
channels
&&
channels
.
length
&&
channels
.
findIndex
(
channel
=>
channel
.
name
===
hashtag
)
!==
-
1
)
{
return
(
<
Text
style
=
{[
styles
.
mention
,
...
style
]}
onPress
=
{
handlePress
}
style
=
{[
preview
?
styles
.
text
:
styles
.
mention
,
...
style
]}
onPress
=
{
preview
?
undefined
:
handlePress
}
>
{
`#
${
hashtag
}
`
}
<
/Text
>
...
...
@@ -33,6 +33,7 @@ Hashtag.propTypes = {
hashtag
:
PropTypes
.
string
,
navToRoomInfo
:
PropTypes
.
func
,
style
:
PropTypes
.
array
,
preview
:
PropTypes
.
bool
,
channels
:
PropTypes
.
oneOfType
([
PropTypes
.
array
,
PropTypes
.
object
])
};
...
...
app/containers/markdown/Link.js
View file @
f3972ef4
...
...
@@ -6,7 +6,7 @@ import styles from './styles';
import
openLink
from
'
../../utils/openLink
'
;
const
Link
=
React
.
memo
(({
children
,
link
children
,
link
,
preview
})
=>
{
const
handlePress
=
()
=>
{
if
(
!
link
)
{
...
...
@@ -20,7 +20,7 @@ const Link = React.memo(({
// if you have a [](https://rocket.chat) render https://rocket.chat
return
(
<
Text
onPress
=
{
handlePress
}
onPress
=
{
preview
?
undefined
:
handlePress
}
style
=
{
styles
.
link
}
>
{
childLength
!==
0
?
children
:
link
}
...
...
@@ -30,7 +30,8 @@ const Link = React.memo(({
Link
.
propTypes
=
{
children
:
PropTypes
.
node
,
link
:
PropTypes
.
string
link
:
PropTypes
.
string
,
preview
:
PropTypes
.
bool
};
export
default
Link
;
app/containers/markdown/index.js
View file @
f3972ef4
...
...
@@ -180,19 +180,25 @@ export default class Markdown extends PureComponent {
);
};
renderLink
=
({
children
,
href
})
=>
(
<
MarkdownLink
link
=
{
href
}
>
{
children
}
<
/MarkdownLink
>
);
renderLink
=
({
children
,
href
})
=>
{
const
{
preview
}
=
this
.
props
;
return
(
<
MarkdownLink
link
=
{
href
}
preview
=
{
preview
}
>
{
children
}
<
/MarkdownLink
>
);
}
renderHashtag
=
({
hashtag
})
=>
{
const
{
channels
,
navToRoomInfo
,
style
}
=
this
.
props
;
const
{
channels
,
navToRoomInfo
,
style
,
preview
}
=
this
.
props
;
return
(
<
MarkdownHashtag
hashtag
=
{
hashtag
}
channels
=
{
channels
}
navToRoomInfo
=
{
navToRoomInfo
}
preview
=
{
preview
}
style
=
{
style
}
/
>
);
...
...
@@ -200,7 +206,7 @@ export default class Markdown extends PureComponent {
renderAtMention
=
({
mentionName
})
=>
{
const
{
username
,
mentions
,
navToRoomInfo
,
style
username
,
mentions
,
navToRoomInfo
,
preview
,
style
}
=
this
.
props
;
return
(
<
MarkdownAtMention
...
...
@@ -208,6 +214,7 @@ export default class Markdown extends PureComponent {
mention
=
{
mentionName
}
username
=
{
username
}
navToRoomInfo
=
{
navToRoomInfo
}
preview
=
{
preview
}
style
=
{
style
}
/
>
);
...
...
@@ -275,11 +282,17 @@ export default class Markdown extends PureComponent {
);
};
renderBlockQuote
=
({
children
})
=>
(
<
MarkdownBlockQuote
>
{
children
}
<
/MarkdownBlockQuote
>
);
renderBlockQuote
=
({
children
})
=>
{
const
{
preview
}
=
this
.
props
;
if
(
preview
)
{
return
children
;
}
return
(
<
MarkdownBlockQuote
>
{
children
}
<
/MarkdownBlockQuote
>
);
}
renderTable
=
({
children
,
numColumns
})
=>
(
<
MarkdownTable
numColumns
=
{
numColumns
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment