Skip to content

Commit

Permalink
use native fetch().text() instead FileReader
Browse files Browse the repository at this point in the history
unfortunately FileReder not working on device. facebook/react-native#4214
  • Loading branch information
legendar authored Nov 7, 2016
1 parent 7424a11 commit 636fa85
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ export default class LinkPreview {

if(detectedUrl) {
fetch(detectedUrl)
.then(response => {
let html = response._bodyInit
let myReader = new FileReader()
myReader.onload = () => {
resolve(this._parseResponse(myReader.result, detectedUrl))
}
myReader.readAsText(html)
.then(response => response.text())
.then(text => {
resolve(this._parseResponse(text, detectedUrl))
})
.catch(err => reject(err))
} else {
Expand Down

0 comments on commit 636fa85

Please sign in to comment.