🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

react-native-surveys

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-surveys - npm Package Compare versions

Comparing version
1.1.0
to
1.1.1
+4
-1
Forms/blocks/FilesUpload/Web.js

@@ -158,3 +158,6 @@ function _extends() {

},
getRootProps()
getRootProps(),
{
className: "dropZone"
}
),

@@ -161,0 +164,0 @@ React.createElement(

+38
-1

@@ -18,3 +18,10 @@ import React, { memo, useMemo, useEffect, useState } from "react";

const NativeFormsWebView = ({ onClose, onSend, children }) => {
const NativeFormsWebView = ({
onClose,
onSend,
children,
extraData,
name,
email
}) => {
const opacityAnimation = useMemo(() => new Animated.Value(0), []);

@@ -24,2 +31,31 @@ const translateAnimation = useMemo(() => new Animated.Value(height), []);

const statusBarHeight = getStatusBarHeight();
let source = Object.assign({}, children.props.source);
if (source.uri) {
let formAddress = source.uri;
if (name) {
formAddress +=
formAddress.indexOf("?") > -1 ? `&name=${name}` : `?name=${name}`;
}
if (email) {
formAddress +=
formAddress.indexOf("?") > -1 ? `&email=${email}` : `?name=${email}`;
}
if (extraData && typeof extraData === "object") {
try {
formAddress +=
formAddress.indexOf("?") > -1
? `&extraData=${JSON.stringify(extraData)}`
: `?name=${JSON.stringify(extraData)}`;
} catch (e) {
console.error("Invalid extraData prop.", e);
}
}
source.uri = formAddress;
}
useEffect(() => {

@@ -110,2 +146,3 @@ Animated.parallel([

onMessage,
source,
style: {

@@ -112,0 +149,0 @@ flex: 1,

@@ -63,4 +63,14 @@ import { queryStringToJSON } from "./utils";

}
export function addExtraDataToForm(form, extraData) {
export function addExtraDataToForm(form, extraProp, queryParams = {}) {
if (!form) return;
let extraData = extraProp || queryParams.extraData;
if (typeof extraData === "string") {
try {
extraData = JSON.parse(extraData);
} catch (e) {
console.error("Invalid query parameter for extraData", e);
}
}
if (!extraData) return;

@@ -67,0 +77,0 @@

@@ -48,3 +48,3 @@ import React, { memo, useState, useEffect } from "react";

predefineEmailAndName(form, email, name);
addExtraDataToForm(form, extraData);
addExtraDataToForm(form, extraData, queryParams);
form_fetched(form);

@@ -70,3 +70,3 @@ setFormData(form);

if (formData) {
addExtraDataToForm(formData, extraData);
addExtraDataToForm(formData, extraData, queryParams);
}

@@ -73,0 +73,0 @@ }, [extraData]); // eslint-disable-line

{
"name": "react-native-surveys",
"version": "1.1.0",
"version": "1.1.1",
"description": "Build your own forms, surveys and polls for your React Native apps.",

@@ -5,0 +5,0 @@ "main": "index.js",