最後寫一個小型圖書館,沒有工作的好方法。希望這是非常有用的一些人
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 }
嘿,我一直在試圖使用你的庫,但是當我嘗試預覽谷歌.com我得到一個未處理的承諾拒絕和任何其他頁面給出未定義的數據,任何想法? – ospfranco
@ospfranco前段時間合併了一個修復。你能再試一次嗎?謝謝! – changey