Skip to content

Tag: react-native

Jest coverage tools fail

During in my react-native project, during test execution, Jest shows coverage and creates coverage reports. Jest config: During testing I get errors: in files which are generated during creation of coverage folder: So, in jest documentation we see that we can specify jsdom environment in file which produces e…

How to avoid re rendering text input?

I have a TextInput and I don’t want it to re render every time I change the value inside it but I want to be able to change the value inside the input at the push of a button that’s why I haven’t just used defaultValue any solutions?? Answer You can use useRef to save text from text input wi…

How to detect a frozen video stream in WebRTC

Unfortunately, from time to time when making a one-on-one video call using react-native-webrtc one of the two video streams freezes or becomes black. Is there a way to detect when that happens programmatically? Thx in advance! Answer It looks like each video track has a listener that fires as soon as the stre…

react native useState is not incrementing counter

When counter is >= data Array length setLoading should trigger. But counter is not being incrementing until I refresh app by pressing CTRL+S then counter increment itself by 1 every time app refreshes. Answer Updating state is an asynchronous operation, so getting loopCount in for loop will get the initial…