@sigx/lynx-share 0.1.2 → 0.4.1
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/README.md
CHANGED
|
@@ -8,14 +8,7 @@ Native share dialog for sigx-lynx. `UIActivityViewController` on iOS, `Intent.AC
|
|
|
8
8
|
pnpm add @sigx/lynx-share
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
// sigx.lynx.config.ts
|
|
13
|
-
export default defineLynxConfig({
|
|
14
|
-
modules: ['@sigx/lynx-share'],
|
|
15
|
-
});
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
No special permissions on either platform.
|
|
11
|
+
`sigx prebuild` auto-discovers and links the native module. No special permissions on either platform.
|
|
19
12
|
|
|
20
13
|
## Usage
|
|
21
14
|
|
|
@@ -8,7 +8,7 @@ import com.lynx.react.bridge.ReadableMap
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Native share dialog module.
|
|
11
|
-
* JS usage: NativeModules.Share.share({ title: "Check this out",
|
|
11
|
+
* JS usage: NativeModules.Share.share({ title: "Check this out", message: "Hello!", url: "https://..." })
|
|
12
12
|
*/
|
|
13
13
|
class ShareModule(context: Context) : LynxModule(context) {
|
|
14
14
|
|
|
@@ -17,7 +17,13 @@ class ShareModule(context: Context) : LynxModule(context) {
|
|
|
17
17
|
if (options == null) return
|
|
18
18
|
|
|
19
19
|
val title = if (options.hasKey("title")) options.getString("title") else null
|
|
20
|
-
|
|
20
|
+
// `message` is the canonical key (matches the TS API); `text` is
|
|
21
|
+
// accepted as a back-compat alias from older callers.
|
|
22
|
+
val text = when {
|
|
23
|
+
options.hasKey("message") -> options.getString("message")
|
|
24
|
+
options.hasKey("text") -> options.getString("text")
|
|
25
|
+
else -> null
|
|
26
|
+
}
|
|
21
27
|
val url = if (options.hasKey("url")) options.getString("url") else null
|
|
22
28
|
|
|
23
29
|
val shareText = buildString {
|
package/dist/share.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface ShareOptions {
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
export declare const Share: {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
share(options: ShareOptions): void;
|
|
18
|
+
isAvailable(): boolean;
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=share.d.ts.map
|
package/dist/share.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../src/share.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK;
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../src/share.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK;IACd,KAAK,UAAU,YAAY,GAAG,IAAI;IAIlC,WAAW,IAAI,OAAO;CAGhB,CAAC"}
|
package/ios/ShareModule.swift
CHANGED
|
@@ -2,7 +2,7 @@ import UIKit
|
|
|
2
2
|
import Lynx
|
|
3
3
|
|
|
4
4
|
/// Native share dialog module.
|
|
5
|
-
/// JS usage: NativeModules.Share.share({ title: "Check this",
|
|
5
|
+
/// JS usage: NativeModules.Share.share({ title: "Check this", message: "Hello!", url: "https://..." })
|
|
6
6
|
class ShareModule: NSObject, LynxModule {
|
|
7
7
|
|
|
8
8
|
@objc static var name: String { "Share" }
|
|
@@ -20,7 +20,9 @@ class ShareModule: NSObject, LynxModule {
|
|
|
20
20
|
guard let options = options else { return }
|
|
21
21
|
|
|
22
22
|
let title = options["title"] as? String
|
|
23
|
-
|
|
23
|
+
// `message` is the canonical key (matches the TS API); `text` is
|
|
24
|
+
// accepted as a back-compat alias from older callers.
|
|
25
|
+
let text = (options["message"] as? String) ?? (options["text"] as? String)
|
|
24
26
|
let urlString = options["url"] as? String
|
|
25
27
|
|
|
26
28
|
var items: [Any] = []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigx/lynx-share",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Native share dialog for sigx-lynx",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,18 +10,19 @@
|
|
|
10
10
|
"import": "./dist/index.js",
|
|
11
11
|
"types": "./dist/index.d.ts"
|
|
12
12
|
},
|
|
13
|
-
"./
|
|
13
|
+
"./signalx-module.json": "./signalx-module.json"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"ios",
|
|
18
18
|
"android",
|
|
19
|
-
"
|
|
19
|
+
"signalx-module.json"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@sigx/lynx-core": "^0.1
|
|
22
|
+
"@sigx/lynx-core": "^0.4.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@typescript/native-preview": "7.0.0-dev.20260511.1",
|
|
25
26
|
"typescript": "^6.0.3"
|
|
26
27
|
},
|
|
27
28
|
"author": "Andreas Ekdahl",
|
|
@@ -48,7 +49,8 @@
|
|
|
48
49
|
"share"
|
|
49
50
|
],
|
|
50
51
|
"scripts": {
|
|
51
|
-
"build": "
|
|
52
|
-
"dev": "
|
|
52
|
+
"build": "node ../../scripts/clean.mjs dist && tsgo",
|
|
53
|
+
"dev": "tsgo --watch",
|
|
54
|
+
"clean": "node ../../scripts/clean.mjs dist .turbo"
|
|
53
55
|
}
|
|
54
56
|
}
|
|
File without changes
|