import { runOnJS } из 'react-native-worklets';
И вот как я его использую и работаю без проблем:
Код: Выделить всё
const handleSlideInNewPosition = useCallback(
(newPositionsParams: {
currentOffScreen: number;
onScreenValue: number;
}): void => {
const { currentOffScreen, onScreenValue } = newPositionsParams;
setContent({ actions, message, severity });
latestPositionRef.current = position;
translateY.value = withTiming(onScreenValue, {
duration: ANIMATION_DUREATION,
easing: Easing.out(Easing.cubic),
});
if (!isPersistent) {
timerIdRef.current = setTimeout(() => {
translateY.value = withTiming(
currentOffScreen,
{ duration: ANIMATION_DUREATION, easing: Easing.in(Easing.cubic) },
(isFinished) => {
if (isFinished) {
runOnJS(() => { // {
setMounted(false);
hideToaster();
});
}
...
Даже когда я просто запускаю его с пустой функцией, он вылетает так же:
Код: Выделить всё
import { scheduleOnRN } from 'react-native-worklets';
...
if (isFinished) {
scheduleOnRN(() => {
});
}
...
09-26 07:31:52.589 25933 25933 F libc: Фатальный сигнал 11 (SIGSEGV), код 1 (SEGV_MAPERR), адрес ошибки 0x394d28b2cca5d879 в tid 25933 (st.exp.expent), pid 25933 (st.exp.expent)
Это моя настройка React Native, относящаяся к этой проблеме:
- "react-native": "0.81.4"
- "expo": "~54.0.10",
- "react-native-worklets": "0.5.1"
- "react-native-reanimated": "~4.1.0"
- Expo Go 54.0.5
- emulator -avd Pixel_9 54.0.4
- Android Studio: новые функции Narwhal 3 | 2025.1.3
Сборка № AI-251.26094.121.2513.14007798, построенная 28 августа 2025 г.
Среда выполнения: 64-битная серверная виртуальная машина OpenJDK (21.0.7 aarch64) от JetBrains
ОС: macOS 14.3 - Android Debug Bridge версии 1.0.41
Версия 36.0.0-13206524
Работает на Darwin 23.3.0 (arm64)
Подробнее здесь: https://stackoverflow.com/questions/797 ... roid-crash
Мобильная версия