davidkpiano / react-redux-form

Create forms easily in React with Redux.
https://davidkpiano.github.io/react-redux-form
MIT License
2.07k stars 251 forks source link

Custom components with React native #906

Open batusai513 opened 7 years ago

batusai513 commented 7 years ago

The Problem

It is possible to use a custom components with the control imported from 'react-redux-form/native', using a custom input from 'react-native-elements' into the component property that has the same API as the TextInput from react native.

Steps to Reproduce

import { FormInput } from 'react-native-elements';
import { Control, Form } from 'react-redux-form/native';

// then

export const Comp = (props) => (
  <Form model="rrf.model">
    <Control model=".someModelProp" component={FormControl} />
  </Form>
);

Expected Behavior

if the user inputs "asd" the value from rrf.model.someModelProp should be "asd"

Actual Behavior

I got undefined in rrf.model.someModelProp

Thanks in advanced for your help.

davidkpiano commented 7 years ago

Can you please make a reproducible CodePen example? Or codesandbox.io

batusai513 commented 7 years ago

@davidkpiano thanks for your fast response, given that this is a react-native app, i cannot make a codepen or codesandbox, instead i made a basic create-react-native app here react-redux-form-example, you just need to install it and run it with yarn start, there is an error with react-redux form you can reference from here https://github.com/davidkpiano/react-redux-form/issues/792 , let me know if this has worked for you!.

Thanks again.

batusai513 commented 7 years ago

@davidkpiano any updates on this one?

davidkpiano commented 7 years ago

I'll probably be able to take a look this weekend. If you want to dig into the source code, some help would be nice 😄