Expo 54: Scrolling is broken on iOS/Android and positioning is off on Android
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- react-native, typescript
- Área
- mobile
Línea de trabajo
Comienza localizando el código fuente de CopilotProvider correspondiente a dist/index.js y lee src/components/CopilotStep.tsx; después, reproduce el comportamiento de desplazamiento y posicionamiento en una aplicación de Expo 54 en iOS y Android. Compara el diff reportado con el código fuente y verifica que el desplazamiento del recorrido y el posicionamiento de los pasos sean correctos en ambas plataformas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi! 👋
Firstly, thanks for your work on this project! 🙂
As I have clarified in the title, there are scroll and positioning related issues when we use this package in a project built with Expo 54
Here is the diff that solved my problem:
diff --git a/node_modules/react-native-copilot/dist/index.js b/node_modules/react-native-copilot/dist/index.js
index 3aff2e2..ad074f8 100644
--- a/node_modules/react-native-copilot/dist/index.js
+++ b/node_modules/react-native-copilot/dist/index.js
@@ -893,7 +893,7 @@ var CopilotProvider = (_a) => {
const copilotEvents = (0, import_react8.useRef)((0, import_mitt.default)()).current;
const modal = (0, import_react8.useRef)(null);
const [visible, setVisibility] = useStateWithAwait(false);
- const [scrollView, setScrollView] = (0, import_react8.useState)(null);
+ const scrollViewRef = (0, import_react8.useRef)(null);
const {
currentStep,
currentStepNumber,
@@ -927,20 +927,17 @@ var CopilotProvider = (_a) => {
);
const setCurrentStep = (0, import_react8.useCallback)(
(step, move = true) => __async(void 0, null, function* () {
- var _a2;
setCurrentStepState(step);
copilotEvents.emit("stepChange", step);
- if (scrollView != null) {
- const nodeHandle = (0, import_react_native7.findNodeHandle)(scrollView);
- if (nodeHandle) {
- (_a2 = step == null ? void 0 : step.wrapperRef.current) == null ? void 0 : _a2.measureLayout(
- nodeHandle,
- (_x, y, _w, h) => {
- const yOffset = y > 0 ? y - h / 2 : 0;
- scrollView.scrollTo({ y: yOffset, animated: false });
- }
- );
- }
+ if (scrollViewRef.current != null && step?.wrapperRef.current) {
+ step.wrapperRef.current.measure((_x, _y, _w, h, _pageX, pageY) => {
+ if (pageY !== undefined && h !== undefined) {
+ // Scroll so element appears in upper portion of screen
+ // leaving room for tooltip below
+ const yOffset = Math.max(0, pageY - 150);
+ scrollViewRef.current.scrollTo({ y: yOffset, animated: false });
+ }
+ });
}
setTimeout(
() => {
@@ -948,16 +945,17 @@ var CopilotProvider = (_a) => {
void moveModalToStep(step);
}
},
- scrollView != null ? 100 : 0
+ scrollViewRef.current != null ? 100 : 0
);
}),
- [copilotEvents, moveModalToStep, scrollView, setCurrentStepState]
+ [copilotEvents, moveModalToStep, setCurrentStepState]
);
const start = (0, import_react8.useCallback)(
(fromStep, suppliedScrollView = null) => __async(void 0, null, function* () {
- if (scrollView == null) {
- setScrollView(suppliedScrollView);
+ if (suppliedScrollView != null) {
+ scrollViewRef.current = suppliedScrollView;
}
+
const currentStep2 = fromStep ? steps[fromStep] : getFirstStep();
if (startTries.current > MAX_START_TRIES) {
startTries.current = 0;
@@ -980,7 +978,6 @@ var CopilotProvider = (_a) => {
copilotEvents,
getFirstStep,
moveModalToStep,
- scrollView,
setCurrentStep,
setVisibility,
steps
@@ -1071,6 +1068,7 @@ function walkthroughable(WrappedComponent) {
// src/components/CopilotStep.tsx
var import_react11 = __toESM(require("react"));
+var import_react_native9 = require("react-native");
var CopilotStep = ({
name,
order,
@@ -1086,9 +1084,15 @@ var CopilotStep = ({
const measure2 = () => {
if (wrapperRef.current != null && "measure" in wrapperRef.current) {
wrapperRef.current.measure((_ox, _oy, width, height, x, y) => {
+ // Adjust for Android status bar
+ let adjustedY = y;
+ if (import_react_native9.Platform.OS === 'android') {
+ const statusBarHeight = import_react_native9.StatusBar.currentHeight || 0;
+ adjustedY = y + statusBarHeight;
+ }
resolve({
x,
- y,
+ y: adjustedY,
width,
height
});
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.4k
- Forks
- 425
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de mohebifar/react-native-copilot
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
mohebifar/react-native-copilot#354 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
mohebifar/react-native-copilot#349 · 11 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 15/100
mohebifar/react-native-copilot#348 · 2 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Todos los issues de mohebifar/react-native-copilot
Issues similares
-
Resources: New templates of Beijing SubwayPosiblemente ocupada @rmt-svc la tomó hoy. Abiertoresources
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
railmapgen/rmg-templates#2726 ·
Los mantenedores suelen responder en 1 día
-
needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
homarr-labs/homarr#7729 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Buzzpy/Dev-Encyclopedia#218 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
prio:low status:done type:content
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
davidsneighbour/samui-samui.de#1925 ·