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

package is only working in debug mode #3

Closed
alexaung opened this issue May 4, 2017 · 4 comments
Closed

package is only working in debug mode #3

alexaung opened this issue May 4, 2017 · 4 comments

Comments

@alexaung
Copy link

alexaung commented May 4, 2017

pdf view is only show in debug mode and need to always run the "react-native start" command.

If I stop or unplug, viewer is only showing loading indicator. I am reading the file from project folder.

<Pdf ref={(pdf)=>{this.pdf = pdf;}} source={require("dicalaws/pdf/en/0.pdf")} page={1} horizontal={false} onLoadComplete={(pageCount)=>{ this.setState({pageCount: pageCount}); console.log(total page count: ${pageCount}); }} onPageChanged={(page,pageCount)=>{ this.setState({page:page}); console.log(current page: ${page});}} style={styles.pdf}/>

Regards,
Alex Aung

@wonday
Copy link
Owner

wonday commented May 5, 2017

In my example, I did not add release compile option.
Release version need signature.
you can see the following link to add it.
Android: http://facebook.github.io/react-native/docs/signed-apk-android.html

In react-native debug mode, resources(js, image, etc.) is loaded from nodejs server (react-native start), not really from app internal. so if you run on debug, you need run react-native start first.

@alexaung
Copy link
Author

alexaung commented May 6, 2017

actually, my app is already added signature but it is not working in bath installRelease and assemblyRelease.

@alexaung
Copy link
Author

alexaung commented May 8, 2017

It is working now. For local file view, can't use require but following line will solved the issue.

let source = {uri:'file:///'+this.state.filepath,cache:true};

thanks for this package. it is better than react-native-pdf-view.

Regards,
Alex

@alexaung alexaung closed this as completed May 8, 2017
@wonday
Copy link
Owner

wonday commented May 10, 2017

Hi Alexaung,

Thanks for your feedback.

You are right, source={require("dicalaws/pdf/en/0.pdf")} does not action when run in android release version.
I had add source={uri:"bundle-assets://xxx.pdf"} method to support access local assets file.
You can try it again.
More details please see readme file.

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

2 participants