How to use the rn-fetch-blob.polyfill function in rn-fetch-blob

To help you get started, we’ve selected a few rn-fetch-blob examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mattermost / mattermost-mobile / app / init / fetch.js View on Github external
const userAgent = await DeviceInfo.getUserAgent();
    Client4.setUserAgent(userAgent);

    if (Platform.OS === 'ios') {
        const certificate = await mattermostBucket.getPreference('cert');
        fetchConfig = {
            auto: true,
            certificate,
        };
        window.fetch = new RNFetchBlob.polyfill.Fetch(fetchConfig).build();
    } else {
        fetchConfig = {
            auto: true,
        };
        window.fetch = new RNFetchBlob.polyfill.Fetch(fetchConfig).build();
    }

    return true;
};
github anchetaWern / RNChatkitDemo / src / screens / Chat.js View on Github external
import React, { Component } from "react";
import { View, Text, ActivityIndicator, FlatList, TouchableOpacity, Alert } from "react-native";
import { GiftedChat, Send, Message } from "react-native-gifted-chat";
import { ChatManager, TokenProvider } from "@pusher/chatkit-client";
import axios from "axios";
import Config from "react-native-config";
import Icon from "react-native-vector-icons/FontAwesome";
import { DocumentPicker, DocumentPickerUtil } from "react-native-document-picker";
import * as mime from "react-native-mime-types";
import Modal from "react-native-modal";
import RNFetchBlob from "rn-fetch-blob";

const Blob = RNFetchBlob.polyfill.Blob;
const fs = RNFetchBlob.fs;
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest;
window.Blob = Blob;

import RNFS from "react-native-fs";

import ChatBubble from "../components/ChatBubble";
import AudioPlayer from "../components/AudioPlayer";
import VideoPlayer from "../components/VideoPlayer";

const CHATKIT_INSTANCE_LOCATOR_ID = `v1:us1:${Config.CHATKIT_INSTANCE_LOCATOR_ID}`;
const CHATKIT_SECRET_KEY = Config.CHATKIT_SECRET_KEY;

const CHAT_SERVER = "YOUR NGROK HTTPS URL";
const CHATKIT_TOKEN_PROVIDER_ENDPOINT = `${CHAT_SERVER}/auth`;

class Chat extends Component {
github futurepress / epubjs-rn / src / Streamer.js View on Github external
AppState
} from 'react-native';

import StaticServer from 'react-native-static-server';

import RNFetchBlob from "rn-fetch-blob";

import { zip, unzip, unzipAssets, subscribe } from 'react-native-zip-archive'


import { join } from "path";

const Dirs = RNFetchBlob.fs.dirs

if (!global.Blob) {
  global.Blob = RNFetchBlob.polyfill.Blob;
}

const Uri = require("epubjs/lib/utils/url");

class EpubStreamer {

  constructor(opts) {
    opts = opts || {};
    this.port = opts.port || "3" + Math.round(Math.random() * 1000);
    this.root = opts.root || "www";
    this.server = new StaticServer(this.port, this.root, {localOnly: true});

    this.serverOrigin = 'file://';

    this.urls = [];
    this.locals = [];
github mattermost / mattermost-mobile / app / screens / select_server / select_server.js View on Github external
RNFetchBlob.cba.selectCertificate((certificate) => {
                if (certificate) {
                    mattermostBucket.setPreference('cert', certificate);
                    window.fetch = new RNFetchBlob.polyfill.Fetch({
                        auto: true,
                        certificate,
                    }).build();
                    this.pingServer(url);
                }
            });
        } else {
github futurepress / epubjs-rn / src / Epub.js View on Github external
import {
  StyleSheet,
  View,
  ActivityIndicator,
  AsyncStorage,
  Dimensions,
  AppState,
  WebView
} from "react-native";

import Orientation from "react-native-orientation";

import RNFetchBlob from "rn-fetch-blob";

if (!global.Blob) {
  global.Blob = RNFetchBlob.polyfill.Blob;
}

global.JSZip = global.JSZip || require("jszip");

global.URL = require("epubjs/libs/url/url-polyfill.js");

if (!global.btoa) {
  global.btoa = require("base-64").encode;
}

import ePub, { Layout, EpubCFI } from "epubjs";

const core = require("epubjs/lib/utils/core");
const Uri = require("epubjs/lib/utils/url");
const Path = require("epubjs/lib/utils/path");
github anchetaWern / RNChatkitDemo / src / screens / Chat.js View on Github external
import React, { Component } from "react";
import { View, Text, ActivityIndicator, FlatList, TouchableOpacity, Alert } from "react-native";
import { GiftedChat, Send, Message } from "react-native-gifted-chat";
import { ChatManager, TokenProvider } from "@pusher/chatkit-client";
import axios from "axios";
import Config from "react-native-config";
import Icon from "react-native-vector-icons/FontAwesome";
import { DocumentPicker, DocumentPickerUtil } from "react-native-document-picker";
import * as mime from "react-native-mime-types";
import Modal from "react-native-modal";
import RNFetchBlob from "rn-fetch-blob";

const Blob = RNFetchBlob.polyfill.Blob;
const fs = RNFetchBlob.fs;
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest;
window.Blob = Blob;

import RNFS from "react-native-fs";

import ChatBubble from "../components/ChatBubble";
import AudioPlayer from "../components/AudioPlayer";
import VideoPlayer from "../components/VideoPlayer";

const CHATKIT_INSTANCE_LOCATOR_ID = `v1:us1:${Config.CHATKIT_INSTANCE_LOCATOR_ID}`;
const CHATKIT_SECRET_KEY = Config.CHATKIT_SECRET_KEY;

const CHAT_SERVER = "YOUR NGROK HTTPS URL";
const CHATKIT_TOKEN_PROVIDER_ENDPOINT = `${CHAT_SERVER}/auth`;