-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
onSingleTap, onDoubleTap, onSwipeUp do not work #324
Comments
I'm having the same problem. |
@FeMaffezzolli I made a simple workaround if you're interested, but I see you are much more experienced than I am! Nonetheless; if you are interested just let me know :) |
Hey @wizzbuzz , Turns out that the warning logs were not preventing the app to work properly. But out of curiosity, what did you do to get rid of the warnings? |
Hi @FeMaffezzolli, sadly I haven't been able to get rid of the warnings. I just added my own gestures outside of the reader component. |
I'm having the same problem(( |
Hi, @wizzbuzz , could you tell me please about your "own gestures outside"? How did you do it? |
Hi @VLadislav9607, of course! Here is my code: const tap = Gesture.Tap()
.onEnd(() => {
// The function you want to be called when tapped
})
.runOnJS(true);
<GestureDetector gesture={tap}>
<Reader
src={params.uri}
fileSystem={useFileSystem}
}}
/>
</GestureDetector> You can read more about the gesture detector here: https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector/ And please let me know if I can help you with anything else. Good luck! |
@wizzbuzz Thank you so much! Good luck too! In my case GestureDetector didn't help me, but I used GestureResponder for this
|
Hi guys, check if the problem still occurs in the latest published version (v1.4.6) |
Hi, @victorsoares96, i have checked, in my case the problem still occurs |
Hi @victorsoares96, I just checked and the problem still occurs. |
Summary
In my app, the gesture handlers for the Reader component do not work at all. They do not run a simple console.log. Besides this, I am getting a warning whenever the Reader is loaded, or swiped to the next page:
(NOBRIDGE) WARN [react-native-gesture-handler] None of the callbacks in the gesture are worklets. If you wish to run them on the JS thread use '.runOnJS(true)' modifier on the gesture to make this explicit. Otherwise, mark the callbacks as 'worklet' to run them on the UI thread. [Component Stack]
Is the problem related to the warning?
Besides, I can not find information on onSingleTap in the documentation. Also, the onPress event seems depricated, while still being mentioned in the docs.
What platform(s) does this occur on?
Android
What workflow(s) does this occur on?
Expo Workflow
Environment (or package.json)
expo-env-info 1.2.1 environment info:
System:
OS: Windows 11 10.0.26100
Binaries:
Node: 22.11.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: AI-242.23339.11.2421.12550806
npmPackages:
expo: ^52.0.11 => 52.0.11
expo-router: ^4.0.9 => 4.0.9
react: 18.3.1 => 18.3.1
react-dom: 18.3.1 => 18.3.1
react-native: ^0.76.3 => 0.76.3
react-native-web: ~0.19.13 => 0.19.13
Expo Workflow: managed
Your .epub file
https://www.gutenberg.org/ebooks/2701
Minimal reproducible example
import React, { useEffect, useState } from "react";
import { Gesture } from "react-native-gesture-handler";
import {
SafeAreaView,
View,
Text,
StatusBar,
StyleSheet,
ActivityIndicator,
Dimensions,
} from "react-native";
import { Reader, useReader } from "@epubjs-react-native/core";
import { useFileSystem } from "@epubjs-react-native/expo-file-system";
import { useLocalSearchParams } from "expo-router";
import { connectToDatabase, getRow } from "../../components/DBManager";
import Colors from "../../constants/Colors";
import CFI from "epub-cfi-resolver";
import Footer from "../../components/Reader/Footer";
const GetDBInfo = async (uri) => {
const db = await connectToDatabase();
const result = await getRow(db, "uploadedBooks", uri);
return result;
};
export default function bookViewer() {
const [params, setParams] = useState(useLocalSearchParams());
const [DBInfo, setDBInfo] = useState(null);
const [hasLoadedPage, setHasLoadedPage] = useState(false);
const [showMenu, setShowMenu] = useState(false);
const { goToLocation, onSingleTap } = useReader();
// Run only once when the page loads.
useEffect(() => {
// Gather information, params, DB info
const fetchData = async () => {
setDBInfo(await GetDBInfo(params.uri));
};
fetchData();
}, []);
const onTapReader = () => {
console.log("Tap");
};
return (
}{hasLoadedPage == false && (
Loading Book
)}
<Reader
src={params.uri}
height={Dimensions.get("screen").height * 0.8}
fileSystem={useFileSystem}
onSingleTap={onTapReader}
onWebViewMessage={(message) => {
if (message.type === "onCfiFromPercentage") {
goToLocation(message.cfi);
}
}}
/>
{showMenu &&
);
}
const styles = StyleSheet.create({
safeAreaContainer: {
flex: 1,
paddingTop: StatusBar.currentHeight,
},
loadingView: {
width: "100%",
height: "100%",
justifyContent: "center",
alignItems: "center",
},
loadingText: {
fontFamily: "outfit",
fontSize: 20,
},
});
I confirm that i have
The text was updated successfully, but these errors were encountered: