Cannot detect field values when used within EmbeddedArrayInput #18
Comments
👍 I would also love if these two plugins could work together :) |
Please provide us a small repository reproducing the problem |
Guys! the same problem! Do anyone solve it? |
This is because https://github.com/MhdSyrwan/aor-embedded-array only prefixes the I was able to work around this issue with a wrapper component for import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { DependentInputComponent, mapStateToProps } from 'aor-dependent-input/lib/DependentInput';
DependentInputComponent.propTypes = {
children: PropTypes.node.isRequired,
show: PropTypes.bool.isRequired,
source: PropTypes.any,
value: PropTypes.any,
resolve: PropTypes.func,
formName: PropTypes.string,
};
const mapStateToPropsOverride = (state, { resolve, source, value, formName }) => {
return mapStateToProps(state, {
// map source prop => dependsOn
dependsOn: source,
resolve, value, formName
});
};
export default connect(mapStateToPropsOverride)(DependentInputComponent); Perhaps this component should use Update: The above doesn't totally solve the issue. It fixes the show/hiding of the fields but child fields are not correctly prefixed by This issue can be worked around by creating a custom DependentInputComponent that utilises the |
@jamesjwarren thanks for this! Do you have a snippet available for your 'update' point? That'd be awesome. Thanks. |
@stephanemombuleau sure here is my version of the component with these modifications https://gist.github.com/jamesjwarren/b0facf05e8a0ce5e5daa987164e571b0 |
@jamesjwarren Great, thanks :) |
When paired with https://github.com/MhdSyrwan/aor-embedded-array, the field values are always undefined:
Data:
Component:
Even if I use
value
orresolve
, the value cannot be detected.To be honest I'm unsure whether the problem is with the
DependentInput
orEmbeddedArrayInput
The text was updated successfully, but these errors were encountered: