Skip to content

Picker does not appear #127

Description

@funk101

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>
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions