Skip to content

Commit

Permalink
Merge pull request #10540 from Expensify/andrew-clippy
Browse files Browse the repository at this point in the history
Wrap setString instead of using Clipboard object

(cherry picked from commit a06404b)
  • Loading branch information
AndrewGable authored and OSBotify committed Aug 24, 2022
1 parent a0f9e60 commit 938b7ad
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/libs/Clipboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,17 @@ const setHtml = (html, text) => {
]);
};

/**
* Sets a string on the Clipboard object via react-native-web
*
* @param {String} text
*/
const setString = (text) => {
Clipboard.setString(text);
};

export default {
...Clipboard,
setString,
canSetHtml,
setHtml,
};
11 changes: 10 additions & 1 deletion src/libs/Clipboard/index.native.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import Clipboard from '@react-native-community/clipboard';

/**
* Sets a string on the Clipboard object via @react-native-community/clipboard
*
* @param {String} text
*/
const setString = (text) => {
Clipboard.setString(text);
};

export default {
...Clipboard,
setString,

// We don't want to set HTML on native platforms so noop them.
canSetHtml: () => false,
Expand Down

0 comments on commit 938b7ad

Please sign in to comment.