Fuse Community

ScrollView bug? When keyboard closes ScrollView won't snap back

Taking up my previuos post, please let me insist about a behaviour of <ScrollView> (that now I managed to isolate and reproduce) which I don’t understand if it’s a bug or it’s my fault.

Try the following code on a physical device (I used Android 7.0 and 11.0).

Tapping the <TextInput> from One to Eight happens correctly that:

  1. the keyboard is shown
  2. the <TextInput> tapped is scrolled so that it is brought IntoView
  3. when the back button is pressed the keyboard closes and the tapped <TextInput> is scrolled to its original posistion

But when you try to do the same thing with the last <TextInput> the Twelve (or even the Eleven or Ten) you may notice that pressing the back button to close the keyboard won’t make the <TextInput> scroll to its original posistion and rather a blank space is left in place of the keyboard.

<App Background="#FFFFFF">
    
    <DockPanel>
        <ScrollView>
            <StackPanel Margin="12,12,12,12">
                <Text Value="One" />
                <MyTextInput Margin="0,0,0,24" />

                <Text Value="Two" />
                <MyTextInput Margin="0,0,0,24" />
                
                <Text Value="Three" />
                <MyTextInput Margin="0,0,0,24" />
                
                <Text Value="Four" />
                <MyTextInput Margin="0,0,0,24" />
                
                <Text Value="Five" />
                <MyTextInput Margin="0,0,0,24" />
                
                <Text Value="Six" />
                <MyTextInput Margin="0,0,0,24" />
                
                <Text Value="Seven" />
                <MyTextInput Margin="0,0,0,24" />
                
                <Text Value="Eight" />
                <MyTextInput Margin="0,0,0,24" />
                
                <Text Value="Nine" />
                <MyTextInput Margin="0,0,0,24" />
                
                <Text Value="Ten" />
                <MyTextInput Margin="0,0,0,24" />
                
                <Text Value="Eleven" />
                <MyTextInput Margin="0,0,0,24" />
                
                <Text Value="Twelve" />
                <MyTextInput />
            </StackPanel>
            <WhileKeyboardVisible>
                <BringIntoView />
            </WhileKeyboardVisible>
        </ScrollView>
        <BottomBarBackground Dock="Bottom" />
    </DockPanel>

    <TextInput ux:Class="MyTextInput" FontSize="15" Height="36" Padding="6,0,6,0">
        <Rectangle Layer="Background" CornerRadius="4">
            <Stroke Width="1" Color="#DDDDDD" />
            <SolidColor Color="#FFFFFF" />
        </Rectangle>
    </TextInput>

</App>

I thought I would find a explanation in ScrollView.uno code, but unfortunately it’s beyond my knowledge.