react-native-mytatva-rn-sdk 1.2.0 → 1.2.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/android/app/build.gradle +0 -5
- package/package.json +1 -1
- package/src/MainWebView.tsx +5 -2
- package/src/ProgressWebView.tsx +5 -2
- package/src/index.android.js +2 -0
- package/src/index.ios.js +21 -2
- package/android/settings.gradle +0 -9
package/android/app/build.gradle
CHANGED
package/package.json
CHANGED
package/src/MainWebView.tsx
CHANGED
|
@@ -12,6 +12,7 @@ const MainWebView = (props) => {
|
|
|
12
12
|
webviewRef,
|
|
13
13
|
handleMessage,
|
|
14
14
|
runBeforeFirst,
|
|
15
|
+
platform,
|
|
15
16
|
setCanGoBack,
|
|
16
17
|
} = props; // Get the URL and other parameters from the route
|
|
17
18
|
|
|
@@ -24,11 +25,13 @@ const MainWebView = (props) => {
|
|
|
24
25
|
source={{
|
|
25
26
|
uri: source,
|
|
26
27
|
headers: {
|
|
27
|
-
platform:
|
|
28
|
+
platform: platform,
|
|
28
29
|
},
|
|
29
30
|
}}
|
|
30
31
|
onMessage={handleMessage}
|
|
31
|
-
|
|
32
|
+
{...(runBeforeFirst && {
|
|
33
|
+
injectedJavaScriptBeforeContentLoaded: runBeforeFirst,
|
|
34
|
+
})}
|
|
32
35
|
javaScriptEnabled={true}
|
|
33
36
|
onLoadProgress={(event) => setCanGoBack(event.nativeEvent.canGoBack)}
|
|
34
37
|
onError={(errorMessage) => {
|
package/src/ProgressWebView.tsx
CHANGED
|
@@ -40,6 +40,7 @@ const ProgressWebView = (props) => {
|
|
|
40
40
|
mobileNumber,
|
|
41
41
|
uuid,
|
|
42
42
|
clientSource,
|
|
43
|
+
platform,
|
|
43
44
|
moduleName,
|
|
44
45
|
} = props;
|
|
45
46
|
const [activeGoodflipTab, setActiveGoodflipTab] = useState(
|
|
@@ -337,11 +338,13 @@ const ProgressWebView = (props) => {
|
|
|
337
338
|
source={{
|
|
338
339
|
uri: url,
|
|
339
340
|
headers: {
|
|
340
|
-
platform:
|
|
341
|
+
platform: platform,
|
|
341
342
|
},
|
|
342
343
|
}}
|
|
343
344
|
onMessage={handleMessage}
|
|
344
|
-
|
|
345
|
+
{...(runBeforeFirst && {
|
|
346
|
+
injectedJavaScriptBeforeContentLoaded: runBeforeFirst,
|
|
347
|
+
})}
|
|
345
348
|
javaScriptEnabled={true}
|
|
346
349
|
// onLoadProgress={(event) => setCanGoBack(event.nativeEvent.canGoBack)}
|
|
347
350
|
onError={(errorMessage) => {
|
package/src/index.android.js
CHANGED
|
@@ -256,6 +256,7 @@ const MyTatvaRnSdkView = ({
|
|
|
256
256
|
runBeforeFirst={runBeforeFirst}
|
|
257
257
|
setCanGoBack={setCanGoBack}
|
|
258
258
|
mobileNumber={mobileNumber}
|
|
259
|
+
platform={'ANDROID'}
|
|
259
260
|
moduleName={moduleName}
|
|
260
261
|
uuid={uuid}
|
|
261
262
|
clientSource={clientSource}
|
|
@@ -266,6 +267,7 @@ const MyTatvaRnSdkView = ({
|
|
|
266
267
|
environment={environment}
|
|
267
268
|
source={source}
|
|
268
269
|
loading={loading}
|
|
270
|
+
platform={'ANDROID'}
|
|
269
271
|
isError={isError}
|
|
270
272
|
webviewRef={webviewRef}
|
|
271
273
|
handleMessage={handleMessage}
|
package/src/index.ios.js
CHANGED
|
@@ -219,6 +219,23 @@ const MyTatvaRnSdkView = ({
|
|
|
219
219
|
break;
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
|
+
const [canGoBack, setCanGoBack] = useState(false);
|
|
223
|
+
|
|
224
|
+
const handleBack = useCallback(() => {
|
|
225
|
+
if (canGoBack && webviewRef.current) {
|
|
226
|
+
webviewRef.current?.goBack();
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
return false;
|
|
230
|
+
}, [canGoBack]);
|
|
231
|
+
|
|
232
|
+
useEffect(() => {
|
|
233
|
+
BackHandler.addEventListener('hardwareBackPress', handleBack);
|
|
234
|
+
return () => {
|
|
235
|
+
BackHandler.removeEventListener('hardwareBackPress', handleBack);
|
|
236
|
+
// gpsListener.remove();
|
|
237
|
+
};
|
|
238
|
+
}, [handleBack]);
|
|
222
239
|
|
|
223
240
|
const { height, width } = Dimensions.get('screen');
|
|
224
241
|
return (
|
|
@@ -234,10 +251,11 @@ const MyTatvaRnSdkView = ({
|
|
|
234
251
|
loading={loading}
|
|
235
252
|
isError={isError}
|
|
236
253
|
webviewRef={webviewRef}
|
|
237
|
-
runBeforeFirst={runBeforeFirst}
|
|
254
|
+
// runBeforeFirst={runBeforeFirst}
|
|
238
255
|
setCanGoBack={setCanGoBack}
|
|
239
256
|
mobileNumber={mobileNumber}
|
|
240
257
|
moduleName={moduleName}
|
|
258
|
+
platform={'IOS'}
|
|
241
259
|
uuid={uuid}
|
|
242
260
|
clientSource={clientSource}
|
|
243
261
|
/>
|
|
@@ -247,10 +265,11 @@ const MyTatvaRnSdkView = ({
|
|
|
247
265
|
environment={environment}
|
|
248
266
|
source={source}
|
|
249
267
|
loading={loading}
|
|
268
|
+
platform={'IOS'}
|
|
250
269
|
isError={isError}
|
|
251
270
|
webviewRef={webviewRef}
|
|
252
271
|
handleMessage={handleMessage}
|
|
253
|
-
runBeforeFirst={runBeforeFirst}
|
|
272
|
+
// runBeforeFirst={runBeforeFirst}
|
|
254
273
|
setCanGoBack={setCanGoBack}
|
|
255
274
|
clientSource={clientSource}
|
|
256
275
|
moduleName={moduleName}
|
package/android/settings.gradle
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
rootProject.name = 'MytatvaRnSdk'
|
|
2
|
-
|
|
3
|
-
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
|
|
4
|
-
applyNativeModulesSettingsGradle(settings)
|
|
5
|
-
|
|
6
|
-
include ':react-native-tracky-lib'
|
|
7
|
-
project(':react-native-tracky-lib').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-tracky-lib/android')
|
|
8
|
-
|
|
9
|
-
include ':app'
|