Skip to content
5 changes: 5 additions & 0 deletions src/components/RoomNameInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ class RoomNameInput extends Component {
if (prevState.error !== this.state.error) {
this.props.onChangeError(this.state.error);
}

// If the selected policyID has changed we need to check if the room name already exists on this new policy.
if (prevProps.policyID !== this.props.policyID) {
this.checkAndModifyRoomName(this.state.roomName);
}
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/pages/workspace/WorkspaceNewRoomPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class WorkspaceNewRoomPage extends React.Component {
<View style={styles.mb5}>
<Text style={[styles.formLabel]}>{this.props.translate('newRoomPage.roomName')}</Text>
<RoomNameInput
onChangeText={(roomName) => { this.setState({roomName}); }}
onChangeText={roomName => this.setState({roomName})}
onChangeError={error => this.setState({error})}
initialValue={this.state.roomName}
policyID={this.state.policyID}
/>
Expand Down