我正在使用博览会浏览器,就像在应用程序浏览器中一样。我需要在浏览器中暗示阅读器模式,该怎么做。这是文档"https://docs.expo.io/versions/latest/sdk/webbrowser/">
我尝试了阅读器模式,但软件包不支持。
<Text numberOfLines={3} style={{ fontSize: 14,fontWeight:'bold' }}
onPress={() => WebBrowser.openBrowserAsync(item.url)}
>{item.title}</Text>
<Text style={{ fontSize: 10,color:"#B6B6B4",fontWeight:'bold'}}>{item.author}</Text>
<Text style={{ fontSize: 10,color:"#B6B6B4",fontWeight:'bold' }}>{item.publishedAt}</Text>
</Body>```
i want a webview with reader mode. for both ios and android.Thanks.
你安装了expo模块吗?
您应该安装expo install expo-web-browser
和文本没有 onPress。您可以使用TouchableOpacity
import {
View,
Text,
TouchableOpacity,
} from "react-native";
import * as WebBrowser from 'expo-web-browser';
async _handlePressButtonAsync(url){
await WebBrowser.openBrowserAsync(url);
};
...
<TouchableOpacity
onPress={() => this._handlePressButtonAsync(item.url)}
>
<Text numberOfLines={3} style={{ fontSize: 14,fontWeight:'bold' }}>{item.title}
</Text>
</TouchableOpacity>