futurepress / epubjs-rn

EpubJS React Native Example
Other
270 stars 151 forks source link

onLocationChange not getting called after update to 0.0.99 #54

Open MustansirZia opened 7 years ago

MustansirZia commented 7 years ago

Hi! I just experienced an issue while upgrading from 0.0.80 to 0.0.99. After the update, onLocationChange handler isn't getting called when I change the page and as such I'm not able to save progress inside the reader. I dug a little deeper and found out that the correct event (relocated) isn't getting dispatched to the _onBridgeMessage function inside components/Rendition.js from the WebView. To verify it I put alerts in the following code just like this:

case"relocated":{
    alert('relocated'); // Here. This isn't dispatched.
    var _decoded=
decoded,location=_decoded.location;
this._relocated(location);
break;
}
case"press":{
this.props.onPress&&this.props.onPress(decoded.cfi,this);
break;
}
case"longpress":{
    alert('longpress'); // And here. This is dispatched.
this.props.onLongPress&&this.props.onLongPress(decoded.cfi,this);
break;
}

The longpress alert is occuring but the relocated alert isn't getting called. Thus the onLocationChange handler in the higher API isn't getting called as a result. I've updated my deps to the latest ones and copied them from the example app. My package.json looks like this.

 "dependencies": {
    "axios": "^0.16.2",
    "babel-polyfill": "^6.23.0",
    "epubjs-rn": "^0.0.99",
    "expo": "17.0.0",
    "pouchdb-adapter-asyncstorage": "^6.2.6",
    "react": "16.0.0-alpha.6",
    "react-native": "https://github.com/expo/react-native/archive/sdk-17.0.0.tar.gz",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-fs": "^2.5.1",
    "react-native-localization": "^0.1.31",
    "react-native-orientation": "^3.0.0",
    "react-native-popup-menu": "^0.8.0",
    "react-native-root-toast": "https://github.com/mranile/react-native-root-toast",
    "react-native-static-server": "^0.1.8",
    "react-native-tab-view": "0.0.66",
    "react-native-zip-archive": "http://github.com/mockingbot/react-native-zip-archive",
    "react-navigation": "^1.0.0-beta.11",
    "react-redux": "^5.0.5",
    "redux": "^3.7.2",
    "redux-persist": "^4.8.2",
    "redux-thunk": "^2.2.0",
    "rxdb": "^5.2.1",
    "rxjs": "^5.4.2"
  },

Occurs for both Android as well as iOS. I'm using a detached expo app which uses ExpoKit 17.0.0.

fchasen commented 7 years ago

What version of epubjs do you have installed? Can you make sure it the latest?

MustansirZia commented 7 years ago

0.3.46. Just checked in my node_modules. I think that's the latest.