import { runOnJS } from 'react-native-worklets';
And this is how I use it and working with no Проблема: < /p>
Код: Выделить всё
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(() => { //
[code] * @param fun - A reference to a function you want to execute on the JavaScript
* thread from the UI thread.
* @returns A function that accepts arguments for the function passed as the
* first argument.
* @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnJS
*/
/** @deprecated Use `scheduleOnRN` instead. */
export function runOnJS(
import { scheduleOnRN } from 'react-native-worklets';
...
if (isFinished) {
scheduleOnRN(() => {
setMounted(false);
hideToaster();
});
}
...
< /code>
Это больше не оставляет намека на ошибку Eslint, но ... каждый раз, когда его вызывают, мое приложение на эмуляторе Android уходит! Тем не менее, это не вызывает проблемы в Интернете.import { scheduleOnRN } from 'react-native-worklets';
...
if (isFinished) {
scheduleOnRN(() => {
});
}
...
< /code>
Журнал из adb logcat < /code>: < /p>
09-26 07: 31: 52,589 25933 25933 F libc: фатальный сигнал 11 (Sigsegv), Code 1 (segv_maperr), bull addr 0x394b28b28. 25933 (St.Exp.Exponent), PID 25933 (St.Exp.Exponent) < /p>
< /blockquote>
Это моя нативная настройка, относящаяся к этой проблеме: < /p>
"react-native": "0.81.4" < /li>
". "~ 54.0.10", < /li>
"React-National-Worklets": "0.5.1" < /li>
"React-cnative-reanimated": "~ 4.1.0" < /li>
< /ul>
Я бегаю на андроид-эмулятор: < /p>
expo expo>
54.0.5 < /li>
эмулятор -Avd pixel_9 54.0.4 < /li>
Android Studio: Narwhal 3 Drop | 2025.1.3
Build #AI-251.26094.121.2513.14007798, построенный 28 августа 2025 года
Runtime: OpenJDK 64-битный сервер VM (21.0.7 AARCH64) от Jetbrains
OS: Macos 14.3 < /li>
и DELBREAN. /> Версия 36.0.0-13206524
работает на Дарвине 23.3.0 (ARM64) < /li>
< /ul>
Подробнее здесь: https://stackoverflow.com/questions/797 ... roid-crash
Мобильная версия