react-native-form-generator icon indicating copy to clipboard operation
react-native-form-generator copied to clipboard

Value not getting inserted in formData via Custom Field

Open bhavinpankanis opened this issue 7 years ago • 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 <Field> <View style={{ flexDirection: "row" }}> <Text numberOfLines={5}> {name} </Text> <View style={styles.MainContainer}> <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} /> </View> </View> </Field>

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', }, });

bhavinpankanis avatar Jan 12 '18 14:01 bhavinpankanis