Open tcerdaj opened 3 years ago
@tcerdaj Can you attach a repro or the XAML you are using for this issue?
Sorry @PureWeen for the delay: Note: This was working fine in iOS 13. XAML:
<!-- Note Editor -->
<!--*************-->
<AbsoluteLayout HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<StackLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
AbsoluteLayout.LayoutFlags="All">
<ScrollView x:Name="myScrollView"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<ScrollView.Triggers>
<DataTrigger TargetType="ScrollView"
Binding="{Binding Source={Reference textNoteEditor}, Path=IsFocused}"
Value="True">
<DataTrigger.EnterActions>
<act:ScrollOnFocusTriggerAction />
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger TargetType="ScrollView"
Binding="{Binding Source={Reference textNoteEditor}, Path=IsFocused}"
Value="False">
<DataTrigger.EnterActions>
<act:ScrollOnUnfocusTriggerAction />
</DataTrigger.EnterActions>
</DataTrigger>
</ScrollView.Triggers>
<mycc:AdjustableEditor x:Name="textNoteEditor"
BackgroundColor="White"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Text="{Binding Note}"
IsEnabled="{Binding CanEditNote}"
AutoSize="TextChanges"
AutomationId="user_note_entry" />
</ScrollView>
</StackLayout>
<AbsoluteLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
AbsoluteLayout.LayoutFlags="All"
BackgroundColor="White"
Opacity="0.5"
IsVisible="{Binding IsBusy}">
<ActivityIndicator AbsoluteLayout.LayoutBounds="0.5, 0.5, -1, -1"
AbsoluteLayout.LayoutFlags="PositionProportional"
IsRunning="{Binding IsBusy}" />
</AbsoluteLayout>
</AbsoluteLayout>
AdjustableEditor:
public class AdjustableEditor : Editor
{
public bool HasBorder { get; set; } = false;
// This is used for locking the scrolling ability of the Editor in iOS
public bool ScrollEnabled { get; set; } = false;
}
ScrollOnFocusTriggerAction:
public class ScrollOnFocusTriggerAction : TriggerAction<ScrollView>
{
protected override async void Invoke(ScrollView scrollView)
{
try
{
if (scrollView == null || Device.RuntimePlatform != Device.iOS)
return;
await Task.Delay(50);
await scrollView.ScrollToAsync(scrollView, ScrollToPosition.Start, false);
}
catch (Exception ex)
{
Crashes.TrackError(ex);
}
}
}
ScrollOnUnfocusTriggerAction
public class ScrollOnUnfocusTriggerAction : TriggerAction<ScrollView>
{
protected override void Invoke(ScrollView scrollView)
{
try
{
if (scrollView == null || Device.RuntimePlatform != Device.iOS)
return;
_ = scrollView.ScrollToAsync(scrollView, ScrollToPosition.Start, false);
scrollView.Focus();
}
catch (Exception ex)
{
Crashes.TrackError(ex);
}
}
}
Attach a sample trying to reproduce the issue with the previous comment code: Issue13040.zip
Tested with Xamarin.Forms 4.8 and 5.0.
@tcerdaj Cannot reproduce the issue, probably I am missing something in the sample, could you take a look?
Trying using iPhone 7 iOS 14
Teofilo Cerda Sent from my iPhone
On Feb 11, 2021, at 12:13 PM, Javier Suárez notifications@github.com wrote:
Attach a sample trying to reproduce the issue with the previous comment code: Issue13040.ziphttps://github.com/xamarin/Xamarin.Forms/files/5967185/Issue13040.zip
@tcerdajhttps://github.com/tcerdaj Cannot reproduce the issue, probably I am missing something in the sample, could you take a look?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/xamarin/Xamarin.Forms/issues/13040#issuecomment-777650933, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAZHSY7UNBXRWNFT3T3IXM3S6QF33ANCNFSM4UMETDWQ.
IOS 14 o last er
Teofilo Cerda Sent from my iPhone
On Feb 11, 2021, at 12:33 PM, Teófilo Cerda tcerdaj@hotmail.com wrote:
Trying using iPhone 7 iOS 14
Teofilo Cerda Sent from my iPhone
On Feb 11, 2021, at 12:13 PM, Javier Suárez notifications@github.com wrote:
Attach a sample trying to reproduce the issue with the previous comment code: Issue13040.ziphttps://github.com/xamarin/Xamarin.Forms/files/5967185/Issue13040.zip
@tcerdajhttps://github.com/tcerdaj Cannot reproduce the issue, probably I am missing something in the sample, could you take a look?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/xamarin/Xamarin.Forms/issues/13040#issuecomment-777650933, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAZHSY7UNBXRWNFT3T3IXM3S6QF33ANCNFSM4UMETDWQ.
Hi, @jsuarezruiz I was able to reproduce within https://github.com/xamarin/Xamarin.Forms/files/5967185/Issue13040.zip iPhone 7 iOS 14.2 Simulator.
Description
iOS 14 ScrollView when you tap in the editor first line will scroll to go to the bottom, this is happening when you add editor or entry content type to a ScrollView.
Steps to Reproduce
Expected Behavior
keep the scroll position in the first line and not go to the bottom
Actual Behavior
The screen will scroll to go to the bottom
Basic Information
Xamarin forms 8.
Environment
Xamarin forms 4.8 Xcode 11.6
Build Logs
Reproduction Link
Workaround