I am using React Native Switch. I want to write a unit test (using jest and testing-library/react-native) for its value prop. But there is no value in its props
My use case is there will be a default value for the Switch when the page load. But I can not find a way to check the Switch value. Is there a correct way to check if its value is true or false?
Picture attached is the Switch's list of props
You can check the value of the prop like this, including if it works when you change it:
Assuming your component looks something like this:
with somthing like
const [value, toggleValue] = useState(false);for the value. Let me know if this doesn't work for you, please also add the component and the test you have now. It is hard to say what's going wrong without seeing that