expo-clipboard 4.5.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,20 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 4.7.0 — 2023-10-17
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
18
+
19
+ ### 💡 Others
20
+
21
+ - Ship untranspiled JSX to support custom handling of `jsx` and `createElement`. ([#24889](https://github.com/expo/expo/pull/24889) by [@EvanBacon](https://github.com/EvanBacon))
22
+
23
+ ## 4.6.0 — 2023-09-15
24
+
25
+ _This version does not introduce any user-facing changes._
26
+
13
27
  ## 4.5.0 — 2023-09-04
14
28
 
15
29
  ### 🎉 New features
package/README.md CHANGED
@@ -13,12 +13,25 @@
13
13
 
14
14
  Please refer to the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/clipboard/).
15
15
 
16
- ## Installation
16
+
17
+ ## Installation in bare React Native projects
18
+
19
+ For bare React Native projects, ensure you've [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/).
20
+
21
+ ### Add the package to your npm dependencies
17
22
 
18
23
  ```
19
24
  npx expo install expo-clipboard
20
25
  ```
21
26
 
27
+ ### Configure for iOS
28
+
29
+ Run `npx pod-install` after installing the library.
30
+
31
+ ### Configure for Android
32
+
33
+ No additional set up necessary.
34
+
22
35
  ## Contributing
23
36
 
24
37
  Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).
@@ -3,15 +3,20 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '4.5.0'
6
+ version = '4.7.0'
7
7
 
8
- buildscript {
9
- def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
10
- if (expoModulesCorePlugin.exists()) {
11
- apply from: expoModulesCorePlugin
12
- applyKotlinExpoModulesCorePlugin()
8
+ def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
+ if (expoModulesCorePlugin.exists()) {
10
+ apply from: expoModulesCorePlugin
11
+ applyKotlinExpoModulesCorePlugin()
12
+ // Remove this check, but keep the contents after SDK49 support is dropped
13
+ if (safeExtGet("expoProvidesDefaultConfig", false)) {
14
+ useExpoPublishing()
15
+ useCoreDependencies()
13
16
  }
17
+ }
14
18
 
19
+ buildscript {
15
20
  // Simple helper that allows the root project to override versions declared by this library.
16
21
  ext.safeExtGet = { prop, fallback ->
17
22
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
@@ -35,23 +40,44 @@ buildscript {
35
40
  }
36
41
  }
37
42
 
38
- afterEvaluate {
39
- publishing {
40
- publications {
41
- release(MavenPublication) {
42
- from components.release
43
+ // Remove this if and it's contents, when support for SDK49 is dropped
44
+ if (!safeExtGet("expoProvidesDefaultConfig", false)) {
45
+ afterEvaluate {
46
+ publishing {
47
+ publications {
48
+ release(MavenPublication) {
49
+ from components.release
50
+ }
43
51
  }
44
- }
45
- repositories {
46
- maven {
47
- url = mavenLocal().url
52
+ repositories {
53
+ maven {
54
+ url = mavenLocal().url
55
+ }
48
56
  }
49
57
  }
50
58
  }
51
59
  }
52
60
 
53
61
  android {
54
- compileSdkVersion safeExtGet("compileSdkVersion", 33)
62
+ // Remove this if and it's contents, when support for SDK49 is dropped
63
+ if (!safeExtGet("expoProvidesDefaultConfig", false)) {
64
+ compileSdkVersion safeExtGet("compileSdkVersion", 33)
65
+
66
+ defaultConfig {
67
+ minSdkVersion safeExtGet("minSdkVersion", 23)
68
+ targetSdkVersion safeExtGet("targetSdkVersion", 33)
69
+ }
70
+
71
+ publishing {
72
+ singleVariant("release") {
73
+ withSourcesJar()
74
+ }
75
+ }
76
+
77
+ lintOptions {
78
+ abortOnError false
79
+ }
80
+ }
55
81
 
56
82
  def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
57
83
  if (agpVersion.tokenize('.')[0].toInteger() < 8) {
@@ -67,18 +93,8 @@ android {
67
93
 
68
94
  namespace "expo.modules.clipboard"
69
95
  defaultConfig {
70
- minSdkVersion safeExtGet("minSdkVersion", 21)
71
- targetSdkVersion safeExtGet("targetSdkVersion", 33)
72
96
  versionCode 3
73
- versionName '4.5.0'
74
- }
75
- lintOptions {
76
- abortOnError false
77
- }
78
- publishing {
79
- singleVariant("release") {
80
- withSourcesJar()
81
- }
97
+ versionName '4.7.0'
82
98
  }
83
99
  }
84
100
 
@@ -87,8 +103,11 @@ repositories {
87
103
  }
88
104
 
89
105
  dependencies {
90
- implementation project(':expo-modules-core')
91
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
106
+ // Remove this if and it's contents, when support for SDK49 is dropped
107
+ if (!safeExtGet("expoProvidesDefaultConfig", false)) {
108
+ implementation project(':expo-modules-core')
109
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
110
+ }
92
111
  implementation "androidx.core:core-ktx:1.6.0"
93
112
  implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1")
94
113
  implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2")
@@ -8,13 +8,11 @@ import android.content.pm.ProviderInfo
8
8
  import android.database.Cursor
9
9
  import android.database.MatrixCursor
10
10
  import android.net.Uri
11
- import android.os.Build
12
11
  import android.os.Environment
13
12
  import android.os.ParcelFileDescriptor
14
13
  import android.provider.OpenableColumns
15
14
  import android.text.TextUtils
16
15
  import android.webkit.MimeTypeMap
17
- import androidx.annotation.RequiresApi
18
16
  import androidx.core.content.FileProvider
19
17
  import org.xmlpull.v1.XmlPullParser.END_DOCUMENT
20
18
  import org.xmlpull.v1.XmlPullParser.START_TAG
@@ -38,7 +36,6 @@ import java.io.IOException
38
36
  *
39
37
  * For usage details, see [FileProvider] documentation
40
38
  */
41
- @RequiresApi(Build.VERSION_CODES.KITKAT)
42
39
  class ClipboardFileProvider : ContentProvider() {
43
40
  private val defaultProjectionColumns = arrayOf(OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE)
44
41
 
@@ -28,6 +28,6 @@ export function ClipboardPasteButton({ onPress, ...restProps }) {
28
28
  const onPastePressed = ({ nativeEvent }) => {
29
29
  onPress(nativeEvent);
30
30
  };
31
- return React.createElement(ExpoClipboardPasteButton, { onPastePressed: onPastePressed, ...restProps });
31
+ return <ExpoClipboardPasteButton onPastePressed={onPastePressed} {...restProps}/>;
32
32
  }
33
33
  //# sourceMappingURL=ClipboardPasteButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClipboardPasteButton.js","sourceRoot":"","sources":["../src/ClipboardPasteButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE,cAAc;AACd;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,oBAAoB,CAAC,EAAE,OAAO,EAAE,GAAG,SAAS,EAA6B;IACvF,IAAI,CAAC,wBAAwB,EAAE;QAC7B,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;SACtD;QACD,OAAO,IAAI,CAAC;KACb;IAED,MAAM,cAAc,GAAG,CAAC,EAAE,WAAW,EAA2C,EAAE,EAAE;QAClF,OAAO,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC,CAAC;IAEF,OAAO,oBAAC,wBAAwB,IAAC,cAAc,EAAE,cAAc,KAAM,SAAS,GAAI,CAAC;AACrF,CAAC","sourcesContent":["import React from 'react';\nimport { NativeSyntheticEvent } from 'react-native';\n\nimport { ClipboardPasteButtonProps, PasteEventPayload } from './Clipboard.types';\nimport ExpoClipboardPasteButton from './ExpoClipboardPasteButton';\n\n// @needsAudit\n/**\n * This component displays the `UIPasteControl` button on your screen. This allows pasting from the clipboard without requesting permission from the user.\n *\n * You should only attempt to render this if [`Clipboard.isPasteButtonAvailable`](#ispastebuttonavailable)\n * is `true`. This component will render nothing if it is not available, and you will get\n * a warning in development mode (`__DEV__ === true`).\n *\n * The properties of this component extend from `View`; however, you should not attempt to set\n * `backgroundColor`, `color` or `borderRadius` with the `style` property. Apple restricts customisation of this view.\n * Instead, you should use the backgroundColor and foregroundColor properties to set the colors of the button, the cornerStyle property to change the border radius,\n * and the displayMode property to change the appearance of the icon and label. The word \"Paste\" is not editable and neither is the icon.\n *\n * Make sure to attach height and width via the style props as without these styles, the button will\n * not appear on the screen.\n *\n * @see [Apple Documentation](https://developer.apple.com/documentation/uikit/uipastecontrol) for more details.\n */\nexport function ClipboardPasteButton({ onPress, ...restProps }: ClipboardPasteButtonProps) {\n if (!ExpoClipboardPasteButton) {\n if (__DEV__) {\n console.warn(\"'ApplePasteButton' is not available.\");\n }\n return null;\n }\n\n const onPastePressed = ({ nativeEvent }: NativeSyntheticEvent<PasteEventPayload>) => {\n onPress(nativeEvent);\n };\n\n return <ExpoClipboardPasteButton onPastePressed={onPastePressed} {...restProps} />;\n}\n"]}
1
+ {"version":3,"file":"ClipboardPasteButton.js","sourceRoot":"","sources":["../src/ClipboardPasteButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE,cAAc;AACd;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,oBAAoB,CAAC,EAAE,OAAO,EAAE,GAAG,SAAS,EAA6B;IACvF,IAAI,CAAC,wBAAwB,EAAE;QAC7B,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;SACtD;QACD,OAAO,IAAI,CAAC;KACb;IAED,MAAM,cAAc,GAAG,CAAC,EAAE,WAAW,EAA2C,EAAE,EAAE;QAClF,OAAO,CAAC,WAAW,CAAC,CAAC;IACvB,CAAC,CAAC;IAEF,OAAO,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;AACrF,CAAC","sourcesContent":["import React from 'react';\nimport { NativeSyntheticEvent } from 'react-native';\n\nimport { ClipboardPasteButtonProps, PasteEventPayload } from './Clipboard.types';\nimport ExpoClipboardPasteButton from './ExpoClipboardPasteButton';\n\n// @needsAudit\n/**\n * This component displays the `UIPasteControl` button on your screen. This allows pasting from the clipboard without requesting permission from the user.\n *\n * You should only attempt to render this if [`Clipboard.isPasteButtonAvailable`](#ispastebuttonavailable)\n * is `true`. This component will render nothing if it is not available, and you will get\n * a warning in development mode (`__DEV__ === true`).\n *\n * The properties of this component extend from `View`; however, you should not attempt to set\n * `backgroundColor`, `color` or `borderRadius` with the `style` property. Apple restricts customisation of this view.\n * Instead, you should use the backgroundColor and foregroundColor properties to set the colors of the button, the cornerStyle property to change the border radius,\n * and the displayMode property to change the appearance of the icon and label. The word \"Paste\" is not editable and neither is the icon.\n *\n * Make sure to attach height and width via the style props as without these styles, the button will\n * not appear on the screen.\n *\n * @see [Apple Documentation](https://developer.apple.com/documentation/uikit/uipastecontrol) for more details.\n */\nexport function ClipboardPasteButton({ onPress, ...restProps }: ClipboardPasteButtonProps) {\n if (!ExpoClipboardPasteButton) {\n if (__DEV__) {\n console.warn(\"'ApplePasteButton' is not available.\");\n }\n return null;\n }\n\n const onPastePressed = ({ nativeEvent }: NativeSyntheticEvent<PasteEventPayload>) => {\n onPress(nativeEvent);\n };\n\n return <ExpoClipboardPasteButton onPastePressed={onPastePressed} {...restProps} />;\n}\n"]}
@@ -11,7 +11,7 @@ class ClipboardModuleSpec: ExpoSpec {
11
11
  let holder = ModuleHolder(appContext: appContext, module: ClipboardModule(appContext: appContext))
12
12
 
13
13
  func testModuleFunction<T>(_ functionName: String, args: [Any], _ block: @escaping (T?) -> Void) {
14
- waitUntil(timeout: .seconds(2)) { done in
14
+ waitUntil(timeout: .seconds(3)) { done in
15
15
  holder.call(function: functionName, args: args) { result in
16
16
  let value = try! result.get()
17
17
  expect(value).to(beAKindOf(T?.self))
@@ -22,7 +22,7 @@ class ClipboardModuleSpec: ExpoSpec {
22
22
  }
23
23
 
24
24
  func expectModuleFunctionThrows<T>(_ functionName: String, args: [Any], exception: T.Type) where T: Exception {
25
- waitUntil(timeout: .seconds(2)) { done in
25
+ waitUntil(timeout: .seconds(3)) { done in
26
26
  holder.call(function: functionName, args: args) { result in
27
27
  expect(result).to(beFailure(exception: exception))
28
28
  done()
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Automatically generated by expo-modules-test-core.
3
+ *
4
+ * This autogenerated file provides a mock for native Expo module,
5
+ * and works out of the box with the expo jest preset.
6
+ * */
7
+ export type GetStringOptions = any;
8
+ export type SetStringOptions = any;
9
+ export type URL = any;
10
+ export type GetImageOptions = any;
11
+ export async function getStringAsync(options: GetStringOptions): Promise<string> {
12
+ return '';
13
+ }
14
+ export async function setStringAsync(
15
+ content: string | undefined,
16
+ options: SetStringOptions
17
+ ): Promise<boolean> {
18
+ return false;
19
+ }
20
+ export async function hasStringAsync(): Promise<boolean> {
21
+ return false;
22
+ }
23
+ export async function getUrlAsync(): Promise<string | undefined> {
24
+ return '';
25
+ }
26
+ export async function setUrlAsync(url: URL): Promise<any> {}
27
+ export async function hasUrlAsync(): Promise<boolean> {
28
+ return false;
29
+ }
30
+ export async function setImageAsync(content: string): Promise<any> {}
31
+ export async function hasImageAsync(): Promise<boolean> {
32
+ return false;
33
+ }
34
+ export async function getImageAsync(options: GetImageOptions): Promise<
35
+ | {
36
+ [key: string]: any;
37
+ }
38
+ | undefined
39
+ > {
40
+ return {};
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-clipboard",
3
- "version": "4.5.0",
3
+ "version": "4.7.0",
4
4
  "description": "ExpoClipboard standalone module",
5
5
  "main": "build/Clipboard.js",
6
6
  "types": "build/Clipboard.d.ts",
@@ -39,5 +39,5 @@
39
39
  "jest": {
40
40
  "preset": "expo-module-scripts/universal"
41
41
  },
42
- "gitHead": "79607a7325f47aa17c36d266100d09a4ff2cc544"
42
+ "gitHead": "da25937e2a99661cbe5eb60ca1d8d6245fc96a50"
43
43
  }