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