2016-07-27 13 views
0

Facebook 및 기타 앱에 표시되는 링크 미리보기와 같이 반응이있는 웹 페이지 미리보기를 사용자가 볼 수있게하려고했습니다. 나는 약간의 연구를했다.React-Native에서 페이지 미리보기

나는 노드의 기능을 제공하는 몇 가지 라이브러리를 본 적이 있지만 그것은

https://github.com/cheeriojs/cheerio

을 네이티브 반응 (원래 cheerio.js 때문에 반응 네이티브와 직접 작동하지 않습니다) 작동하지 않습니다

oEmbed 라이브러리도 검사했는데 작동하지 않는 것 같습니다.

나는 웹 페이지 미리보기 작업을하는 작은 도서관을 쓰기까지 종료

답변

2

를 얻기위한 좋은 방법이 될 수 있습니다 궁금했다. 희망은 어떤 사람들에게 유용

https://github.com/changey/react-native-page-previewer

사용

import preview from 'react-native-page-previewer'; 

preview("http://www.google.com", function(err, data) { 
    if(!err) { 
     console.log(data); 
    } 
}); 

샘플 반환

{ url: 'https://www.google.com', 
    loadFailed: false, 
    title: 'Google', 
    description: 'Search the world\'s information, including webpages, images, videos and more. Google has many special features to help you find exactly what you\'re looking for.', 
    contentType: 'text/html', 
    mediaType: 'website', 
    images: [ 'https://www.google.com/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png' ], 
    videos: undefined, 
    audios: undefined } 
+0

이봐, 난 당신의 라이브러리를 사용하려고 노력했지만, 나는 구글을 미리보기 할 때 .com 나는 처리되지 않은 약속 거부를 받고 다른 어떤 페이지는 정의되지 않은 데이터, 어떤 아이디어를 제공합니까? – ospfranco

+0

@ospfranco 얼마 전에 수정 프로그램이 병합되었습니다. 다시해볼 수 있을까요? 감사! – changey

관련 문제