Nativescript角度アプリを作成しています。私のアプリの検索バーを作成するときに、非常に奇妙な動作に気づいた。検索バーはIOSのAndroidのアクションバー内に完全に表示されますが、最初は検索バーが表示されません。しかし、デバイスの向きをゆっくりと変化させると、デバイスの向きを変えるたびに徐々に幅が広がり、検索バーがゆっくりとアクションバーに表示され始めます。私は別のコンポーネントとして検索バーを呼び出していますapp.component内Nativescript - 検索バーがアクションバー(IOS)内で正しく表示されない
app.component.html
<StackLayout sdkToggleNavButton>
<ActionBar title="" backgroundColor="#f82462">
<StackLayout>
<app-search-bar></app-search-bar>
</StackLayout>
</ActionBar>
を次のように
私のコードです。
ここで起こっていただきました!上の任意のアドバイスをNativescript 2.5を使用して
searchbarComponent.ts
import { Component } from "@angular/core";
import searchBarModule = require("ui/search-bar");
@Component({
selector: "app-search-bar",
template: `
<SearchBar class ="sb" #sb hint="Enter topic to get questions" [text]="searchPhrase" (submit)="onSubmit(sb.text)"></SearchBar> `
})
export class SearchBarComponent { }
。
私はここで提供された解決策を試しました - https://github.com/NativeScript/nativescript-angular/issues/487 @tsonevnしかし、これは私のプロジェクトでは機能しませんでした。 –