未分類 14 1 月 2021 React Native 中嵌套 Webview,网页跳转后如何动态改变顶部导航栏? React Native 中嵌套 Webview,网页跳转后如何动态改变顶部导航栏? 資深大佬 : croul 0 我在 React Native 中用了一个 Webview,webview 显示首页的时候,顶部导航栏只有一个 title,网页跳转后,我想让顶部导航栏加一个返回按钮,请问如何实现? 大佬有話說 (1) 主 資深大佬 : croul 搞定了。获取 navigationOptions 的时候,加一个参数。let backButtonEnabled = navigation.getParam(“backButtonEnabled”);backButtonEnabled 为 true 的时候,设置 headerLeft 为返回按钮。在组件中,初始化的时候设置该参数为 false 。this.props.navigation.setParams({backButtonEnabled: false});需要显示返回按钮的时候,再设置为 true 。this.props.navigation.setParams({backButtonEnabled: true});