The problem of the new React Native
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- react-native
- Área
- mobile-dev
Línea de trabajo
Comienza en el punto de entrada useCopilot().start y sigue cómo scrollViewRef se proporciona a ref.measureLayout al ejecutar el SettingsScreenMock proporcionado en React Native 0.79.6 con Fabric. Reproduce el fallo del desplazamiento automático al cambiar entre pasos y, después, verifica que las transiciones del tutorial se desplacen hasta cada componente walkthroughable sin el error native-ref.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Current Behavior
auto scroll doesn't work when switching between blocks - ref.measureLayout must be called with a ref to a native component.
import React, { useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { ScrollView, Text, TouchableOpacity, View, SafeAreaView, RefreshControl } from 'react-native';
import { CopilotProvider, CopilotStep, useCopilot, walkthroughable } from 'react-native-copilot';
import getCopilotLabel from '../../../../src/utils/helpers/getCopilotLabel';
import styles from './styles';
const WalkthroughableTouchableOpacity = walkthroughable(TouchableOpacity);
const mockSettingsData = [
{ id: '1', title: 'Wi-Fi Settings', type: 'setting' },
{ id: '2', title: 'Notification Settings', type: 'setting' },
{ id: '3', title: 'Sound Settings', type: 'setting' },
{ id: '4', title: 'Display Settings', type: 'setting' },
{ id: '5', title: 'Privacy Settings', type: 'setting' },
{ id: '7', title: 'Delete Device', type: 'danger' },
{ id: '8', title: 'Sound Settings', type: 'setting' },
{ id: '9', title: 'Display Settings', type: 'setting' },
{ id: '10', title: 'Privacy Settings', type: 'setting' },
{ id: '11', title: 'Delete Device', type: 'danger' },
{ id: '12', title: 'Sound Settings', type: 'setting' },
{ id: '13', title: 'Sound Settings', type: 'setting' },
{ id: '14', title: 'Display Settings', type: 'setting' },
{ id: '15', title: 'Privacy Settings', type: 'setting' },
{ id: '16', title: 'Delete Device', type: 'danger' },
{ id: '17', title: 'Sound Settings', type: 'setting' },
{ id: '18', title: 'Display Settings', type: 'setting' },
{ id: '19', title: 'Privacy Settings', type: 'setting' },
{ id: '20', title: 'Delete Device', type: 'danger' },
];
const SettingsScreenMock = () => {
const { start } = useCopilot();
const scrollViewRef = useRef(null);
const [refreshing, setRefreshing] = useState(false);
const onRefresh = () => {
setRefreshing(true);
setTimeout(() => setRefreshing(false), 1000);
};
const startTutorial = () => {
start(false, scrollViewRef.current);
};
return (
<SafeAreaView style={{ flex: 1 }}>
<View style={{ padding: 16 }}>
<TouchableOpacity onPress={startTutorial} style={{ padding: 10, backgroundColor: '#007AFF', borderRadius: 8, marginBottom: 16 }}>
<Text style={{ color: 'white', textAlign: 'center' }}>Start Tutorial</Text>
</TouchableOpacity>
</View>
<ScrollView ref={scrollViewRef} style={{ flex: 1 }} refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} tintColor='#007AFF' />}>
{mockSettingsData.map((item, index) => (
<CopilotStep key={item.id} name={`step-${index}`} order={index} text={`This is step ${index + 1}: ${item.title}`}>
<WalkthroughableTouchableOpacity
style={{
padding: 16,
borderBottomWidth: 1,
marginBottom: 50,
borderBottomColor: '#EEE',
backgroundColor: item.type === 'danger' ? '#FFF0F0' : 'white',
}}
>
<Text style={{ color: item.type === 'danger' ? '#FF3B30' : '#000' }}>{item.title}</Text>
</WalkthroughableTouchableOpacity>
</CopilotStep>
))}
{/* Дополнительные элементы для прокрутки */}
{Array.from({ length: 10 }).map((_, index) => (
<View key={`extra-${index}`} style={{ padding: 20, backgroundColor: index % 2 === 0 ? '#F5F5F5' : 'white' }}>
<Text>Additional item {index + 1}</Text>
</View>
))}
</ScrollView>
</SafeAreaView>
);
};
const SettingsContainer = () => {
const { t } = useTranslation('guides');
const labels = getCopilotLabel(t);
return (
<CopilotProvider tooltipStyle={styles.copilot} stopOnOutsideClick androidStatusBarVisible labels={labels}>
<SettingsScreenMock />
</CopilotProvider>
);
};
export default SettingsContainer;
Environment
- Device: [e.g. iPhone 8 Simulator]
- OS: [e.g. iOS12]
react-native-copilot: 3.3.3
"react-native": "^0.79.6",
"react-native-svg": "15.12.x",
Possible Solution
It is necessary to change the logic of working with the ref, because it changed when connecting Fabric
Additional context/Screenshots
https://github.com/user-attachments/assets/17ae6d94-d22c-4273-b883-e2d36018246f
- 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 3/5 1-2 días Aptitud para principiantes 55/100
mohebifar/react-native-copilot#351 · 1 comentario · 1 reacción ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
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 ·