title: Failed Testing Switch React Native with Testing Library
body: <p>I'm getting the following error when trying to simulate an event using fireEvent  &quot;onChange&quot; : &quot;TypeError: Cannot read property 'value' of undefined&quot;</p>
  <p>My component :</p>
  <pre><code>const [isActive, setIsActive] = useState&lt;boolean&gt;(policy_value);
  
    const handleChangeSwitch = () =&gt; { 
      const value = !isActive;
      settingsService.updatePolicy(id, value);
      setIsActive(!isActive);
    };
  
      &lt;Switch value={isActive}  onChange={handleChangeSwitch} testID=&quot;policy-switch&quot;/&gt;
  </code></pre>
  <p>My test:</p>
  <pre><code>const { getByTestId } = render(&lt;Policy data={mockPolicy} /&gt;);
  
  let switchButton = getByTestId(&quot;policy-switch&quot;)
  
  fireEvent(switchButton, &quot;onChange&quot;, { value: true });
  
  expect(settingsService.updatePolicy).toHaveBeenCalled();
  </code></pre>
  <p>I tried:</p>
  <pre><code>fireEvent(switchButton, &quot;onChange&quot;, { value: true });
  fireEvent(switchButton, &quot;onChange&quot;, true);
  fireEvent(switchButton, &quot;onChange&quot;);
  </code></pre>