@rn-bridge-tools/expo 0.0.8 → 0.0.10
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/dist/WebViewBridge.d.ts +2 -2
- package/dist/WebViewBridge.d.ts.map +1 -1
- package/dist/handlers/location.d.ts.map +1 -1
- package/dist/index.d.ts +21 -21
- package/dist/index.d.ts.map +1 -1
- package/package.json +10 -2
- package/src/WebViewBridge.tsx +1 -1
- package/src/createHandlers.ts +17 -17
- package/src/handlers/location.ts +11 -0
- package/src/index.ts +21 -21
package/dist/WebViewBridge.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WebViewProps } from 'react-native-webview';
|
|
3
3
|
import type { BridgeToolsAction, BridgeToolsEvents, BridgeToolsEvent } from '@rn-bridge-tools/core';
|
|
4
|
-
import type { HandlerFn, HandlerMap } from './createHandlers
|
|
4
|
+
import type { HandlerFn, HandlerMap } from './createHandlers';
|
|
5
5
|
export interface WebViewBridgeProps extends Omit<WebViewProps, 'ref'> {
|
|
6
6
|
handlers: HandlerMap;
|
|
7
7
|
customHandlers?: Partial<Record<BridgeToolsAction, HandlerFn>>;
|
|
@@ -13,7 +13,7 @@ export declare function createBridgeWebView(handlers: HandlerMap, customHandlers
|
|
|
13
13
|
postMessage: <EventName extends string | number | symbol, Args extends EventName extends string | number | symbol ? import("@webview-bridge/react-native").ParserSchema<any>[EventName]["validate"] extends (data: unknown) => unknown ? ReturnType<import("@webview-bridge/react-native").ParserSchema<any>[EventName]["validate"]> : import("@webview-bridge/react-native").Primitive | Record<string, import("@webview-bridge/react-native").Primitive> : never>(eventName: EventName, args: Args, options?: {
|
|
14
14
|
broadcast: boolean;
|
|
15
15
|
}) => void;
|
|
16
|
-
WebView: React.ForwardRefExoticComponent<import("react-native-webview/lib/WebViewTypes
|
|
16
|
+
WebView: React.ForwardRefExoticComponent<import("react-native-webview/lib/WebViewTypes").IOSWebViewProps & import("react-native-webview/lib/WebViewTypes").AndroidWebViewProps & import("react-native-webview/lib/WebViewTypes").WindowsWebViewProps & React.RefAttributes<import("@webview-bridge/react-native").BridgeWebView>>;
|
|
17
17
|
linkWebMethod<T>(): {
|
|
18
18
|
current: import("@webview-bridge/react-native").WebMethod<T>;
|
|
19
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebViewBridge.d.ts","sourceRoot":"","sources":["../src/WebViewBridge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEpG,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"WebViewBridge.d.ts","sourceRoot":"","sources":["../src/WebViewBridge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEpG,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC;IACnE,QAAQ,EAAE,UAAU,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,CAAC,CAAC,SAAS,gBAAgB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CAClF;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,UAAU,EACpB,cAAc,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;;;;;;;;EAgB/D;AAED,eAAO,MAAM,aAAa,6FAqBzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../src/handlers/location.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../src/handlers/location.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAiC/D,eAAO,MAAM,gBAAgB;qCAEhB,iBAAiB,CAAC,qBAAqB,CAAC,CAAC,SAAS,CAAC,KAC3D,OAAO,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC,UAAU,CAAC,CAAC;qCAgCrD,iBAAiB,CAAC,qBAAqB,CAAC,CAAC,SAAS,CAAC,KAC3D,OAAO,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC,UAAU,CAAC,CAAC;oCAmCrD,iBAAiB,CAAC,oBAAoB,CAAC,CAAC,SAAS,CAAC,KAC1D,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC,UAAU,CAAC,CAAC;CAShE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export { WebViewBridge, createBridgeWebView } from './WebViewBridge
|
|
2
|
-
export type { WebViewBridgeProps, WebViewBridgeRef } from './WebViewBridge
|
|
3
|
-
export { createDefaultHandlers } from './createHandlers
|
|
4
|
-
export type { HandlerFn, HandlerMap } from './createHandlers
|
|
5
|
-
export { cameraHandlers } from './handlers/camera
|
|
6
|
-
export { locationHandlers } from './handlers/location
|
|
7
|
-
export { fileHandlers } from './handlers/file
|
|
8
|
-
export { shareHandlers } from './handlers/share
|
|
9
|
-
export { deviceHandlers } from './handlers/device
|
|
10
|
-
export { statusbarHandlers } from './handlers/statusbar
|
|
11
|
-
export { keyboardHandlers } from './handlers/keyboard
|
|
12
|
-
export { hapticHandlers } from './handlers/haptic
|
|
13
|
-
export { clipboardHandlers } from './handlers/clipboard
|
|
14
|
-
export { scannerHandlers } from './handlers/scanner
|
|
15
|
-
export { authHandlers } from './handlers/auth
|
|
16
|
-
export { iapHandlers } from './handlers/iap
|
|
17
|
-
export { pushHandlers } from './handlers/push
|
|
18
|
-
export { permissionHandlers } from './handlers/permission
|
|
19
|
-
export { preferenceHandlers } from './handlers/preference
|
|
20
|
-
export { navigationHandlers } from './handlers/navigation
|
|
21
|
-
export { browserHandlers } from './handlers/browser
|
|
1
|
+
export { WebViewBridge, createBridgeWebView } from './WebViewBridge';
|
|
2
|
+
export type { WebViewBridgeProps, WebViewBridgeRef } from './WebViewBridge';
|
|
3
|
+
export { createDefaultHandlers } from './createHandlers';
|
|
4
|
+
export type { HandlerFn, HandlerMap } from './createHandlers';
|
|
5
|
+
export { cameraHandlers } from './handlers/camera';
|
|
6
|
+
export { locationHandlers } from './handlers/location';
|
|
7
|
+
export { fileHandlers } from './handlers/file';
|
|
8
|
+
export { shareHandlers } from './handlers/share';
|
|
9
|
+
export { deviceHandlers } from './handlers/device';
|
|
10
|
+
export { statusbarHandlers } from './handlers/statusbar';
|
|
11
|
+
export { keyboardHandlers } from './handlers/keyboard';
|
|
12
|
+
export { hapticHandlers } from './handlers/haptic';
|
|
13
|
+
export { clipboardHandlers } from './handlers/clipboard';
|
|
14
|
+
export { scannerHandlers } from './handlers/scanner';
|
|
15
|
+
export { authHandlers } from './handlers/auth';
|
|
16
|
+
export { iapHandlers } from './handlers/iap';
|
|
17
|
+
export { pushHandlers } from './handlers/push';
|
|
18
|
+
export { permissionHandlers } from './handlers/permission';
|
|
19
|
+
export { preferenceHandlers } from './handlers/preference';
|
|
20
|
+
export { navigationHandlers } from './handlers/navigation';
|
|
21
|
+
export { browserHandlers } from './handlers/browser';
|
|
22
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACrE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rn-bridge-tools/expo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Expo/React Native WebView bridge component and handlers for bridge-tools",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@rn-bridge-tools/core": "0.0.
|
|
18
|
+
"@rn-bridge-tools/core": "0.0.10"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@react-native-async-storage/async-storage": "*",
|
|
22
|
+
"@react-native-community/netinfo": "*",
|
|
22
23
|
"@webview-bridge/react-native": ">=1.0.0",
|
|
24
|
+
"expo-battery": "*",
|
|
23
25
|
"expo-camera": "*",
|
|
24
26
|
"expo-clipboard": "*",
|
|
25
27
|
"expo-device": "*",
|
|
@@ -79,6 +81,12 @@
|
|
|
79
81
|
},
|
|
80
82
|
"@react-native-async-storage/async-storage": {
|
|
81
83
|
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"@react-native-community/netinfo": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"expo-battery": {
|
|
89
|
+
"optional": true
|
|
82
90
|
}
|
|
83
91
|
},
|
|
84
92
|
"devDependencies": {
|
package/src/WebViewBridge.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { bridge, createWebView } from '@webview-bridge/react-native';
|
|
|
3
3
|
import type { WebViewProps } from 'react-native-webview';
|
|
4
4
|
import type { BridgeToolsAction, BridgeToolsEvents, BridgeToolsEvent } from '@rn-bridge-tools/core';
|
|
5
5
|
|
|
6
|
-
import type { HandlerFn, HandlerMap } from './createHandlers
|
|
6
|
+
import type { HandlerFn, HandlerMap } from './createHandlers';
|
|
7
7
|
|
|
8
8
|
export interface WebViewBridgeProps extends Omit<WebViewProps, 'ref'> {
|
|
9
9
|
handlers: HandlerMap;
|
package/src/createHandlers.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { HandlerOptions } from '@rn-bridge-tools/core';
|
|
2
|
-
import { cameraHandlers } from './handlers/camera
|
|
3
|
-
import { locationHandlers } from './handlers/location
|
|
4
|
-
import { fileHandlers } from './handlers/file
|
|
5
|
-
import { shareHandlers } from './handlers/share
|
|
6
|
-
import { deviceHandlers } from './handlers/device
|
|
7
|
-
import { statusbarHandlers } from './handlers/statusbar
|
|
8
|
-
import { keyboardHandlers } from './handlers/keyboard
|
|
9
|
-
import { hapticHandlers } from './handlers/haptic
|
|
10
|
-
import { clipboardHandlers } from './handlers/clipboard
|
|
11
|
-
import { scannerHandlers } from './handlers/scanner
|
|
12
|
-
import { authHandlers } from './handlers/auth
|
|
13
|
-
import { iapHandlers } from './handlers/iap
|
|
14
|
-
import { pushHandlers } from './handlers/push
|
|
15
|
-
import { permissionHandlers } from './handlers/permission
|
|
16
|
-
import { preferenceHandlers } from './handlers/preference
|
|
17
|
-
import { navigationHandlers } from './handlers/navigation
|
|
18
|
-
import { browserHandlers } from './handlers/browser
|
|
2
|
+
import { cameraHandlers } from './handlers/camera';
|
|
3
|
+
import { locationHandlers } from './handlers/location';
|
|
4
|
+
import { fileHandlers } from './handlers/file';
|
|
5
|
+
import { shareHandlers } from './handlers/share';
|
|
6
|
+
import { deviceHandlers } from './handlers/device';
|
|
7
|
+
import { statusbarHandlers } from './handlers/statusbar';
|
|
8
|
+
import { keyboardHandlers } from './handlers/keyboard';
|
|
9
|
+
import { hapticHandlers } from './handlers/haptic';
|
|
10
|
+
import { clipboardHandlers } from './handlers/clipboard';
|
|
11
|
+
import { scannerHandlers } from './handlers/scanner';
|
|
12
|
+
import { authHandlers } from './handlers/auth';
|
|
13
|
+
import { iapHandlers } from './handlers/iap';
|
|
14
|
+
import { pushHandlers } from './handlers/push';
|
|
15
|
+
import { permissionHandlers } from './handlers/permission';
|
|
16
|
+
import { preferenceHandlers } from './handlers/preference';
|
|
17
|
+
import { navigationHandlers } from './handlers/navigation';
|
|
18
|
+
import { browserHandlers } from './handlers/browser';
|
|
19
19
|
|
|
20
20
|
export type HandlerFn = (payload: never) => Promise<unknown> | unknown;
|
|
21
21
|
export type HandlerMap = Record<string, HandlerFn>;
|
package/src/handlers/location.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface ExpoLocationModule {
|
|
|
10
10
|
High: number;
|
|
11
11
|
Highest: number;
|
|
12
12
|
};
|
|
13
|
+
requestForegroundPermissionsAsync: () => Promise<{ status: string }>;
|
|
13
14
|
getCurrentPositionAsync: (opts: {
|
|
14
15
|
accuracy?: number;
|
|
15
16
|
}) => Promise<{
|
|
@@ -38,6 +39,11 @@ export const locationHandlers = {
|
|
|
38
39
|
try { Location = require('expo-location') as ExpoLocationModule; } catch {}
|
|
39
40
|
if (!Location) return { success: false, error: 'MODULE_NOT_INSTALLED: expo-location' } as never;
|
|
40
41
|
|
|
42
|
+
const { status } = await Location.requestForegroundPermissionsAsync();
|
|
43
|
+
if (status !== 'granted') {
|
|
44
|
+
return { success: false, error: 'PERMISSION_DENIED: location' } as never;
|
|
45
|
+
}
|
|
46
|
+
|
|
41
47
|
const accuracyMap: Record<string, number> = {
|
|
42
48
|
lowest: Location.Accuracy.Lowest,
|
|
43
49
|
low: Location.Accuracy.Low,
|
|
@@ -66,6 +72,11 @@ export const locationHandlers = {
|
|
|
66
72
|
try { Location = require('expo-location') as ExpoLocationModule; } catch {}
|
|
67
73
|
if (!Location) return { success: false, error: 'MODULE_NOT_INSTALLED: expo-location' } as never;
|
|
68
74
|
|
|
75
|
+
const { status } = await Location.requestForegroundPermissionsAsync();
|
|
76
|
+
if (status !== 'granted') {
|
|
77
|
+
return { success: false, error: 'PERMISSION_DENIED: location' } as never;
|
|
78
|
+
}
|
|
79
|
+
|
|
69
80
|
watchCounter += 1;
|
|
70
81
|
const watchId = `watch_${watchCounter}`;
|
|
71
82
|
|
package/src/index.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export { WebViewBridge, createBridgeWebView } from './WebViewBridge
|
|
2
|
-
export type { WebViewBridgeProps, WebViewBridgeRef } from './WebViewBridge
|
|
3
|
-
export { createDefaultHandlers } from './createHandlers
|
|
4
|
-
export type { HandlerFn, HandlerMap } from './createHandlers
|
|
1
|
+
export { WebViewBridge, createBridgeWebView } from './WebViewBridge';
|
|
2
|
+
export type { WebViewBridgeProps, WebViewBridgeRef } from './WebViewBridge';
|
|
3
|
+
export { createDefaultHandlers } from './createHandlers';
|
|
4
|
+
export type { HandlerFn, HandlerMap } from './createHandlers';
|
|
5
5
|
|
|
6
6
|
// Re-export handler maps for advanced usage
|
|
7
|
-
export { cameraHandlers } from './handlers/camera
|
|
8
|
-
export { locationHandlers } from './handlers/location
|
|
9
|
-
export { fileHandlers } from './handlers/file
|
|
10
|
-
export { shareHandlers } from './handlers/share
|
|
11
|
-
export { deviceHandlers } from './handlers/device
|
|
12
|
-
export { statusbarHandlers } from './handlers/statusbar
|
|
13
|
-
export { keyboardHandlers } from './handlers/keyboard
|
|
14
|
-
export { hapticHandlers } from './handlers/haptic
|
|
15
|
-
export { clipboardHandlers } from './handlers/clipboard
|
|
16
|
-
export { scannerHandlers } from './handlers/scanner
|
|
17
|
-
export { authHandlers } from './handlers/auth
|
|
18
|
-
export { iapHandlers } from './handlers/iap
|
|
19
|
-
export { pushHandlers } from './handlers/push
|
|
20
|
-
export { permissionHandlers } from './handlers/permission
|
|
21
|
-
export { preferenceHandlers } from './handlers/preference
|
|
22
|
-
export { navigationHandlers } from './handlers/navigation
|
|
23
|
-
export { browserHandlers } from './handlers/browser
|
|
7
|
+
export { cameraHandlers } from './handlers/camera';
|
|
8
|
+
export { locationHandlers } from './handlers/location';
|
|
9
|
+
export { fileHandlers } from './handlers/file';
|
|
10
|
+
export { shareHandlers } from './handlers/share';
|
|
11
|
+
export { deviceHandlers } from './handlers/device';
|
|
12
|
+
export { statusbarHandlers } from './handlers/statusbar';
|
|
13
|
+
export { keyboardHandlers } from './handlers/keyboard';
|
|
14
|
+
export { hapticHandlers } from './handlers/haptic';
|
|
15
|
+
export { clipboardHandlers } from './handlers/clipboard';
|
|
16
|
+
export { scannerHandlers } from './handlers/scanner';
|
|
17
|
+
export { authHandlers } from './handlers/auth';
|
|
18
|
+
export { iapHandlers } from './handlers/iap';
|
|
19
|
+
export { pushHandlers } from './handlers/push';
|
|
20
|
+
export { permissionHandlers } from './handlers/permission';
|
|
21
|
+
export { preferenceHandlers } from './handlers/preference';
|
|
22
|
+
export { navigationHandlers } from './handlers/navigation';
|
|
23
|
+
export { browserHandlers } from './handlers/browser';
|