react-native-my-survey-sdk 1.0.4 → 1.0.5

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.
Files changed (3) hide show
  1. package/ReadMe.md +1 -1
  2. package/index.js +13 -7
  3. package/package.json +1 -1
package/ReadMe.md CHANGED
@@ -1 +1 @@
1
- # survey sdk react native
1
+ # survey sdk react
package/index.js CHANGED
@@ -1,20 +1,26 @@
1
1
  import React, { useContext } from 'react';
2
- import { TouchableOpacity, SafeAreaView, Image } from 'react-native';
2
+ import { TouchableOpacity, SafeAreaView, Image, Alert } from 'react-native';
3
3
  import { WebView } from 'react-native-webview';
4
4
  import { NavigationContext } from '@react-navigation/native';
5
5
 
6
6
  const SurveyWebView = ({ url }) => {
7
7
  const navigation = useContext(NavigationContext);
8
- const SURVEY_URL = url
8
+
9
+ const handleGoBack = () => {
10
+ if (navigation && navigation.goBack) {
11
+ navigation.goBack();
12
+ } else {
13
+ Alert.alert("Navigation Error", "Navigation context not found.");
14
+ }
15
+ };
16
+
9
17
  return (
10
18
  <SafeAreaView style={{ flex: 1 }}>
11
- <TouchableOpacity
12
- style={{ alignItems: 'flex-end', right: 15 }}
13
- onPress={() => navigation?.goBack()}
14
- >
19
+ <TouchableOpacity style={{ alignItems: 'flex-end', right: 15 }} onPress={handleGoBack}>
15
20
  <Image source={require('./assets/close.png')} style={{ height: 15, width: 20 }} />
16
21
  </TouchableOpacity>
17
- <WebView source={{ uri: SURVEY_URL }} />
22
+
23
+ <WebView source={{ uri: url }} />
18
24
  </SafeAreaView>
19
25
  );
20
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-my-survey-sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "For xebo.ai",
5
5
  "main": "index.js",
6
6
  "scripts": {