【发布时间】:2021-01-14 21:41:00
【问题描述】:
我最近一直在使用 React-Native 和 Expo。我需要一个按钮来在浏览器中打开一个网站,但搜索栏(顶部)和图标栏也不应该出现。这是一张让一切更容易理解的图片:
这是我使用的代码:
import React, { Component } from 'react';
import { Button, Text, View } from 'react-native';
import * as WebBrowser from 'expo-web-browser';
export default class App extends Component {
state = {
result: null,
};
render() {
return (
<View>
<Button title="Open WebBrowser" onPress={this._handlePressButtonAsync} />
<Text>{this.state.result && JSON.stringify(this.state.result)}</Text>
</View>
);
}
_handlePressButtonAsync = async () => {
let result = await WebBrowser.openBrowserAsync('https://expo.io');
this.setState({ result });
};
}
【问题讨论】:
-
您的英语很好,但您可以查看
expo文档或在此处搜索(堆栈溢出):stackoverflow.com/questions/47155181/hide-toolbar-in-expo-app -
这能回答你的问题吗? Hide toolbar in expo app
标签: javascript react-native expo searchbar