Skip to content

Input ref in modal problem #223

@detrandix

Description

@detrandix

Hello, in this code in renderOverlay function:

<Modal title="Modal Title" onRequestHide={this.handleToggle}>
    <div className="modal-body">
        <Input
            type="text"
            defaultValue={this.props.defaultValue}
            ref="input" />
    </div>
    <div className="modal-footer">
        <Button onClick={this.handleToggle}>Close</Button>
        <Button bsStyle="primary" onClick={this.saveChange}>Save change</Button>
    </div>
</Modal>

i get following error:

Uncaught Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. This usually means that you're trying to add a ref to a component that doesn't have an owner (that is, was not created inside of another component's `re...<omitted>...f. 

Is there any solution, how to ref input in modal body?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions