epubjs-react-native icon indicating copy to clipboard operation
epubjs-react-native copied to clipboard

Not Opening on real device

Open paulNIP opened this issue 2 months ago • 1 comments

Been experiencing issue of opening epub on IOS device on an emulator the it easily works but when on a real device it does not open any help is highly appreciated

paulNIP avatar Apr 26 '24 17:04 paulNIP

please see the installation steps in specific Info.plist section https://github.com/victorsoares96/epubjs-react-native?tab=readme-ov-file#installation

victorsoares96 avatar Apr 26 '24 18:04 victorsoares96

i am using this versions "@epubjs-react-native/core": "1.4.0-beta.45", "@epubjs-react-native/file-system": "^1.1.2", "react-native": "0.72.12", "react-native-webview": "^13.8.5", "react-native-gesture-handler": "^2.16.0",

and i add LSSupportsOpeningDocumentsInPlace this to info.plist but experiencing issue of opening epub on IOS real device (stuck in loading 0%) but not in ios simulators

rashidwiizb avatar Apr 30 '24 12:04 rashidwiizb

try run npx pod-install in your ios directory again after add LSSupportsOpeningDocumentsInPlace key

victorsoares96 avatar Apr 30 '24 13:04 victorsoares96

and use @epubjs-react-native/core: "1.4.1

victorsoares96 avatar Apr 30 '24 13:04 victorsoares96

Is this version have injectjavascript function? Also when i try npx pod install my system ask me a path . So do u have any idea on which path should i give

@victorsoares96

rashidwiizb avatar Apr 30 '24 13:04 rashidwiizb

Yeah, this version have injectJs and contains the fix for this issue.. about pod install you can run npx pod-install ios inside root of your react native project, the first argument after npx pod-install is a path where project ios files are located

victorsoares96 avatar Apr 30 '24 14:04 victorsoares96

I'm developing with expo and facing the same issue on iOS. It works fine when the src is a remote file but not when it's local.

farshed avatar May 01 '24 17:05 farshed

Try to add key mentioned above in expo app.json, see more in expo docs:

{
  "ios": {
    "infoPlist": {
  "LSSupportsOpeningDocumentsInPlace": true
    }
  }
}

https://docs.expo.dev/guides/permissions/#ios

victorsoares96 avatar May 03 '24 02:05 victorsoares96

And if you use expo managed project with expo-document-picker try to use this:

const { assets } = await DocumentPicker.getDocumentAsync({ copyToCacheDirectory: false });

victorsoares96 avatar May 03 '24 15:05 victorsoares96

Adding LSSupportsOpeningDocumentsInPlace to info.plist and setting copyToCacheDirectory to false on iOS worked. Thanks.

farshed avatar May 04 '24 14:05 farshed

awesome! i'll close this issue, the author can reopen if need

victorsoares96 avatar May 04 '24 18:05 victorsoares96