@convep_mobilogy/react-native-qms-plugin 0.8.1 → 0.9.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/QmsPlugin.podspec +6 -1
- package/README.md +3 -0
- package/android/build.gradle +1 -1
- package/ios/QmsPlugin/QmsDashboardViewManager.mm +45 -0
- package/ios/QmsPlugin/QmsPluginBridge.mm +0 -1
- package/ios/QmsPluginFramework.xcframework/Info.plist +5 -5
- package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/Assets.car +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/QmsPluginFramework +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/_CodeSignature/CodeResources +2 -2
- package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/Assets.car +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/QmsPluginFramework +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/_CodeSignature/CodeResources +2 -2
- package/lib/module/QmsDashboardView.android.js +7 -1
- package/lib/module/QmsDashboardView.android.js.map +1 -1
- package/lib/module/QmsDashboardView.ios.js +11 -2
- package/lib/module/QmsDashboardView.ios.js.map +1 -1
- package/lib/typescript/src/QmsDashboardView.android.d.ts.map +1 -1
- package/lib/typescript/src/QmsDashboardView.ios.d.ts.map +1 -1
- package/lib/typescript/src/QmsDashboardView.types.d.ts +1 -0
- package/lib/typescript/src/QmsDashboardView.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/QmsDashboardView.android.tsx +10 -1
- package/src/QmsDashboardView.ios.tsx +16 -2
- package/src/QmsDashboardView.types.ts +1 -0
package/QmsPlugin.podspec
CHANGED
|
@@ -6,7 +6,12 @@ Pod::Spec.new do |s|
|
|
|
6
6
|
s.name = "QmsPlugin"
|
|
7
7
|
s.version = package["version"]
|
|
8
8
|
s.summary = package["description"]
|
|
9
|
-
|
|
9
|
+
homepage = package["homepage"]
|
|
10
|
+
if homepage.nil? || homepage.empty?
|
|
11
|
+
repo_url = package.dig("repository", "url")
|
|
12
|
+
homepage = repo_url ? repo_url.sub(/\Agit\+/, "") : "https://example.com"
|
|
13
|
+
end
|
|
14
|
+
s.homepage = homepage
|
|
10
15
|
s.license = package["license"]
|
|
11
16
|
s.authors = package["author"]
|
|
12
17
|
s.platforms = { :ios => "12.4" }
|
package/README.md
CHANGED
|
@@ -104,6 +104,9 @@ export default function App() {
|
|
|
104
104
|
clientID= {clientID}
|
|
105
105
|
clientCode={clientCode}
|
|
106
106
|
userToken={userToken}
|
|
107
|
+
onClose={() => {
|
|
108
|
+
// Android: unmount the SDK view or navigate back when the SDK exits
|
|
109
|
+
}}
|
|
107
110
|
/>
|
|
108
111
|
</View>
|
|
109
112
|
</SafeAreaView>
|
package/android/build.gradle
CHANGED
|
@@ -75,7 +75,7 @@ dependencies {
|
|
|
75
75
|
implementation "com.facebook.react:react-android"
|
|
76
76
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
77
77
|
implementation 'com.facebook.react:react-native:+'
|
|
78
|
-
implementation "com.convep.qms:qms-plugin:1.9.
|
|
78
|
+
implementation "com.convep.qms:qms-plugin:1.9.8"
|
|
79
79
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
80
80
|
|
|
81
81
|
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
|
|
@@ -95,3 +95,48 @@ RCT_EXPORT_VIEW_PROPERTY(ClientCode, NSString)
|
|
|
95
95
|
RCT_EXPORT_VIEW_PROPERTY(user_token, NSString)
|
|
96
96
|
|
|
97
97
|
@end
|
|
98
|
+
|
|
99
|
+
#import <React/RCTEventEmitter.h>
|
|
100
|
+
#import <React/RCTBridgeModule.h>
|
|
101
|
+
|
|
102
|
+
@interface QmsDashboardEmitter : RCTEventEmitter <RCTBridgeModule>
|
|
103
|
+
@end
|
|
104
|
+
|
|
105
|
+
@implementation QmsDashboardEmitter
|
|
106
|
+
|
|
107
|
+
RCT_EXPORT_MODULE();
|
|
108
|
+
|
|
109
|
+
+ (id)allocWithZone:(NSZone *)zone {
|
|
110
|
+
static QmsDashboardEmitter *sharedInstance = nil;
|
|
111
|
+
static dispatch_once_t onceToken;
|
|
112
|
+
dispatch_once(&onceToken, ^{
|
|
113
|
+
sharedInstance = [super allocWithZone:zone];
|
|
114
|
+
});
|
|
115
|
+
return sharedInstance;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
- (instancetype)init {
|
|
119
|
+
if (self = [super init]) {
|
|
120
|
+
// Listen for the framework notification
|
|
121
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
122
|
+
selector:@selector(handleDashboardClose:)
|
|
123
|
+
name:@"QmsDashboardDidCloseNotification"
|
|
124
|
+
object:nil];
|
|
125
|
+
}
|
|
126
|
+
return self;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
130
|
+
return @[@"onClose"];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
- (void)handleDashboardClose:(NSNotification *)note {
|
|
134
|
+
// Send event to JS
|
|
135
|
+
[self sendEventWithName:@"onClose" body:note.userInfo];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
- (void)dealloc {
|
|
139
|
+
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@end
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-
|
|
11
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>QmsPluginFramework.framework</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
15
15
|
<array>
|
|
16
16
|
<string>arm64</string>
|
|
17
|
+
<string>x86_64</string>
|
|
17
18
|
</array>
|
|
18
19
|
<key>SupportedPlatform</key>
|
|
19
20
|
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
20
23
|
</dict>
|
|
21
24
|
<dict>
|
|
22
25
|
<key>BinaryPath</key>
|
|
23
26
|
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
|
|
24
27
|
<key>LibraryIdentifier</key>
|
|
25
|
-
<string>ios-
|
|
28
|
+
<string>ios-arm64</string>
|
|
26
29
|
<key>LibraryPath</key>
|
|
27
30
|
<string>QmsPluginFramework.framework</string>
|
|
28
31
|
<key>SupportedArchitectures</key>
|
|
29
32
|
<array>
|
|
30
33
|
<string>arm64</string>
|
|
31
|
-
<string>x86_64</string>
|
|
32
34
|
</array>
|
|
33
35
|
<key>SupportedPlatform</key>
|
|
34
36
|
<string>ios</string>
|
|
35
|
-
<key>SupportedPlatformVariant</key>
|
|
36
|
-
<string>simulator</string>
|
|
37
37
|
</dict>
|
|
38
38
|
</array>
|
|
39
39
|
<key>CFBundlePackageType</key>
|
package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/Assets.car
CHANGED
|
Binary file
|
package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/QmsPluginFramework
CHANGED
|
Binary file
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Assets.car</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
tiDJHgS+Mbu43+C6GiuoJR1rE/s=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Headers/QmsPlugin.h</key>
|
|
12
12
|
<data>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<dict>
|
|
32
32
|
<key>hash2</key>
|
|
33
33
|
<data>
|
|
34
|
-
|
|
34
|
+
NzmSax3a+FRy3d2BvvftoEyaWVf17BzGCiO9/CkeCM8=
|
|
35
35
|
</data>
|
|
36
36
|
</dict>
|
|
37
37
|
<key>Headers/QmsPlugin.h</key>
|
|
Binary file
|
|
Binary file
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Assets.car</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
tiDJHgS+Mbu43+C6GiuoJR1rE/s=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Headers/QmsPlugin.h</key>
|
|
12
12
|
<data>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<dict>
|
|
32
32
|
<key>hash2</key>
|
|
33
33
|
<data>
|
|
34
|
-
|
|
34
|
+
NzmSax3a+FRy3d2BvvftoEyaWVf17BzGCiO9/CkeCM8=
|
|
35
35
|
</data>
|
|
36
36
|
</dict>
|
|
37
37
|
<key>Headers/QmsPlugin.h</key>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { DeviceEventEmitter, NativeModules, View } from 'react-native';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
const {
|
|
7
7
|
QmsModule
|
|
8
8
|
} = NativeModules;
|
|
9
9
|
export const QmsDashboardView = ({
|
|
10
10
|
style,
|
|
11
|
+
onClose,
|
|
11
12
|
clientID,
|
|
12
13
|
clientCode,
|
|
13
14
|
ClientID,
|
|
@@ -26,6 +27,11 @@ export const QmsDashboardView = ({
|
|
|
26
27
|
QmsModule.showQms(resolvedToken, resolvedClientID, resolvedClientCode);
|
|
27
28
|
}
|
|
28
29
|
}, [clientID, clientCode, ClientID, ClientCode, user_token, token, userToken, autoShow]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!onClose) return;
|
|
32
|
+
const subscription = DeviceEventEmitter.addListener('QmsSdkOnClose', () => onClose());
|
|
33
|
+
return () => subscription.remove();
|
|
34
|
+
}, [onClose]);
|
|
29
35
|
|
|
30
36
|
// Android doesn’t need to show native UI as a "view" here,
|
|
31
37
|
// we just render an empty container so JSX stays consistent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","
|
|
1
|
+
{"version":3,"names":["React","useEffect","DeviceEventEmitter","NativeModules","View","jsx","_jsx","QmsModule","QmsDashboardView","style","onClose","clientID","clientCode","ClientID","ClientCode","user_token","token","userToken","autoShow","resolvedClientID","resolvedClientCode","resolvedToken","showQms","subscription","addListener","remove"],"sourceRoot":"../../src","sources":["QmsDashboardView.android.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,kBAAkB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGvE,MAAM;EAAEC;AAAU,CAAC,GAAGJ,aAQrB;AAED,OAAO,MAAMK,gBAAiD,GAAGA,CAAC;EAChEC,KAAK;EACLC,OAAO;EACPC,QAAQ;EACRC,UAAU;EACVC,QAAQ;EACRC,UAAU;EACVC,UAAU;EACVC,KAAK;EACLC,SAAS;EACTC,QAAQ,GAAG;AACb,CAAC,KAAK;EACJjB,SAAS,CAAC,MAAM;IACd,MAAMkB,gBAAgB,GAAGR,QAAQ,IAAIE,QAAQ,IAAI,EAAE;IACnD,MAAMO,kBAAkB,GAAGR,UAAU,IAAIE,UAAU,IAAI,EAAE;IACzD,MAAMO,aAAa,GAAGN,UAAU,IAAIC,KAAK,IAAIC,SAAS,IAAI,EAAE;IAE5D,IAAIC,QAAQ,IAAIX,SAAS,EAAEe,OAAO,EAAE;MAClC;MACAf,SAAS,CAACe,OAAO,CAACD,aAAa,EAAEF,gBAAgB,EAAEC,kBAAkB,CAAC;IACxE;EACF,CAAC,EAAE,CACDT,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,UAAU,EACVC,UAAU,EACVC,KAAK,EACLC,SAAS,EACTC,QAAQ,CACT,CAAC;EAEFjB,SAAS,CAAC,MAAM;IACd,IAAI,CAACS,OAAO,EAAE;IACd,MAAMa,YAAY,GAAGrB,kBAAkB,CAACsB,WAAW,CAAC,eAAe,EAAE,MACnEd,OAAO,CAAC,CACV,CAAC;IACD,OAAO,MAAMa,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACf,OAAO,CAAC,CAAC;;EAEb;EACA;EACA,oBAAOJ,IAAA,CAACF,IAAI;IAACK,KAAK,EAAEA;EAAM,CAAE,CAAC;AAC/B,CAAC","ignoreList":[]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { requireNativeComponent } from 'react-native';
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import { NativeEventEmitter, NativeModules, requireNativeComponent } from 'react-native';
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
6
|
// Make sure your iOS native view manager is exported as "QmsDashboardView"
|
|
7
7
|
const NativeQmsDashboardView = requireNativeComponent('QmsDashboardView');
|
|
8
8
|
export const QmsDashboardView = props => {
|
|
9
9
|
const {
|
|
10
|
+
onClose,
|
|
10
11
|
clientID,
|
|
11
12
|
clientCode,
|
|
12
13
|
ClientID,
|
|
@@ -20,6 +21,14 @@ export const QmsDashboardView = props => {
|
|
|
20
21
|
const resolvedClientID = clientID ?? ClientID ?? '';
|
|
21
22
|
const resolvedClientCode = clientCode ?? ClientCode ?? '';
|
|
22
23
|
const resolvedToken = user_token ?? token ?? userToken ?? '';
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!onClose) return;
|
|
26
|
+
const nativeEmitterModule = NativeModules.QmsDashboardEmitter;
|
|
27
|
+
if (!nativeEmitterModule) return;
|
|
28
|
+
const emitter = new NativeEventEmitter(nativeEmitterModule);
|
|
29
|
+
const subscription = emitter.addListener('onClose', onClose);
|
|
30
|
+
return () => subscription.remove();
|
|
31
|
+
}, [onClose]);
|
|
23
32
|
return /*#__PURE__*/_jsx(NativeQmsDashboardView, {
|
|
24
33
|
...rest,
|
|
25
34
|
ClientID: resolvedClientID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","requireNativeComponent","jsx","_jsx","NativeQmsDashboardView","QmsDashboardView","props","clientID","clientCode","ClientID","ClientCode","user_token","userToken","token","rest","resolvedClientID","resolvedClientCode","resolvedToken"],"sourceRoot":"../../src","sources":["QmsDashboardView.ios.tsx"],"mappings":";;AAAA,OAAOA,KAAK,
|
|
1
|
+
{"version":3,"names":["React","useEffect","NativeEventEmitter","NativeModules","requireNativeComponent","jsx","_jsx","NativeQmsDashboardView","QmsDashboardView","props","onClose","clientID","clientCode","ClientID","ClientCode","user_token","userToken","token","rest","resolvedClientID","resolvedClientCode","resolvedToken","nativeEmitterModule","QmsDashboardEmitter","emitter","subscription","addListener","remove"],"sourceRoot":"../../src","sources":["QmsDashboardView.ios.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,kBAAkB,EAClBC,aAAa,EACbC,sBAAsB,QACjB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtB;AACA,MAAMC,sBAAsB,GAC1BH,sBAAsB,CAAwB,kBAAkB,CAAC;AAEnE,OAAO,MAAMI,gBAAiD,GAAIC,KAAK,IAAK;EAC1E,MAAM;IACJC,OAAO;IACPC,QAAQ;IACRC,UAAU;IACVC,QAAQ;IACRC,UAAU;IACVC,UAAU;IACVC,SAAS;IACTC,KAAK;IACL;IACA,GAAGC;EACL,CAAC,GAAGT,KAAK;EAET,MAAMU,gBAAgB,GAAGR,QAAQ,IAAIE,QAAQ,IAAI,EAAE;EACnD,MAAMO,kBAAkB,GAAGR,UAAU,IAAIE,UAAU,IAAI,EAAE;EACzD,MAAMO,aAAa,GAAGN,UAAU,IAAIE,KAAK,IAAID,SAAS,IAAI,EAAE;EAE5Df,SAAS,CAAC,MAAM;IACd,IAAI,CAACS,OAAO,EAAE;IACd,MAAMY,mBAAmB,GAAGnB,aAAa,CAACoB,mBAAmB;IAC7D,IAAI,CAACD,mBAAmB,EAAE;IAC1B,MAAME,OAAO,GAAG,IAAItB,kBAAkB,CAACoB,mBAAmB,CAAC;IAC3D,MAAMG,YAAY,GAAGD,OAAO,CAACE,WAAW,CAAC,SAAS,EAAEhB,OAAO,CAAC;IAC5D,OAAO,MAAMe,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACjB,OAAO,CAAC,CAAC;EAEb,oBACEJ,IAAA,CAACC,sBAAsB;IAAA,GACjBW,IAAI;IACRL,QAAQ,EAAEM,gBAAiB;IAC3BL,UAAU,EAAEM,kBAAmB;IAC/BL,UAAU,EAAEM;EAAc,CAC3B,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QmsDashboardView.android.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.android.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAYtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"QmsDashboardView.android.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.android.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAYtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA2C5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QmsDashboardView.ios.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.ios.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"QmsDashboardView.ios.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.ios.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAmC5D,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
2
|
export type QmsDashboardViewProps = {
|
|
3
3
|
style?: StyleProp<ViewStyle>;
|
|
4
|
+
onClose?: (event?: unknown) => void;
|
|
4
5
|
/**
|
|
5
6
|
* Preferred camelCase props. Uppercase variants are kept for backwards compatibility
|
|
6
7
|
* with the native iOS view manager prop names.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QmsDashboardView.types.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"QmsDashboardView.types.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { DeviceEventEmitter, NativeModules, View } from 'react-native';
|
|
3
3
|
import type { QmsDashboardViewProps } from './QmsDashboardView.types';
|
|
4
4
|
|
|
5
5
|
const { QmsModule } = NativeModules as {
|
|
@@ -14,6 +14,7 @@ const { QmsModule } = NativeModules as {
|
|
|
14
14
|
|
|
15
15
|
export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
|
|
16
16
|
style,
|
|
17
|
+
onClose,
|
|
17
18
|
clientID,
|
|
18
19
|
clientCode,
|
|
19
20
|
ClientID,
|
|
@@ -43,6 +44,14 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
|
|
|
43
44
|
autoShow,
|
|
44
45
|
]);
|
|
45
46
|
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!onClose) return;
|
|
49
|
+
const subscription = DeviceEventEmitter.addListener('QmsSdkOnClose', () =>
|
|
50
|
+
onClose()
|
|
51
|
+
);
|
|
52
|
+
return () => subscription.remove();
|
|
53
|
+
}, [onClose]);
|
|
54
|
+
|
|
46
55
|
// Android doesn’t need to show native UI as a "view" here,
|
|
47
56
|
// we just render an empty container so JSX stays consistent.
|
|
48
57
|
return <View style={style} />;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
NativeEventEmitter,
|
|
4
|
+
NativeModules,
|
|
5
|
+
requireNativeComponent,
|
|
6
|
+
} from 'react-native';
|
|
3
7
|
import type { QmsDashboardViewProps } from './QmsDashboardView.types';
|
|
4
8
|
|
|
5
9
|
// Make sure your iOS native view manager is exported as "QmsDashboardView"
|
|
@@ -8,6 +12,7 @@ const NativeQmsDashboardView =
|
|
|
8
12
|
|
|
9
13
|
export const QmsDashboardView: React.FC<QmsDashboardViewProps> = (props) => {
|
|
10
14
|
const {
|
|
15
|
+
onClose,
|
|
11
16
|
clientID,
|
|
12
17
|
clientCode,
|
|
13
18
|
ClientID,
|
|
@@ -23,6 +28,15 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = (props) => {
|
|
|
23
28
|
const resolvedClientCode = clientCode ?? ClientCode ?? '';
|
|
24
29
|
const resolvedToken = user_token ?? token ?? userToken ?? '';
|
|
25
30
|
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!onClose) return;
|
|
33
|
+
const nativeEmitterModule = NativeModules.QmsDashboardEmitter;
|
|
34
|
+
if (!nativeEmitterModule) return;
|
|
35
|
+
const emitter = new NativeEventEmitter(nativeEmitterModule);
|
|
36
|
+
const subscription = emitter.addListener('onClose', onClose);
|
|
37
|
+
return () => subscription.remove();
|
|
38
|
+
}, [onClose]);
|
|
39
|
+
|
|
26
40
|
return (
|
|
27
41
|
<NativeQmsDashboardView
|
|
28
42
|
{...rest}
|
|
@@ -2,6 +2,7 @@ import type { StyleProp, ViewStyle } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
export type QmsDashboardViewProps = {
|
|
4
4
|
style?: StyleProp<ViewStyle>;
|
|
5
|
+
onClose?: (event?: unknown) => void;
|
|
5
6
|
/**
|
|
6
7
|
* Preferred camelCase props. Uppercase variants are kept for backwards compatibility
|
|
7
8
|
* with the native iOS view manager prop names.
|