import { useEffect } from 'react';
import { View } from 'react-native';
import { useFocusEffect } from '@react-navigation/native';

import { useWebViewContext } from '@/App';
import { useTheme } from '@/theme';

function Home() {
  const { layout } = useTheme();
  const { setShowWebView } = useWebViewContext();

  // 当Home页面获得焦点时显示WebView
  useFocusEffect(() => {
    setShowWebView(true);
    
    // 当页面失去焦点时隐藏WebView
    return () => {
      setShowWebView(false);
    };
  });

  return (
    <View style={[layout.flex_1]}>
      {/* WebView现在由App组件管理，这里只需要一个占位容器 */}
    </View>
  );
}

export default Home;
