//@ts-nocheck
import React from 'react';
import { SafeAreaView, View } from 'react-native';
import { MText } from '../../components/MText';
import { color } from '../../theme';
import { IconBack } from '../../assets/icons';
import { commonStyles } from '../CommonStyles';
import MButton from '../../components/MButton';
import { useNavigation } from '@react-navigation/native';
import Pdf from 'react-native-pdf';
import MHeader from '../../components/MHeader';

export default function PreviewContract(props: any) {
  const navigation = useNavigation();
  const source = props?.route?.params;
  return (
    <View style={{ flex: 1, backgroundColor: 'white' }}>
      <MHeader
        title="Hợp đồng"
        onBack={() => {
          navigation.goBack();
        }}
      />
      <SafeAreaView style={{ flex: 1 }}>
        <View style={{ backgroundColor: color.border }} />
        <View style={{ flex: 1 }}>
          <Pdf
            source={source}
            onLoadComplete={(numberOfPages, filePath) => {
              console.log(`Number of pages: ${numberOfPages}`);
            }}
            onPageChanged={(page, numberOfPages) => {
              console.log(`Current page: ${page}`);
            }}
            onError={(error) => {
              console.log(error);
            }}
            onPressLink={(uri) => {
              console.log(`Link pressed: ${uri}`);
            }}
            style={{
              flex: 1,
            }}
          />
        </View>
      </SafeAreaView>
    </View>
  );
}
