expo-watch 0.1.0 → 0.1.2
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/package.json +14 -2
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +0 -43
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/expo/modules/watch/ExpoWatchModule.kt +0 -47
- package/android/src/main/java/expo/modules/watch/ExpoWatchView.kt +0 -7
- package/build/ExpoWatch.types.d.ts +0 -7
- package/build/ExpoWatch.types.d.ts.map +0 -1
- package/build/ExpoWatch.types.js +0 -2
- package/build/ExpoWatch.types.js.map +0 -1
- package/build/ExpoWatchModule.d.ts +0 -3
- package/build/ExpoWatchModule.d.ts.map +0 -1
- package/build/ExpoWatchModule.js +0 -5
- package/build/ExpoWatchModule.js.map +0 -1
- package/build/ExpoWatchModule.web.d.ts +0 -7
- package/build/ExpoWatchModule.web.d.ts.map +0 -1
- package/build/ExpoWatchModule.web.js +0 -12
- package/build/ExpoWatchModule.web.js.map +0 -1
- package/build/ExpoWatchView.d.ts +0 -4
- package/build/ExpoWatchView.d.ts.map +0 -1
- package/build/ExpoWatchView.js +0 -7
- package/build/ExpoWatchView.js.map +0 -1
- package/build/ExpoWatchView.web.d.ts +0 -4
- package/build/ExpoWatchView.web.d.ts.map +0 -1
- package/build/ExpoWatchView.web.js +0 -7
- package/build/ExpoWatchView.web.js.map +0 -1
- package/build/index.d.ts +0 -9
- package/build/index.d.ts.map +0 -1
- package/build/index.js.map +0 -1
- package/expo-module.config.json +0 -9
- package/ios/ExpoWatch.podspec +0 -27
- package/ios/ExpoWatchModule.swift +0 -44
- package/ios/ExpoWatchView.swift +0 -7
- package/plugin/build/addBuildPhases.d.ts +0 -13
- package/plugin/build/addPbxGroup.d.ts +0 -5
- package/plugin/build/addProductFile.d.ts +0 -5
- package/plugin/build/addTargetDependency.d.ts +0 -4
- package/plugin/build/addToPbxNativeTargetSection.d.ts +0 -24
- package/plugin/build/addToPbxProjectSection.d.ts +0 -4
- package/plugin/build/addXCConfigurationList.d.ts +0 -9
- package/plugin/build/withWatchApp.d.ts +0 -11
- package/plugin/src/addBuildPhases.ts +0 -83
- package/plugin/src/addPbxGroup.ts +0 -31
- package/plugin/src/addProductFile.ts +0 -22
- package/plugin/src/addTargetDependency.ts +0 -17
- package/plugin/src/addToPbxNativeTargetSection.ts +0 -35
- package/plugin/src/addToPbxProjectSection.ts +0 -21
- package/plugin/src/addXCConfigurationList.ts +0 -37
- package/plugin/src/withWatchApp.ts +0 -79
- package/plugin/tsconfig.json +0 -9
- package/src/ExpoWatch.types.ts +0 -7
- package/src/ExpoWatchModule.ts +0 -5
- package/src/ExpoWatchModule.web.ts +0 -13
- package/src/ExpoWatchView.tsx +0 -11
- package/src/ExpoWatchView.web.tsx +0 -11
- package/src/index.ts +0 -26
- package/tsconfig.json +0 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-watch",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Watch companion app for iOS Expo app. ",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "expo-module build",
|
|
9
9
|
"clean": "expo-module clean",
|
|
10
10
|
"lint": "expo-module lint",
|
|
11
|
-
"test": "expo-module test",
|
|
11
|
+
"test": "echo \"No test yet. Eventualy run expo-module test\"",
|
|
12
12
|
"prepare": "expo-module prepare",
|
|
13
13
|
"prepublishOnly": "expo-module prepublishOnly",
|
|
14
14
|
"expo-module": "expo-module",
|
|
@@ -41,5 +41,17 @@
|
|
|
41
41
|
"react": "*",
|
|
42
42
|
"react-native": "*"
|
|
43
43
|
},
|
|
44
|
+
"files": [
|
|
45
|
+
"app.plugin.js",
|
|
46
|
+
"expo-module.config.js",
|
|
47
|
+
"plugin/build/addBuildPhases.js",
|
|
48
|
+
"plugin/build/addPbxGroup.js",
|
|
49
|
+
"plugin/build/addProductFile.js",
|
|
50
|
+
"plugin/build/addTargetDependency.js",
|
|
51
|
+
"plugin/build/addToPbxNativeTargetSection.js",
|
|
52
|
+
"plugin/build/addToPbxProjectSection.js",
|
|
53
|
+
"plugin/build/addXCConfigurationList.js",
|
|
54
|
+
"plugin/build/withWatchApp.js"
|
|
55
|
+
],
|
|
44
56
|
"packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
|
|
45
57
|
}
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
package/android/build.gradle
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
apply plugin: 'com.android.library'
|
|
2
|
-
|
|
3
|
-
group = 'expo.modules.watch'
|
|
4
|
-
version = '0.1.0'
|
|
5
|
-
|
|
6
|
-
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
|
-
apply from: expoModulesCorePlugin
|
|
8
|
-
applyKotlinExpoModulesCorePlugin()
|
|
9
|
-
useCoreDependencies()
|
|
10
|
-
useExpoPublishing()
|
|
11
|
-
|
|
12
|
-
// If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
|
|
13
|
-
// The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
|
|
14
|
-
// Most of the time, you may like to manage the Android SDK versions yourself.
|
|
15
|
-
def useManagedAndroidSdkVersions = false
|
|
16
|
-
if (useManagedAndroidSdkVersions) {
|
|
17
|
-
useDefaultAndroidSdkVersions()
|
|
18
|
-
} else {
|
|
19
|
-
buildscript {
|
|
20
|
-
// Simple helper that allows the root project to override versions declared by this library.
|
|
21
|
-
ext.safeExtGet = { prop, fallback ->
|
|
22
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
project.android {
|
|
26
|
-
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
27
|
-
defaultConfig {
|
|
28
|
-
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
29
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
android {
|
|
35
|
-
namespace "expo.modules.watch"
|
|
36
|
-
defaultConfig {
|
|
37
|
-
versionCode 1
|
|
38
|
-
versionName "0.1.0"
|
|
39
|
-
}
|
|
40
|
-
lintOptions {
|
|
41
|
-
abortOnError false
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
package expo.modules.watch
|
|
2
|
-
|
|
3
|
-
import expo.modules.kotlin.modules.Module
|
|
4
|
-
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
|
-
|
|
6
|
-
class ExpoWatchModule : Module() {
|
|
7
|
-
// Each module class must implement the definition function. The definition consists of components
|
|
8
|
-
// that describes the module's functionality and behavior.
|
|
9
|
-
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
|
10
|
-
override fun definition() = ModuleDefinition {
|
|
11
|
-
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
|
|
12
|
-
// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
|
|
13
|
-
// The module will be accessible from `requireNativeModule('ExpoWatch')` in JavaScript.
|
|
14
|
-
Name("ExpoWatch")
|
|
15
|
-
|
|
16
|
-
// Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary.
|
|
17
|
-
Constants(
|
|
18
|
-
"PI" to Math.PI
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
// Defines event names that the module can send to JavaScript.
|
|
22
|
-
Events("onChange")
|
|
23
|
-
|
|
24
|
-
// Defines a JavaScript synchronous function that runs the native code on the JavaScript thread.
|
|
25
|
-
Function("hello") {
|
|
26
|
-
"Hello world! 👋"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Defines a JavaScript function that always returns a Promise and whose native code
|
|
30
|
-
// is by default dispatched on the different thread than the JavaScript runtime runs on.
|
|
31
|
-
AsyncFunction("setValueAsync") { value: String ->
|
|
32
|
-
// Send an event to JavaScript.
|
|
33
|
-
sendEvent("onChange", mapOf(
|
|
34
|
-
"value" to value
|
|
35
|
-
))
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Enables the module to be used as a native view. Definition components that are accepted as part of
|
|
39
|
-
// the view definition: Prop, Events.
|
|
40
|
-
View(ExpoWatchView::class) {
|
|
41
|
-
// Defines a setter for the `name` prop.
|
|
42
|
-
Prop("name") { view: ExpoWatchView, prop: String ->
|
|
43
|
-
println(prop)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWatch.types.d.ts","sourceRoot":"","sources":["../src/ExpoWatch.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
package/build/ExpoWatch.types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWatch.types.js","sourceRoot":"","sources":["../src/ExpoWatch.types.ts"],"names":[],"mappings":"","sourcesContent":["export type ChangeEventPayload = {\n value: string;\n};\n\nexport type ExpoWatchViewProps = {\n name: string;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWatchModule.d.ts","sourceRoot":"","sources":["../src/ExpoWatchModule.ts"],"names":[],"mappings":";AAIA,wBAAgD"}
|
package/build/ExpoWatchModule.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
-
// It loads the native module object from the JSI or falls back to
|
|
3
|
-
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
|
|
4
|
-
export default requireNativeModule('ExpoWatch');
|
|
5
|
-
//# sourceMappingURL=ExpoWatchModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWatchModule.js","sourceRoot":"","sources":["../src/ExpoWatchModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,kEAAkE;AAClE,4EAA4E;AAC5E,eAAe,mBAAmB,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\n\n// It loads the native module object from the JSI or falls back to\n// the bridge module (from NativeModulesProxy) if the remote debugger is on.\nexport default requireNativeModule('ExpoWatch');\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWatchModule.web.d.ts","sourceRoot":"","sources":["../src/ExpoWatchModule.web.ts"],"names":[],"mappings":";;yBAM6B,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;;;AAFnD,wBAQE"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'expo-modules-core';
|
|
2
|
-
const emitter = new EventEmitter({});
|
|
3
|
-
export default {
|
|
4
|
-
PI: Math.PI,
|
|
5
|
-
async setValueAsync(value) {
|
|
6
|
-
emitter.emit('onChange', { value });
|
|
7
|
-
},
|
|
8
|
-
hello() {
|
|
9
|
-
return 'Hello world! 👋';
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=ExpoWatchModule.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWatchModule.web.js","sourceRoot":"","sources":["../src/ExpoWatchModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,EAAS,CAAC,CAAC;AAE5C,eAAe;IACb,EAAE,EAAE,IAAI,CAAC,EAAE;IACX,KAAK,CAAC,aAAa,CAAC,KAAa;QAC/B,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACtC,CAAC;IACD,KAAK;QACH,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF,CAAC","sourcesContent":["import { EventEmitter } from 'expo-modules-core';\n\nconst emitter = new EventEmitter({} as any);\n\nexport default {\n PI: Math.PI,\n async setValueAsync(value: string): Promise<void> {\n emitter.emit('onChange', { value });\n },\n hello() {\n return 'Hello world! 👋';\n },\n};\n"]}
|
package/build/ExpoWatchView.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWatchView.d.ts","sourceRoot":"","sources":["../src/ExpoWatchView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAKvD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBAE9D"}
|
package/build/ExpoWatchView.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { requireNativeViewManager } from 'expo-modules-core';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
const NativeView = requireNativeViewManager('ExpoWatch');
|
|
4
|
-
export default function ExpoWatchView(props) {
|
|
5
|
-
return <NativeView {...props}/>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=ExpoWatchView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWatchView.js","sourceRoot":"","sources":["../src/ExpoWatchView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,UAAU,GACd,wBAAwB,CAAC,WAAW,CAAC,CAAC;AAExC,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAyB;IAC7D,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACnC,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\n\nimport { ExpoWatchViewProps } from './ExpoWatch.types';\n\nconst NativeView: React.ComponentType<ExpoWatchViewProps> =\n requireNativeViewManager('ExpoWatch');\n\nexport default function ExpoWatchView(props: ExpoWatchViewProps) {\n return <NativeView {...props} />;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWatchView.web.d.ts","sourceRoot":"","sources":["../src/ExpoWatchView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBAM9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoWatchView.web.js","sourceRoot":"","sources":["../src/ExpoWatchView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAyB;IAC7D,OAAO,CACL,CAAC,GAAG,CACF;MAAA,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,CAC1B;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { ExpoWatchViewProps } from './ExpoWatch.types';\n\nexport default function ExpoWatchView(props: ExpoWatchViewProps) {\n return (\n <div>\n <span>{props.name}</span>\n </div>\n );\n}\n"]}
|
package/build/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Subscription } from 'expo-modules-core';
|
|
2
|
-
import ExpoWatchView from './ExpoWatchView';
|
|
3
|
-
import { ChangeEventPayload, ExpoWatchViewProps } from './ExpoWatch.types';
|
|
4
|
-
export declare const PI: any;
|
|
5
|
-
export declare function hello(): string;
|
|
6
|
-
export declare function setValueAsync(value: string): Promise<any>;
|
|
7
|
-
export declare function addChangeListener(listener: (event: ChangeEventPayload) => void): Subscription;
|
|
8
|
-
export { ExpoWatchView, ExpoWatchViewProps, ChangeEventPayload };
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKnF,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG3E,eAAO,MAAM,EAAE,KAAqB,CAAC;AAErC,wBAAgB,KAAK,IAAI,MAAM,CAE9B;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,gBAEhD;AAID,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAAG,YAAY,CAE7F;AAED,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC"}
|
package/build/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAEnF,4EAA4E;AAC5E,0CAA0C;AAC1C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C,iCAAiC;AACjC,MAAM,CAAC,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,CAAC;AAErC,MAAM,UAAU,KAAK;IACnB,OAAO,eAAe,CAAC,KAAK,EAAE,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAa;IAC/C,OAAO,MAAM,eAAe,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,eAAe,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAElF,MAAM,UAAU,iBAAiB,CAAC,QAA6C;IAC7E,OAAO,OAAO,CAAC,WAAW,CAAqB,UAAU,EAAE,QAAQ,CAAC,CAAC;AACvE,CAAC;AAED,OAAO,EAAE,aAAa,EAA0C,CAAC","sourcesContent":["import { NativeModulesProxy, EventEmitter, Subscription } from 'expo-modules-core';\n\n// Import the native module. On web, it will be resolved to ExpoWatch.web.ts\n// and on native platforms to ExpoWatch.ts\nimport ExpoWatchModule from './ExpoWatchModule';\nimport ExpoWatchView from './ExpoWatchView';\nimport { ChangeEventPayload, ExpoWatchViewProps } from './ExpoWatch.types';\n\n// Get the native constant value.\nexport const PI = ExpoWatchModule.PI;\n\nexport function hello(): string {\n return ExpoWatchModule.hello();\n}\n\nexport async function setValueAsync(value: string) {\n return await ExpoWatchModule.setValueAsync(value);\n}\n\nconst emitter = new EventEmitter(ExpoWatchModule ?? NativeModulesProxy.ExpoWatch);\n\nexport function addChangeListener(listener: (event: ChangeEventPayload) => void): Subscription {\n return emitter.addListener<ChangeEventPayload>('onChange', listener);\n}\n\nexport { ExpoWatchView, ExpoWatchViewProps, ChangeEventPayload };\n"]}
|
package/expo-module.config.json
DELETED
package/ios/ExpoWatch.podspec
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |s|
|
|
6
|
-
s.name = 'ExpoWatch'
|
|
7
|
-
s.version = package['version']
|
|
8
|
-
s.summary = package['description']
|
|
9
|
-
s.description = package['description']
|
|
10
|
-
s.license = package['license']
|
|
11
|
-
s.author = package['author']
|
|
12
|
-
s.homepage = package['homepage']
|
|
13
|
-
s.platforms = { :ios => '13.4', :tvos => '13.4' }
|
|
14
|
-
s.swift_version = '5.4'
|
|
15
|
-
s.source = { git: 'https://github.com/RobertSasak/expo-watch' }
|
|
16
|
-
s.static_framework = true
|
|
17
|
-
|
|
18
|
-
s.dependency 'ExpoModulesCore'
|
|
19
|
-
|
|
20
|
-
# Swift/Objective-C compatibility
|
|
21
|
-
s.pod_target_xcconfig = {
|
|
22
|
-
'DEFINES_MODULE' => 'YES',
|
|
23
|
-
'SWIFT_COMPILATION_MODE' => 'wholemodule'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
s.source_files = "**/*.{h,m,swift}"
|
|
27
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import ExpoModulesCore
|
|
2
|
-
|
|
3
|
-
public class ExpoWatchModule: Module {
|
|
4
|
-
// Each module class must implement the definition function. The definition consists of components
|
|
5
|
-
// that describes the module's functionality and behavior.
|
|
6
|
-
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
|
7
|
-
public func definition() -> ModuleDefinition {
|
|
8
|
-
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
|
|
9
|
-
// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
|
|
10
|
-
// The module will be accessible from `requireNativeModule('ExpoWatch')` in JavaScript.
|
|
11
|
-
Name("ExpoWatch")
|
|
12
|
-
|
|
13
|
-
// Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary.
|
|
14
|
-
Constants([
|
|
15
|
-
"PI": Double.pi
|
|
16
|
-
])
|
|
17
|
-
|
|
18
|
-
// Defines event names that the module can send to JavaScript.
|
|
19
|
-
Events("onChange")
|
|
20
|
-
|
|
21
|
-
// Defines a JavaScript synchronous function that runs the native code on the JavaScript thread.
|
|
22
|
-
Function("hello") {
|
|
23
|
-
return "Hello world! 👋"
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Defines a JavaScript function that always returns a Promise and whose native code
|
|
27
|
-
// is by default dispatched on the different thread than the JavaScript runtime runs on.
|
|
28
|
-
AsyncFunction("setValueAsync") { (value: String) in
|
|
29
|
-
// Send an event to JavaScript.
|
|
30
|
-
self.sendEvent("onChange", [
|
|
31
|
-
"value": value
|
|
32
|
-
])
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Enables the module to be used as a native view. Definition components that are accepted as part of the
|
|
36
|
-
// view definition: Prop, Events.
|
|
37
|
-
View(ExpoWatchView.self) {
|
|
38
|
-
// Defines a setter for the `name` prop.
|
|
39
|
-
Prop("name") { (view: ExpoWatchView, prop: String) in
|
|
40
|
-
print(prop)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
package/ios/ExpoWatchView.swift
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { XcodeProject } from '@expo/config-plugins';
|
|
2
|
-
export declare function addBuildPhases(xcodeProject: XcodeProject, { targetUuid, groupName, productFile, compileSources, copyBundleResources, }: {
|
|
3
|
-
targetUuid: string;
|
|
4
|
-
groupName: string;
|
|
5
|
-
productFile: {
|
|
6
|
-
uuid: string;
|
|
7
|
-
target: string;
|
|
8
|
-
basename: string;
|
|
9
|
-
group: string;
|
|
10
|
-
};
|
|
11
|
-
compileSources: string[];
|
|
12
|
-
copyBundleResources: string[];
|
|
13
|
-
}): void;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { XcodeProject } from '@expo/config-plugins';
|
|
2
|
-
export declare function addToPbxNativeTargetSection(xcodeProject: XcodeProject, { targetName, targetUuid, productFile, xCConfigurationList, }: {
|
|
3
|
-
targetName: string;
|
|
4
|
-
targetUuid: string;
|
|
5
|
-
productFile: {
|
|
6
|
-
fileRef: string;
|
|
7
|
-
};
|
|
8
|
-
xCConfigurationList: {
|
|
9
|
-
uuid: string;
|
|
10
|
-
};
|
|
11
|
-
}): {
|
|
12
|
-
uuid: string;
|
|
13
|
-
pbxNativeTarget: {
|
|
14
|
-
isa: string;
|
|
15
|
-
buildConfigurationList: string;
|
|
16
|
-
buildPhases: never[];
|
|
17
|
-
buildRules: never[];
|
|
18
|
-
dependencies: never[];
|
|
19
|
-
name: string;
|
|
20
|
-
productName: string;
|
|
21
|
-
productReference: string;
|
|
22
|
-
productType: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { XcodeProject } from '@expo/config-plugins';
|
|
2
|
-
interface BuildSettigs {
|
|
3
|
-
[key: string]: string | number;
|
|
4
|
-
}
|
|
5
|
-
export declare function addXCConfigurationList(xcodeProject: XcodeProject, { targetName, buildSettings, }: {
|
|
6
|
-
targetName: string;
|
|
7
|
-
buildSettings: BuildSettigs;
|
|
8
|
-
}): any;
|
|
9
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
-
declare const withWatchApp: ConfigPlugin<{
|
|
3
|
-
targetName?: string;
|
|
4
|
-
groupName?: string;
|
|
5
|
-
setVersionFromCompanionApp?: boolean;
|
|
6
|
-
buildSettings?: Record<string, string | number>;
|
|
7
|
-
files?: string[];
|
|
8
|
-
compileSources?: string[];
|
|
9
|
-
copyBundleResources?: string[];
|
|
10
|
-
}>;
|
|
11
|
-
export default withWatchApp;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { XcodeProject } from '@expo/config-plugins'
|
|
2
|
-
import util from 'util'
|
|
3
|
-
|
|
4
|
-
export function addBuildPhases(
|
|
5
|
-
xcodeProject: XcodeProject,
|
|
6
|
-
{
|
|
7
|
-
targetUuid,
|
|
8
|
-
groupName,
|
|
9
|
-
productFile,
|
|
10
|
-
compileSources,
|
|
11
|
-
copyBundleResources,
|
|
12
|
-
}: {
|
|
13
|
-
targetUuid: string
|
|
14
|
-
groupName: string
|
|
15
|
-
productFile: {
|
|
16
|
-
uuid: string
|
|
17
|
-
target: string
|
|
18
|
-
basename: string
|
|
19
|
-
group: string
|
|
20
|
-
}
|
|
21
|
-
compileSources: string[]
|
|
22
|
-
copyBundleResources: string[]
|
|
23
|
-
},
|
|
24
|
-
) {
|
|
25
|
-
const buildPath = `"$(CONTENTS_FOLDER_PATH)/Watch"`
|
|
26
|
-
const folderType = 'watch2_app'
|
|
27
|
-
|
|
28
|
-
// Sources build phase
|
|
29
|
-
xcodeProject.addBuildPhase(
|
|
30
|
-
compileSources,
|
|
31
|
-
'PBXSourcesBuildPhase',
|
|
32
|
-
groupName,
|
|
33
|
-
targetUuid,
|
|
34
|
-
folderType,
|
|
35
|
-
buildPath,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
// Copy files build phase
|
|
39
|
-
xcodeProject.addBuildPhase(
|
|
40
|
-
[],
|
|
41
|
-
'PBXCopyFilesBuildPhase',
|
|
42
|
-
groupName,
|
|
43
|
-
xcodeProject.getFirstTarget().uuid,
|
|
44
|
-
folderType,
|
|
45
|
-
buildPath,
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
xcodeProject
|
|
49
|
-
.buildPhaseObject(
|
|
50
|
-
'PBXCopyFilesBuildPhase',
|
|
51
|
-
groupName,
|
|
52
|
-
productFile.target,
|
|
53
|
-
)
|
|
54
|
-
.files.push({
|
|
55
|
-
value: productFile.uuid,
|
|
56
|
-
comment: util.format(
|
|
57
|
-
'%s in %s',
|
|
58
|
-
productFile.basename,
|
|
59
|
-
productFile.group,
|
|
60
|
-
), // longComment(file);
|
|
61
|
-
})
|
|
62
|
-
xcodeProject.addToPbxBuildFileSection(productFile)
|
|
63
|
-
|
|
64
|
-
// Frameworks build phase
|
|
65
|
-
xcodeProject.addBuildPhase(
|
|
66
|
-
[],
|
|
67
|
-
'PBXFrameworksBuildPhase',
|
|
68
|
-
groupName,
|
|
69
|
-
targetUuid,
|
|
70
|
-
folderType,
|
|
71
|
-
buildPath,
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
// Resources build phase
|
|
75
|
-
xcodeProject.addBuildPhase(
|
|
76
|
-
copyBundleResources,
|
|
77
|
-
'PBXResourcesBuildPhase',
|
|
78
|
-
groupName,
|
|
79
|
-
targetUuid,
|
|
80
|
-
folderType,
|
|
81
|
-
buildPath,
|
|
82
|
-
)
|
|
83
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { XcodeProject } from '@expo/config-plugins'
|
|
2
|
-
|
|
3
|
-
export function addPbxGroup(
|
|
4
|
-
xcodeProject: XcodeProject,
|
|
5
|
-
|
|
6
|
-
{
|
|
7
|
-
targetName,
|
|
8
|
-
files,
|
|
9
|
-
}: {
|
|
10
|
-
targetName: string
|
|
11
|
-
files: string[]
|
|
12
|
-
},
|
|
13
|
-
) {
|
|
14
|
-
const { uuid: pbxGroupUuid } = xcodeProject.addPbxGroup(
|
|
15
|
-
files,
|
|
16
|
-
`"${targetName}"`,
|
|
17
|
-
`"../${targetName}"`,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
const groups = xcodeProject.hash.project.objects['PBXGroup']
|
|
21
|
-
if (pbxGroupUuid) {
|
|
22
|
-
Object.keys(groups).forEach(function (key) {
|
|
23
|
-
if (
|
|
24
|
-
groups[key].name === undefined &&
|
|
25
|
-
groups[key].path === undefined
|
|
26
|
-
) {
|
|
27
|
-
xcodeProject.addToPbxGroup(pbxGroupUuid, key)
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { XcodeProject } from '@expo/config-plugins'
|
|
2
|
-
|
|
3
|
-
export function addProductFile(
|
|
4
|
-
xcodeProject: XcodeProject,
|
|
5
|
-
{ targetName, groupName }: { targetName: string; groupName: string },
|
|
6
|
-
) {
|
|
7
|
-
const options = {
|
|
8
|
-
basename: `${targetName}`,
|
|
9
|
-
group: groupName,
|
|
10
|
-
explicitFileType: 'wrapper.application',
|
|
11
|
-
settings: {
|
|
12
|
-
ATTRIBUTES: ['RemoveHeadersOnCopy'],
|
|
13
|
-
},
|
|
14
|
-
includeInIndex: 0,
|
|
15
|
-
path: `${targetName}`,
|
|
16
|
-
sourceTree: 'BUILT_PRODUCTS_DIR',
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const productFile = xcodeProject.addProductFile(targetName, options)
|
|
20
|
-
|
|
21
|
-
return productFile
|
|
22
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { XcodeProject } from '@expo/config-plugins'
|
|
2
|
-
|
|
3
|
-
export function addTargetDependency(
|
|
4
|
-
xcodeProject: XcodeProject,
|
|
5
|
-
target: { uuid: string },
|
|
6
|
-
) {
|
|
7
|
-
if (!xcodeProject.hash.project.objects['PBXTargetDependency']) {
|
|
8
|
-
xcodeProject.hash.project.objects['PBXTargetDependency'] = {}
|
|
9
|
-
}
|
|
10
|
-
if (!xcodeProject.hash.project.objects['PBXContainerItemProxy']) {
|
|
11
|
-
xcodeProject.hash.project.objects['PBXContainerItemProxy'] = {}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
xcodeProject.addTargetDependency(xcodeProject.getFirstTarget().uuid, [
|
|
15
|
-
target.uuid,
|
|
16
|
-
])
|
|
17
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { XcodeProject } from '@expo/config-plugins'
|
|
2
|
-
|
|
3
|
-
export function addToPbxNativeTargetSection(
|
|
4
|
-
xcodeProject: XcodeProject,
|
|
5
|
-
{
|
|
6
|
-
targetName,
|
|
7
|
-
targetUuid,
|
|
8
|
-
productFile,
|
|
9
|
-
xCConfigurationList,
|
|
10
|
-
}: {
|
|
11
|
-
targetName: string
|
|
12
|
-
targetUuid: string
|
|
13
|
-
productFile: { fileRef: string }
|
|
14
|
-
xCConfigurationList: { uuid: string }
|
|
15
|
-
},
|
|
16
|
-
) {
|
|
17
|
-
const target = {
|
|
18
|
-
uuid: targetUuid,
|
|
19
|
-
pbxNativeTarget: {
|
|
20
|
-
isa: 'PBXNativeTarget',
|
|
21
|
-
buildConfigurationList: xCConfigurationList.uuid,
|
|
22
|
-
buildPhases: [],
|
|
23
|
-
buildRules: [],
|
|
24
|
-
dependencies: [],
|
|
25
|
-
name: `"${targetName}"`,
|
|
26
|
-
productName: `"${targetName}"`,
|
|
27
|
-
productReference: productFile.fileRef,
|
|
28
|
-
productType: `"com.apple.product-type.application"`,
|
|
29
|
-
},
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
xcodeProject.addToPbxNativeTargetSection(target)
|
|
33
|
-
|
|
34
|
-
return target
|
|
35
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { XcodeProject } from '@expo/config-plugins'
|
|
2
|
-
|
|
3
|
-
export function addToPbxProjectSection(
|
|
4
|
-
xcodeProject: XcodeProject,
|
|
5
|
-
target: { uuid: string },
|
|
6
|
-
) {
|
|
7
|
-
xcodeProject.addToPbxProjectSection(target)
|
|
8
|
-
if (
|
|
9
|
-
!xcodeProject.pbxProjectSection()[xcodeProject.getFirstProject().uuid]
|
|
10
|
-
.attributes.TargetAttributes
|
|
11
|
-
) {
|
|
12
|
-
xcodeProject.pbxProjectSection()[
|
|
13
|
-
xcodeProject.getFirstProject().uuid
|
|
14
|
-
].attributes.TargetAttributes = {}
|
|
15
|
-
}
|
|
16
|
-
xcodeProject.pbxProjectSection()[
|
|
17
|
-
xcodeProject.getFirstProject().uuid
|
|
18
|
-
].attributes.TargetAttributes[target.uuid] = {
|
|
19
|
-
LastSwiftMigration: 1250,
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { XcodeProject } from '@expo/config-plugins'
|
|
2
|
-
|
|
3
|
-
interface BuildSettigs {
|
|
4
|
-
[key: string]: string | number
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function addXCConfigurationList(
|
|
8
|
-
xcodeProject: XcodeProject,
|
|
9
|
-
{
|
|
10
|
-
targetName,
|
|
11
|
-
buildSettings,
|
|
12
|
-
}: {
|
|
13
|
-
targetName: string
|
|
14
|
-
buildSettings: BuildSettigs
|
|
15
|
-
},
|
|
16
|
-
) {
|
|
17
|
-
const buildConfigurationsList = [
|
|
18
|
-
{
|
|
19
|
-
isa: 'XCBuildConfiguration',
|
|
20
|
-
buildSettings,
|
|
21
|
-
name: 'Debug',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
isa: 'XCBuildConfiguration',
|
|
25
|
-
buildSettings,
|
|
26
|
-
name: 'Release',
|
|
27
|
-
},
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
const xCConfigurationList = xcodeProject.addXCConfigurationList(
|
|
31
|
-
buildConfigurationsList,
|
|
32
|
-
'Release',
|
|
33
|
-
`Build configuration list for PBXNativeTarget "${targetName}"`,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
return xCConfigurationList
|
|
37
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins'
|
|
2
|
-
|
|
3
|
-
import { addBuildPhases } from './addBuildPhases'
|
|
4
|
-
import { addPbxGroup } from './addPbxGroup'
|
|
5
|
-
import { addProductFile } from './addProductFile'
|
|
6
|
-
import { addTargetDependency } from './addTargetDependency'
|
|
7
|
-
import { addToPbxNativeTargetSection } from './addToPbxNativeTargetSection'
|
|
8
|
-
import { addToPbxProjectSection } from './addToPbxProjectSection'
|
|
9
|
-
import { addXCConfigurationList } from './addXCConfigurationList'
|
|
10
|
-
|
|
11
|
-
const withWatchApp: ConfigPlugin<{
|
|
12
|
-
targetName?: string
|
|
13
|
-
groupName?: string
|
|
14
|
-
setVersionFromCompanionApp?: boolean
|
|
15
|
-
buildSettings?: Record<string, string | number>
|
|
16
|
-
files?: string[]
|
|
17
|
-
compileSources?: string[]
|
|
18
|
-
copyBundleResources?: string[]
|
|
19
|
-
}> = (
|
|
20
|
-
config,
|
|
21
|
-
{
|
|
22
|
-
targetName = 'Sample Watch App',
|
|
23
|
-
groupName = 'Embed Watch Content',
|
|
24
|
-
setVersionFromCompanionApp = true,
|
|
25
|
-
buildSettings = {},
|
|
26
|
-
files = [],
|
|
27
|
-
compileSources = [],
|
|
28
|
-
copyBundleResources = [],
|
|
29
|
-
} = {},
|
|
30
|
-
) => {
|
|
31
|
-
return withXcodeProject(config, (config) => {
|
|
32
|
-
const version = config.version ?? '1.0.0'
|
|
33
|
-
const xcodeProject = config.modResults
|
|
34
|
-
|
|
35
|
-
const targetUuid = xcodeProject.generateUuid()
|
|
36
|
-
|
|
37
|
-
const xCConfigurationList = addXCConfigurationList(xcodeProject, {
|
|
38
|
-
targetName,
|
|
39
|
-
buildSettings: {
|
|
40
|
-
...buildSettings,
|
|
41
|
-
...(setVersionFromCompanionApp
|
|
42
|
-
? { MARKETING_VERSION: version }
|
|
43
|
-
: undefined),
|
|
44
|
-
},
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
const productFile = addProductFile(xcodeProject, {
|
|
48
|
-
targetName,
|
|
49
|
-
groupName,
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
const target = addToPbxNativeTargetSection(xcodeProject, {
|
|
53
|
-
targetName,
|
|
54
|
-
targetUuid,
|
|
55
|
-
productFile,
|
|
56
|
-
xCConfigurationList,
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
addTargetDependency(xcodeProject, target)
|
|
60
|
-
addToPbxProjectSection(xcodeProject, target)
|
|
61
|
-
|
|
62
|
-
addPbxGroup(xcodeProject, {
|
|
63
|
-
targetName,
|
|
64
|
-
files,
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
addBuildPhases(xcodeProject, {
|
|
68
|
-
targetUuid,
|
|
69
|
-
groupName,
|
|
70
|
-
productFile,
|
|
71
|
-
compileSources,
|
|
72
|
-
copyBundleResources,
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
return config
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export default withWatchApp
|
package/plugin/tsconfig.json
DELETED
package/src/ExpoWatch.types.ts
DELETED
package/src/ExpoWatchModule.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'expo-modules-core';
|
|
2
|
-
|
|
3
|
-
const emitter = new EventEmitter({} as any);
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
PI: Math.PI,
|
|
7
|
-
async setValueAsync(value: string): Promise<void> {
|
|
8
|
-
emitter.emit('onChange', { value });
|
|
9
|
-
},
|
|
10
|
-
hello() {
|
|
11
|
-
return 'Hello world! 👋';
|
|
12
|
-
},
|
|
13
|
-
};
|
package/src/ExpoWatchView.tsx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { requireNativeViewManager } from 'expo-modules-core';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
import { ExpoWatchViewProps } from './ExpoWatch.types';
|
|
5
|
-
|
|
6
|
-
const NativeView: React.ComponentType<ExpoWatchViewProps> =
|
|
7
|
-
requireNativeViewManager('ExpoWatch');
|
|
8
|
-
|
|
9
|
-
export default function ExpoWatchView(props: ExpoWatchViewProps) {
|
|
10
|
-
return <NativeView {...props} />;
|
|
11
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { NativeModulesProxy, EventEmitter, Subscription } from 'expo-modules-core';
|
|
2
|
-
|
|
3
|
-
// Import the native module. On web, it will be resolved to ExpoWatch.web.ts
|
|
4
|
-
// and on native platforms to ExpoWatch.ts
|
|
5
|
-
import ExpoWatchModule from './ExpoWatchModule';
|
|
6
|
-
import ExpoWatchView from './ExpoWatchView';
|
|
7
|
-
import { ChangeEventPayload, ExpoWatchViewProps } from './ExpoWatch.types';
|
|
8
|
-
|
|
9
|
-
// Get the native constant value.
|
|
10
|
-
export const PI = ExpoWatchModule.PI;
|
|
11
|
-
|
|
12
|
-
export function hello(): string {
|
|
13
|
-
return ExpoWatchModule.hello();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function setValueAsync(value: string) {
|
|
17
|
-
return await ExpoWatchModule.setValueAsync(value);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const emitter = new EventEmitter(ExpoWatchModule ?? NativeModulesProxy.ExpoWatch);
|
|
21
|
-
|
|
22
|
-
export function addChangeListener(listener: (event: ChangeEventPayload) => void): Subscription {
|
|
23
|
-
return emitter.addListener<ChangeEventPayload>('onChange', listener);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { ExpoWatchView, ExpoWatchViewProps, ChangeEventPayload };
|