fix softInputMode set too soon

This commit is contained in:
Martin Guillon
2020-11-16 09:44:58 +01:00
parent 7d75c6f42c
commit 99a11e832c

View File

@ -232,6 +232,16 @@ function initializeDialogFragment() {
owner._setupAsRootView(this.getActivity()); owner._setupAsRootView(this.getActivity());
owner._isAddedToNativeVisualTree = true; owner._isAddedToNativeVisualTree = true;
// we need to set the window SoftInputMode here.
// it wont work is set in onStart
const window = this.getDialog().getWindow();
if (this._windowSoftInputMode !== undefined) {
window.setSoftInputMode(this._windowSoftInputMode);
} else {
// the dialog seems to not follow the default activity softinputmode,
// thus set we set it here.
window.setSoftInputMode((<androidx.appcompat.app.AppCompatActivity>owner._context).getWindow().getAttributes().softInputMode);
}
return owner.nativeViewProtected; return owner.nativeViewProtected;
} }
@ -246,20 +256,8 @@ function initializeDialogFragment() {
} }
const owner = this.owner; const owner = this.owner;
if (owner) { if (owner && !owner.isLoaded) {
if (!owner.isLoaded) { owner.callLoaded();
owner.callLoaded();
}
const window = this.getDialog().getWindow();
if (this._windowSoftInputMode !== undefined) {
window.setSoftInputMode(this._windowSoftInputMode);
} else {
// the dialog seems to not follow the default activity softinputmode,
// thus set we set it here.
window.setSoftInputMode((<androidx.appcompat.app.AppCompatActivity>owner._context).getWindow().getAttributes().softInputMode);
}
} }
this._shownCallback(); this._shownCallback();