最后写一个小型图书馆,没有工作的好方法。希望这是非常有用的一些人
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