Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RNFetchblob.fs.hash function to type definition #276

Merged
merged 2 commits into from
Sep 26, 2019

Conversation

vunyunt
Copy link

@vunyunt vunyunt commented Jan 4, 2019

The RNFetchblob.fs.hash function is missing in the typedef file for typescript, and is added in this PR.

I am aware of the rn-fetch-blob-dev repository but this seems to be a trivial change. Please tell me if I should submit the PR there instead.

PS: This is my first time actually submitting a PR to an open source project, so sorry in advance if there's anything I am doing wrong.

@vunyunt
Copy link
Author

vunyunt commented Jan 4, 2019

When trying to call the function, I get the error

[Info] 01-05 06:53:56.307  5050 10529 I ReactNativeJS: { [TypeError: undefined is not a function (evaluating 'RNFetchBlob.hash(path, algorithm)')]
01-05 06:53:56.307  5050 10529 I ReactNativeJS:   line: 142538,
01-05 06:53:56.307  5050 10529 I ReactNativeJS:   column: 28,`01-05 06:53:56.307  5050 10529 I ReactNativeJS:   sourceURL: 'http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false' }

The following is relevant code:

import RNFetchBlob from "rn-fetch-blob";
...
let md5 = await RNFetchBlob.fs.hash(result.path, "md5");
...

Is this an error on my part, either the typedef or the way I am calling it? I don't think it's related to the typedef though, since it seems to be coming from the library itself. Or is the has function not working properly for the current version?

yarn list --pattern=rn-fetch-blob gives me

yarn list v1.12.3
└─ rn-fetch-blob@0.10.15
Done in 0.93s.

@Traviskn
Copy link

Thanks for adding the type definition, apologies for the delayed review

@Traviskn Traviskn merged commit 6e2234b into joltup:master Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants