|
| 1 | +/** |
| 2 | + * Flowtype definitions for Clipboard |
| 3 | + * Generated by Flowgen from a Typescript Definition |
| 4 | + * Flowgen v1.11.0 |
| 5 | + * |
| 6 | + * @flow strict-local |
| 7 | + */ |
| 8 | + |
| 9 | +import type EmitterSubscription from 'react-native/Libraries/vendor/emitter/_EmitterSubscription'; |
| 10 | + |
| 11 | +/** |
| 12 | + * `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android |
| 13 | + */ |
| 14 | +declare var Clipboard: { |
| 15 | + /** |
| 16 | + * Get content of string type, this method returns a `Promise`, so you can use following code to get clipboard content |
| 17 | + * ```javascript |
| 18 | + * async _getContent() { |
| 19 | + * var content = await Clipboard.getString(); |
| 20 | + * } |
| 21 | + * ``` |
| 22 | + */ |
| 23 | + getString(): Promise<string>, |
| 24 | + |
| 25 | + /** |
| 26 | + * Get clipboard image as PNG in base64, this method returns a `Promise`, so you can use following code to get clipboard content |
| 27 | + * ```javascript |
| 28 | + * async _getContent() { |
| 29 | + * var content = await Clipboard.getImagePNG(); |
| 30 | + * } |
| 31 | + * ``` |
| 32 | + */ |
| 33 | + getImagePNG(): Promise<string>, |
| 34 | + |
| 35 | + /** |
| 36 | + * Get clipboard image as JPG in base64, this method returns a `Promise`, so you can use following code to get clipboard content |
| 37 | + * ```javascript |
| 38 | + * async _getContent() { |
| 39 | + * var content = await Clipboard.getImageJPG(); |
| 40 | + * } |
| 41 | + * ``` |
| 42 | + */ |
| 43 | + getImageJPG(): Promise<string>, |
| 44 | + |
| 45 | + /** |
| 46 | + * Set content of base64 image type. You can use following code to set clipboard content |
| 47 | + * ```javascript |
| 48 | + * _setContent() { |
| 49 | + * Clipboard.setImage(...); |
| 50 | + * } |
| 51 | + * |
| 52 | + * iOS only |
| 53 | + * ``` |
| 54 | + * @param the content to be stored in the clipboard. |
| 55 | + */ |
| 56 | + setImage(content: string): void, |
| 57 | + getImage(): Promise<string>, |
| 58 | + |
| 59 | + /** |
| 60 | + * Set content of string type. You can use following code to set clipboard content |
| 61 | + * ```javascript |
| 62 | + * _setContent() { |
| 63 | + * Clipboard.setString('hello world'); |
| 64 | + * } |
| 65 | + * ``` |
| 66 | + * @param the content to be stored in the clipboard. |
| 67 | + */ |
| 68 | + setString(content: string): void, |
| 69 | + |
| 70 | + /** |
| 71 | + * Returns whether the clipboard has content or is empty. |
| 72 | + * This method returns a `Promise`, so you can use following code to get clipboard content |
| 73 | + * ```javascript |
| 74 | + * async _hasContent() { |
| 75 | + * var hasContent = await Clipboard.hasString(); |
| 76 | + * } |
| 77 | + * ``` |
| 78 | + */ |
| 79 | + hasString(): $FlowFixMe, // `any` in TypeScript upstream :( |
| 80 | + |
| 81 | + /** |
| 82 | + * Returns whether the clipboard has an image or is empty. |
| 83 | + * This method returns a `Promise`, so you can use following code to check clipboard content |
| 84 | + * ```javascript |
| 85 | + * async _hasContent() { |
| 86 | + * var hasContent = await Clipboard.hasImage(); |
| 87 | + * } |
| 88 | + * ``` |
| 89 | + */ |
| 90 | + hasImage(): $FlowFixMe, // `any` in TypeScript upstream :( |
| 91 | + |
| 92 | + /** |
| 93 | + * (IOS Only) |
| 94 | + * Returns whether the clipboard has a URL content. Can check |
| 95 | + * if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+ |
| 96 | + * This method returns a `Promise`, so you can use following code to check for url content in clipboard. |
| 97 | + * ```javascript |
| 98 | + * async _hasURL() { |
| 99 | + * var hasURL = await Clipboard.hasURL(); |
| 100 | + * } |
| 101 | + * ``` |
| 102 | + */ |
| 103 | + hasURL(): $FlowFixMe, // `any` in TypeScript upstream :( |
| 104 | + |
| 105 | + /** |
| 106 | + * (IOS 14+ Only) |
| 107 | + * Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check |
| 108 | + * if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+ |
| 109 | + * This method returns a `Promise`, so you can use following code to check for Number content in clipboard. |
| 110 | + * ```javascript |
| 111 | + * async _hasNumber() { |
| 112 | + * var hasNumber = await Clipboard.hasNumber(); |
| 113 | + * } |
| 114 | + * ``` |
| 115 | + */ |
| 116 | + hasNumber(): $FlowFixMe, // `any` in TypeScript upstream :( |
| 117 | + |
| 118 | + /** |
| 119 | + * (IOS 14+ Only) |
| 120 | + * Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check |
| 121 | + * if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+ |
| 122 | + * This method returns a `Promise`, so you can use following code to check for WebURL content in clipboard. |
| 123 | + * ```javascript |
| 124 | + * async _hasWebURL() { |
| 125 | + * var hasWebURL = await Clipboard.hasWebURL(); |
| 126 | + * } |
| 127 | + * ``` |
| 128 | + */ |
| 129 | + hasWebURL(): $FlowFixMe, // `any` in TypeScript upstream :( |
| 130 | + |
| 131 | + /** |
| 132 | + * (iOS and Android Only) |
| 133 | + * Adds a listener to get notifications when the clipboard has changed. |
| 134 | + * If this is the first listener, turns on clipboard notifications on the native side. |
| 135 | + * It returns EmitterSubscription where you can call "remove" to remove listener |
| 136 | + * ```javascript |
| 137 | + * const listener = () => console.log("changed!"); |
| 138 | + * Clipboard.addListener(listener); |
| 139 | + * ``` |
| 140 | + */ |
| 141 | + addListener(callback: () => void): EmitterSubscription, |
| 142 | + |
| 143 | + /** |
| 144 | + * (iOS and Android Only) |
| 145 | + * Removes all previously registered listeners and turns off notifications on the native side. |
| 146 | + * ```javascript |
| 147 | + * Clipboard.removeAllListeners(); |
| 148 | + * ``` |
| 149 | + */ |
| 150 | + removeAllListeners(): void, |
| 151 | + ... |
| 152 | +}; |
| 153 | + |
| 154 | +export default Clipboard; |
0 commit comments