Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with base64 #320

Open
5 tasks done
aliMurtaja opened this issue Oct 22, 2024 · 1 comment
Open
5 tasks done

Problem with base64 #320

aliMurtaja opened this issue Oct 22, 2024 · 1 comment

Comments

@aliMurtaja
Copy link

Summary

Hello @victorsoares96

I used one of your example Formats, in this example base64 is not working, loader keep on loading.

https://github.com/victorsoares96/epubjs-react-native/blob/master/example-bare/examples/Formats/index.tsx

What platform(s) does this occur on?

Android, iOS

What workflow(s) does this occur on?

Bare Workflow

Environment (or package.json)

bare

Your .epub file

No response

Minimal reproducible example

No response

I confirm that i have

  • I looked for a solution to my problem in other open and resolved issues
  • I checked the examples provided solve my problem
  • I have verified that my problem is not caused by a third-party library
  • I cloned the project environment examples and still the problem persists
  • I'm using the latest available version of the library and its complements
@aliMurtaja
Copy link
Author

It working now, needed to add data:application/oebps-package+xml;base64, prefix

But application is very slow, when I swipes to next page, it takes around 2min to navigate, is there any solution ?

This is my code

import React, {useEffect, useState} from 'react';

import { SafeAreaView, Text, Button } from 'react-native';
import { Reader, useReader } from '@epubjs-react-native/core';
import { useFileSystem } from '@epubjs-react-native/file-system'; // for Bare React Native project
import { Annotations } from './Annotation';
import { Bookmarks } from './Bookmarks';
import { BookmarksList } from './Bookmarks/BookmarksList';
import Toc from './TableOfContents';
// import { useFileSystem } from '@epubjs-react-native/expo-file-system'; // for Expo project
import ExampleE from './../../src/components/baseSF/base64'
import { Formats } from './Formates';
var RNFS = require('react-native-fs');

export default function Epub() {
const [basesf, setBasesf] = useState(null);
function onPressLearnMore() {
RNFS.readFile(RNFS.ExternalStorageDirectoryPath+ "/clinic/another.txt").then((res)=>{
setBasesf(res)
}).catch(err=> console.log(err))
}

useEffect(()=>{
console.log('FILE WRITTEN! 2', basesf)
}, [basesf])

if(!basesf){
return <Button
// onPress={()=>onPressLearnMore_(RNFS.ExternalStorageDirectoryPath+ "/clinic/example.epub")}
onPress={onPressLearnMore}
title="Learn More"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>
}

return (
<SafeAreaView style={{ flex: 1 }}>
<Reader
src = {"data:application/oebps-package+xml;base64,"+basesf}
fileSystem={useFileSystem}
width={"100%"}
height={700}
/>

);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant