PC端的部分适配
This commit is contained in:
30
App.tsx
30
App.tsx
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { AppState, AppStateStatus } from 'react-native';
|
||||
import { AppState, AppStateStatus, Platform, StyleSheet } from 'react-native';
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
||||
@@ -42,6 +42,34 @@ const queryClient = new QueryClient({
|
||||
|
||||
installAlertOverride();
|
||||
|
||||
// 注入全局CSS来移除React Native Web在浏览器中的默认focus outline
|
||||
if (Platform.OS === 'web') {
|
||||
const style = document.createElement('style');
|
||||
style.textContent = `
|
||||
/* 移除TextInput focus时的浏览器默认outline */
|
||||
input:focus, textarea:focus, select:focus {
|
||||
outline: none !important;
|
||||
outline-width: 0 !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
/* 移除focus-visible时的默认outline */
|
||||
input:focus-visible, textarea:focus-visible {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
/* 移除所有:focus相关的默认样式 */
|
||||
*:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
*:focus-visible {
|
||||
outline: none !important;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const appState = useRef<AppStateStatus>(AppState.currentState);
|
||||
const notificationResponseListener = useRef<Notifications.EventSubscription | null>(null);
|
||||
|
||||
Reference in New Issue
Block a user