[IMPROVEMENT] Hold URL to copy (#1684)
This commit is contained in:
parent
4a63cb01e2
commit
91518a1bc4
|
@ -0,0 +1,8 @@
|
||||||
|
export class Client { }
|
||||||
|
|
||||||
|
export default {
|
||||||
|
bugsnag: () => '',
|
||||||
|
leaveBreadcrumb: () => '',
|
||||||
|
notify: () => '',
|
||||||
|
loggerConfig: () => ''
|
||||||
|
};
|
|
@ -0,0 +1,3 @@
|
||||||
|
export default {
|
||||||
|
analytics: null
|
||||||
|
};
|
|
@ -27460,6 +27460,7 @@ exports[`Storyshots Message list message 1`] = `
|
||||||
Support
|
Support
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
|
onLongPress={[Function]}
|
||||||
onPress={[Function]}
|
onPress={[Function]}
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
|
@ -27531,6 +27532,7 @@ exports[`Storyshots Message list message 1`] = `
|
||||||
|
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
|
onLongPress={[Function]}
|
||||||
onPress={[Function]}
|
onPress={[Function]}
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
|
@ -27666,6 +27668,7 @@ exports[`Storyshots Message list message 1`] = `
|
||||||
|
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
|
onLongPress={[Function]}
|
||||||
onPress={[Function]}
|
onPress={[Function]}
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Text } from 'react-native';
|
import { Text, Clipboard } from 'react-native';
|
||||||
|
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
import { themes } from '../../constants/colors';
|
import { themes } from '../../constants/colors';
|
||||||
import openLink from '../../utils/openLink';
|
import openLink from '../../utils/openLink';
|
||||||
|
import { LISTENER } from '../Toast';
|
||||||
|
import EventEmitter from '../../utils/events';
|
||||||
|
import I18n from '../../i18n';
|
||||||
|
|
||||||
const Link = React.memo(({
|
const Link = React.memo(({
|
||||||
children, link, preview, theme
|
children, link, preview, theme
|
||||||
|
@ -17,11 +20,16 @@ const Link = React.memo(({
|
||||||
};
|
};
|
||||||
|
|
||||||
const childLength = React.Children.toArray(children).filter(o => o).length;
|
const childLength = React.Children.toArray(children).filter(o => o).length;
|
||||||
|
const onLongPress = () => {
|
||||||
|
Clipboard.setString(link);
|
||||||
|
EventEmitter.emit(LISTENER, { message: I18n.t('Copied_to_clipboard') });
|
||||||
|
};
|
||||||
|
|
||||||
// if you have a [](https://rocket.chat) render https://rocket.chat
|
// if you have a [](https://rocket.chat) render https://rocket.chat
|
||||||
return (
|
return (
|
||||||
<Text
|
<Text
|
||||||
onPress={preview ? undefined : handlePress}
|
onPress={preview ? undefined : handlePress}
|
||||||
|
onLongPress={preview ? undefined : onLongPress}
|
||||||
style={
|
style={
|
||||||
!preview
|
!preview
|
||||||
? { ...styles.link, color: themes[theme].actionTintColor }
|
? { ...styles.link, color: themes[theme].actionTintColor }
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { View, Text, StyleSheet } from 'react-native';
|
import {
|
||||||
|
View, Text, StyleSheet, Clipboard
|
||||||
|
} from 'react-native';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import FastImage from 'react-native-fast-image';
|
import FastImage from 'react-native-fast-image';
|
||||||
import Touchable from 'react-native-platform-touchable';
|
import Touchable from 'react-native-platform-touchable';
|
||||||
|
@ -10,6 +12,9 @@ import sharedStyles from '../../views/Styles';
|
||||||
import { themes } from '../../constants/colors';
|
import { themes } from '../../constants/colors';
|
||||||
import { withTheme } from '../../theme';
|
import { withTheme } from '../../theme';
|
||||||
import { withSplit } from '../../split';
|
import { withSplit } from '../../split';
|
||||||
|
import { LISTENER } from '../Toast';
|
||||||
|
import EventEmitter from '../../utils/events';
|
||||||
|
import I18n from '../../i18n';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
button: {
|
button: {
|
||||||
|
@ -82,9 +87,15 @@ const Url = React.memo(({
|
||||||
|
|
||||||
const onPress = () => openLink(url.url, theme);
|
const onPress = () => openLink(url.url, theme);
|
||||||
|
|
||||||
|
const onLongPress = () => {
|
||||||
|
Clipboard.setString(url.url);
|
||||||
|
EventEmitter.emit(LISTENER, { message: I18n.t('Copied_to_clipboard') });
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Touchable
|
<Touchable
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
|
onLongPress={onLongPress}
|
||||||
style={[
|
style={[
|
||||||
styles.button,
|
styles.button,
|
||||||
index > 0 && styles.marginTop,
|
index > 0 && styles.marginTop,
|
||||||
|
|
Loading…
Reference in New Issue