Change the js signature to be Promise based and dynamically detect it used as a callback
Summary: Making the default people see when they look at the module the Promise based version public Reviewed By: davidaurelio Differential Revision: D2850048 fb-gh-sync-id: e0815983ed798c202047cb071e65ce63a52fd1af
This commit is contained in:
parent
c888e6583f
commit
747be0bf5c
|
@ -28,6 +28,7 @@ var ClipboardExample = React.createClass({
|
|||
content: 'Content will appear here'
|
||||
};
|
||||
},
|
||||
|
||||
async _setClipboardContent(){
|
||||
Clipboard.setString('Hello World');
|
||||
try {
|
||||
|
@ -36,8 +37,8 @@ var ClipboardExample = React.createClass({
|
|||
} catch (e) {
|
||||
this.setState({content:e.message});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
|
|
|
@ -23,10 +23,10 @@ module.exports = {
|
|||
* var content = await Clipboard.getString();
|
||||
* }
|
||||
* ```
|
||||
* @param this parameter is deprecated. callback is function with one argument of string type
|
||||
*/
|
||||
getString(callback) {
|
||||
if (callback) {
|
||||
getString() {
|
||||
if (arguments.length > 0) {
|
||||
let callback = arguments[0];
|
||||
console.warn('Clipboard.getString(callback) is deprecated. Use the returned Promise instead');
|
||||
Clipboard.getString().then(callback);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue