React native input mask testing with jest
See original GitHub issueEven after mocking the react-native-text-input-mask. I am getting following error. Please help make out here I am not performing any operations from test suite just rendering the screen.
This is how I am using TextInput
<TextInput
style={{...inputFields}}
theme={
screenValidations && screenValidations.dateOfBirthCheck
? InputFieldErrorTheme
: InputFieldTheme
}
mode="outlined"
onChangeText={dateOfBirthText => setDateOfBirth(dateOfBirthText)}
value={txtDateOfBirth}
placeholder="dd/mm/yyyy"
label={Constants.LABELDATEOFBIRTH}
right={
<TextInput.Icon name={CalendarIcon} onPress={() => showModal()} />
}
render={props => <TextInputMask {...props} mask="[00]/[00]/[0000]" />}
/>
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Developers - React native input mask testing with jest - - Bountysource
Even after mocking the react-native-text-input-mask. I am getting following error. Please help make out here I am not performing any operations from test...
Read more >How to unit test masked input? - Stack Overflow
How to unit test the masked input field using react-testing-library. That component has developed using material ui and react-hook-form.
Read more >react-input-mask-jest-dom-bug - CodeSandbox
skratchdotskratchdot. Environmentcreate-react-app. Files. public. src. app.js. app.test.js. helper.js. index.js. styles.css. package.json. Dependencies.
Read more >react-native-text-input-mask - npm package - Snyk
Learn more about react-native-text-input-mask: package health score, popularity, ... Testing. Jest. Make sure to mock the following to jest.setup.js :
Read more >[Solved]-How to unit test masked input?-Reactjs - appsloveworld
How to unit test a react event handler that contains history.push using Jest and Enzyme? How to unit test Next.js dynamic components? ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MikePolen I was struggling with this and tried a bunch of solutions until I ran into this in the Jest docs: https://jestjs.io/docs/tutorial-react-native#mock-native-modules-using-jestmock So I just added the following mock to my
jest.setup.js
file:jest.mock('react-native-text-input-mask', () => 'TextInputMask')
It worked like a charm on my end. Hope it helps.I’m using input method instead of change and it’s working.