Open NgocNovus opened 1 year ago
I have tried to reproduce it but it works for me 😯 Does it happen on real device also or just on simulator?
I test on real device ios and release mode. i'll send video for you tomorrow
@piaskowyk Hi, sorry for late reply. I tried to test on IOS 14.4.2 - Real device - Release Mode. My steps:
Thanks for providing me this informations! It'll help a lot! I'll try it and let you know.
All day I tried to reproduce it but without success 😕 I tested it on:
Do you have any suggestion how I can reproduce it?
All day I tried to reproduce it but without success 😕 I tested it on:
- Reanimated Example app
- I tested two examples:
- physical iPhone 13 mini
- iOS 16.0
- Low power mode
- Low and High memory pressure
- Debug and Release mode
- I tested also two scenerios:
- Run animation and press lock button
- Run animation, move app to background and lock phone
Do you have any suggestion how I can reproduce it?
Do you wait 5minutes after press lock button? After lock 5m, open your phone and open your app
Hi @piaskowyk , you can watch my video to see the issue: important: Don't charger plugged in Drive video: https://drive.google.com/file/d/1Dz1Q2qCGAi8UlhJo8PAETKs__15s8xdM/view?usp=sharing My code:
import React, {useEffect, useState} from 'react';
import {View, Text, SafeAreaView, StyleSheet} from 'react-native';
import {
Easing,
runOnJS,
useAnimatedReaction,
useSharedValue,
withTiming,
} from 'react-native-reanimated';
const TIME = 15 * 60;
const App = () => {
// state
const [text, setText] = useState<string>('');
const count = useSharedValue(TIME);
// effect
useAnimatedReaction(
() => Math.round(count.value),
v => {
runOnJS(setText)(v.toString());
},
);
useEffect(() => {
count.value = withTiming(0, {duration: TIME * 1000, easing: Easing.linear});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// render
return (
<SafeAreaView style={styles.root}>
<View style={styles.content}>
<Text style={styles.text}>{text}</Text>
</View>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
root: {
flex: 1,
},
content: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
text: {
fontSize: 36,
fontWeight: 'bold',
},
});
export default App;
My package.json:
{
"name": "Timer",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"react": "18.2.0",
"react-native": "0.71.11",
"react-native-reanimated": "^3.3.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native-community/eslint-config": "^3.2.0",
"@tsconfig/react-native": "^2.0.2",
"@types/jest": "^29.2.1",
"@types/react": "^18.0.24",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.2.1",
"eslint": "^8.19.0",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.73.10",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"typescript": "4.8.4"
},
"jest": {
"preset": "react-native"
}
}
I think IOS killed reanimated thread
I'll try it on android, then send video for you
I know no charger is too hard to debug. i think reanimted should re-calculate shareValue when app will active. pause while app in background. inative we can keep update shareValue.
i confirm that android too. Android: turn on battery optimization
any update?
Hi @masonle2x2 @NgocNovus, I've been trying to reproduce the issue. For me, when I reopened the app, the animation was still running. It however was displaying a wrong value (the timer moved about 30 seconds in those 10 minutes). Is this the issue you are facing, or does the animation stop completely? I cannot access the video you sent, so I unfortunately can't see for myself.
Hi @bartlomiejbloniarz , thank for the reply. In my case, animation stopped. I think in the save power mode, OS did something to kill animated process. if u turn on save power mode but u still plug the charging, animation still good.
@masonle2x2 Have you encountered a device that doesn't have this issue? I was testing it on iPhone 12 mini and couldn't get the animation to stop. I had it unplugged with Low Energy mode enabled.
@masonle2x2 Have you encountered a device that doesn't have this issue? I was testing it on iPhone 12 mini and couldn't get the animation to stop. I had it unplugged with Low Energy mode enabled.
Yeah. I cant check right now. I can provide in next week. Sorry about that
Description
I create 1 timer (15m) to show popup when timer update to 0. I use withTiming with duration 15 60 1000 to create the timer. After run about 10m, i go back the app. the timer stopped I think reanimated thread be killed by IOS
Steps to reproduce
Update: IMPORTANT: Don't charger plugged in
Snack or a link to a repository
https://snack.expo.dev/@ngoc.le/timing-animated
Reanimated version
3.1.0
React Native version
0.71.8
Platforms
iOS Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
Release mode
Device
Real device
Device model
Iphone 11
Acknowledgements
Yes