bamlab / bamlab/react-native-formik

TypeError: undefined is not an object (evaluating '(i === 0 ? obj : resVal)[pathArray[i]]')

Open
#142 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
398
Forks
50
PR merge metrics
No merged PRs in 30d

Description

I'm basically using the demo Gist verbatim:

[https://snack.expo.io/@almouro/react-native-formik-gist](url)

When I type a single letter into any text field I get the error:

> TypeError: undefined is not an object (evaluating '(i === 0 ? obj : resVal)[pathArray[i]]')

I tried removing validationSchema and I still got the error. Separately, I tried removing withNextInputAutoFocusForm and withNextInputAutoFocusInput, and still got the problem. It feels like a bug in handleTextInput. Maybe I'm doing something stupid in the syntax below.

From `package.json`:

```
"formik": "^2.1.4",
"react-native-formik": "^1.7.8",
"react-native-material-textfield": "^0.16.1",
"recompose": "^0.30.0",
"yup": "^0.28.3"
```

Code:
```
import React from 'react';
import { Button, ScrollView, View } from 'react-native';
import { compose } from 'recompose';
import { Formik } from 'formik';
import * as Yup from 'yup';
import {
handleTextInput,
withNextInputAutoFocusForm,
withNextInputAutoFocusInput
} from 'react-native-formik';
import { OutlinedTextField } from 'react-native-material-textfield';

const MyInput = compose(
handleTextInput,
withNextInputAutoFocusInput
)(OutlinedTextField);
const Form = withNextInputAutoFocusForm(View);

const validationSchema = Yup.object().shape({
country: Yup.string()
.required('Required.')
.length(2, 'Must be 2 letter country code.'),
});

const RegistrationForm = props => (
console.log(values)}
validationSchema={validationSchema}
>
{props => (












)}

);

export default class MyScreen extends React.Component {
render() {
return (



);
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.