1

我有一个 webview 应用程序的以下代码:

import { StatusBar } from 'expo-status-bar';
import React, { useState, useRef } from 'react'
import {ActivityIndicator, TouchableOpacity, Text, SafeAreaView, StyleSheet, View} from "react-native";
import { WebView } from 'react-native-webview';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { Ionicons } from '@expo/vector-icons'

const App = () => {
  const [canGoBack, setCanGoBack] = useState(false)
  const [canGoForward, setCanGoForward] = useState(false)
  const [currentUrl, setCurrentUrl] = useState('')
  const webviewRef = useRef(null)

  return (
    <>
      <StatusBar barStyle='dark-content' />
      <SafeAreaView style={styles.flexContainer}>
        <WebView 
        userAgent="Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Mobile Safari/537.36"
        source={{ uri: 'https://google.com' }}
        mixedContentMode = "compatibility"
          ref={webviewRef}}
        />
      </SafeAreaView>
    </>
  )
}

const styles = StyleSheet.create({
  flexContainer: {
    flex: 1
  },
  tabBarContainer: {
    padding: 10,
    flexDirection: 'row',
    justifyContent: 'space-around',
    backgroundColor: '#000000'
  },
  button: {
    color: 'white',
    fontSize: 20
  }
})

export default App

但是,状态栏与 Android 上的应用程序重叠,但在 IOS 上它不重叠。在 IOS 上,它看起来太压扁了。

我应该如何修改上面的代码来解决以下问题:

(1) 在 Android 上的重叠和

(2) 在 IOS 上太挤了?

4

0 回答 0