Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Fetch Replacement evalues to object, not function #190

Closed
@rwillemsandroid

Description

@rwillemsandroid

RN version: 0.35
RNFetchBlob version: 0.10.0
Platform: Android & iOS

I tried using the fetch replacement functions as documented here:
https://github.com/wkh237/react-native-fetch-blob/wiki/Fetch-API#fetch-replacement

import RNFetchBlob from 'react-native-fetch-blob';

const Fetch = RNFetchBlob.polyfill.Fetch;
// replace built-in fetch
window.fetch = new Fetch({
    // enable this option so that the response data conversion handled automatically
    auto : true,
    // when receiving response data, the module will match its Content-Type header
    // with strings in this array. If it contains any one of string in this array,
    // the response body will be considered as binary data and the data will stored
    // in file system instead of in memory.
    // By default, it only store response data to file system when Content-Type
    // contains string `application/octet`.
    binaryContentTypes : [
        'image/',
        'video/',
        'audio/',
    ]
});

However, when I do this and use fetch(), I get the following error:

fetch is not a function
TypeError: fetch is not a function

Logging the replacement fetch function yields the following:

console.log("RNfetchblob fetch: " , fetch);

screen shot 2016-11-21 at 12 42 00

The original fetch function looks like this:

screen shot 2016-11-21 at 12 30 35

Any help into solving this issue is greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions