MichaelCereda/react-native-form-generator

Value not getting inserted in formData via Custom Field

bhavinpankanis opened this issue · 0 comments

I am able to retrieve the updated value but its not inserting in formdata {}. Please provide input

My code is as follows:

handleChange(event){
var value = event.nativeEvent.text;

    this.setState({value:value});
 
    console.log('value',value)

    // This updates values in form everytime i update 
    if(this.props.onChange)      this.props.onChange(this.props.fieldRef, value);
    if(this.props.onValueChange) this.props.onValueChange(value);
    console.log('handleChange',formData)
  }

return
<View style={{ flexDirection: "row" }}>

{name}


<TextInput
{...this.props}
ref={name}
style={{ height: 40, borderColor: 'gray', borderWidth: 1 }}
onChange={this.handleChange.bind(this)}
editable={true}
placeholder={placeHolder}
value={value}
style={styles.TextInputStyleClass}
/>


var styles = StyleSheet.create({
MainContainer: {
// Setting up View inside content in Vertically center.
justifyContent: 'center',
flex: 1,
margin: 10
},
TextInputStyleClass: {
textAlign: 'center',
height: 50,
borderWidth: 2,
borderColor: '#FF5722',
borderRadius: 20,
backgroundColor: "#FFFFFF"
},
baseText: {
fontFamily: 'Cochin',
},
});