fix(welcome-page): prevent form submit to prevent page refresh
This commit is contained in:
parent
358ce0799e
commit
b76ab305e3
|
@ -55,6 +55,7 @@ class WelcomePage extends AbstractWelcomePage {
|
||||||
'welcome-page-additional-content-template');
|
'welcome-page-additional-content-template');
|
||||||
|
|
||||||
// Bind event handlers so they are only bound once per instance.
|
// Bind event handlers so they are only bound once per instance.
|
||||||
|
this._onFormSubmit = this._onFormSubmit.bind(this);
|
||||||
this._onRoomChange = this._onRoomChange.bind(this);
|
this._onRoomChange = this._onRoomChange.bind(this);
|
||||||
this._setAdditionalContentRef
|
this._setAdditionalContentRef
|
||||||
= this._setAdditionalContentRef.bind(this);
|
= this._setAdditionalContentRef.bind(this);
|
||||||
|
@ -121,7 +122,7 @@ class WelcomePage extends AbstractWelcomePage {
|
||||||
<div id = 'new_enter_room'>
|
<div id = 'new_enter_room'>
|
||||||
<form
|
<form
|
||||||
className = 'enter-room-input'
|
className = 'enter-room-input'
|
||||||
onSubmit = { this._onJoin }>
|
onSubmit = { this._onFormSubmit }>
|
||||||
<FieldTextStateless
|
<FieldTextStateless
|
||||||
autoFocus = { true }
|
autoFocus = { true }
|
||||||
id = 'enter_room_field'
|
id = 'enter_room_field'
|
||||||
|
@ -153,6 +154,19 @@ class WelcomePage extends AbstractWelcomePage {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevents submission of the form and delagates join logic.
|
||||||
|
*
|
||||||
|
* @param {Event} event - The HTML Event which details the form submission.
|
||||||
|
* @private
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
_onFormSubmit(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
this._onJoin();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the super to account for the differences in the argument types
|
* Overrides the super to account for the differences in the argument types
|
||||||
* provided by HTML and React Native text inputs.
|
* provided by HTML and React Native text inputs.
|
||||||
|
|
Loading…
Reference in New Issue