EddyVerbruggen / nativescript-keyboard-toolbar

⌨️🛠Add a customizable toolbar on top of the soft keyboard
Apache License 2.0
69 stars 19 forks source link

Tabbed Layout forId problem #7

Closed comporell closed 5 years ago

comporell commented 5 years ago

Make sure to check the demo app(s) for sample usage

Demo app works

If the demo apps cannot help and there is no issue for your problem, tell us.

I see the message on console

Please make sure forId="" resolves to a visible view, or the toolbar won't render correctly! Example: <Toolbar forId="myId" height="44">

When it does, the keyboard toolbar does not show no matter how many times I click it the triggering textfield. Then I click the Home button (Android) and click the overview button to go back to the app, then the textfield triggers the keyboardtoolbar and everything works fine!

1 out of 10 times the message does not appear and everything works fine on multiple tabs. Sometimes it only affects some of the keyboardtoolbars.

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

I tried to recreate the issue using an empty tabbed layout and multiple keyboardtoolbars. the issue did not reoccur. I think it might be related to loading times of the tab contents.

Is there any code involved?

I used the sample code, not much of extras:

           <TextField #tfFilterTask id="tf2" row="1" col="0" style="placeholder-color: rgba(255,255,255,0.6)"
                       class="c-white m-l-5" hint="Kod veya isim..." [text]=filterTaskText
                       (textChange)="onFilterChange($event)"></TextField>
    <KeyboardToolbar2 forId="tf2" height="50">
        <GridLayout columns="auto, *,auto,auto, auto" class="c-white p-10" backgroundColor="#26252A">
            <Label col="0" class="fas fs-24" verticalAlignment="center" text="&#xf002; Ara: "></Label>
            <Label col="1" class="fs-24" verticalAlignment="center" [text]=filterTaskText></Label>
            <Label col="2" class="fas c-white p-5 m-l-20" verticalAlignment="center" textWrap="false" text="&#xf069;"></Label>
            <Label col="3" class="fas c-white p-5 m-l-20" verticalAlignment="center" textWrap="false" text="&#xf2ed;" (tap)="clearKeyboard()"></Label>
            <Label col="4" class="fas c-white p-5 m-l-20" verticalAlignment="center" textWrap="false" text="&#xf00d;" (tap)="closeKeyboard(tfFilterTask)"></Label>
        </GridLayout>
    </KeyboardToolbar2>

Thank you for this great plugin, I hope we can solve this issue as I'd really like to use it.

comporell commented 5 years ago

Hi @EddyVerbruggen , I think it might be related to this issue androidTabsPosition="bottom" androidOffscreenTabLimit="0" with the tabview. When androidTabsPosition is set to bottom, androidOffscreenTabLimit="0" is ommited and tabview tries to preload the next tab. As the next tab is not in the frame, it gives this above message, and the triggering textfield does not get binded. Would be glad if there were a workaround for this. maybe by bypassing a page id, rather than this below in nativescript-keyboard-toolbar\keyboard-toolbar.android.js line 20 _this.thePage = frame_1.topmost().currentPage;

What do you think?

EddyVerbruggen commented 5 years ago

Hi @comporell, would you mind sharing a repo (or Playground) that shows the problematic behavior? I'm sure we can think of a way to fix it once the problem is clearly demonstrated.

comporell commented 5 years ago

Hi @comporell, would you mind sharing a repo (or Playground) that shows the problematic behavior? I'm sure we can think of a way to fix it once the problem is clearly demonstrated.

Dear Eddy. Playground is a pain to work with, I'm attaching an example project.

tabbedKeyboardTest.zip

EddyVerbruggen commented 5 years ago

Thanks for the project!

Indeed the issue was with preloading of tabs on Android. I had to add some code specific to this TabView case to make it work.

EddyVerbruggen commented 5 years ago

@comporell Can you give 1.1.0 a go?