Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picker does not appear #127

Open
funk101 opened this issue Aug 9, 2019 · 0 comments
Open

Picker does not appear #127

funk101 opened this issue Aug 9, 2019 · 0 comments

Comments

@funk101
Copy link

funk101 commented Aug 9, 2019

I'm using your example code "MyPicker" no matter what I try, the Picker does not show. I'm using iOS. My code, which is essentially your example. What has changed?

import React from "react";
import { Button, TextInput, Text, View } from "react-native";
import {Formik} from 'formik'
import {compose} from 'recompose'
import makeInput, {handleTextInput,
        withNextInputAutoFocusForm,
        withNextInputAutoFocusInput,
        KeyboardModal,
        withPickerValues
} from 'react-native-formik'
import { TextField } from "react-native-material-textfield";
import * as Yup from 'yup'

const FormikInput = compose(
    handleTextInput,
    withNextInputAutoFocusInput
)(TextField)

const MyPicker = compose(
    makeInput,
    withPickerValues
)(TextInput)

const InputsContainer = withNextInputAutoFocusForm(View)

const validationSchema = Yup.object().shape({
    email: Yup.string()
        .required()
        .email("That's not a valid email"),
    password: Yup.string()
        .required()
        .min(3, "That's too small"),
    gender: Yup.string()
})

export default ThisForm => (
    <Formik
        onSubmit={values => {KeyboardModal.dismiss(); console.log(values)}}
        validationSchema={validationSchema}
    >
        {props => {
            return (
                <InputsContainer style={{ padding: 10 }}>
                    <FormikInput label="email" name="email" type="email" />
                    <FormikInput label="password" name="password" type="password" />
                    <MyPicker
                        name="gender"
                        values={[{label: 'male', value: 'M'}, {label: 'female', value: 'F'}]}
                    />
                    <Button onPress={props.handleSubmit} title="Submit" />
                    
                    {/* <Text style={{fontSize: 20}}>{JSON.stringify(props, null, 2)}</Text> */}
                </InputsContainer>
            )
        }}
    </Formik>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant