You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In React Native application I have a component with "Clear" button which suppose to clear TextInput. Application works fine and clears the field without any exceptions but test fails with error:
FAIL js/components/searchInput/SearchInput.tests.js
● SearchInput › should clear input value
Invariant Violation: TextInput "viewConfig" is not defined.
at invariant (node_modules/fbjs/lib/invariant.js:38:15)
at Component.setNativeProps (node_modules/react-native/Libraries/Renderer/src/renderers/native/NativeMethodsMixin.js:145:1)
at Component.clear (node_modules/react-native/Libraries/Components/TextInput/TextInput.js:576:6)
at SearchInput.clear (js/components/searchInput/SearchInput.js:17:12)
at Object.<anonymous> (js/components/searchInput/SearchInput.tests.js:20:24)
describe('SearchInput',()=>{beforeAll(()=>{jest.mock('TouchableOpacity',()=>'TouchableOpacity');});it('should clear input value',()=>{constcomponent=renderer.create(<SearchInputdefaultValue="Test"/>,);lettree=component.toJSON();expect(tree).toMatchSnapshot();// Simulate click on Clear buttontree.children[1].props.onPress();tree=component.toJSON();expect(tree).toMatchSnapshot();});});
Is 'react-test-renderer' initializes components differently than react-native or is it related to 'ref' property? Maybe there is a recommended way to test such case without causing an error?
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
In React Native application I have a component with "Clear" button which suppose to clear TextInput. Application works fine and clears the field without any exceptions but test fails with error:
Component itself:
Test:
Is 'react-test-renderer' initializes components differently than react-native or is it related to 'ref' property? Maybe there is a recommended way to test such case without causing an error?
The text was updated successfully, but these errors were encountered: