-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
The scroll position doesn't change when the text is changed from the parent view.
ScreenRecording_05-05-2025.03-00-46_1.mp4
How to reproduce the issue
- Create a new iOS app
- Add CodeEditorView as a dependency
- Write the following code:
import SwiftUI import CodeEditorView struct ContentView: View { @State private var text = "" @State private var position = CodeEditor.Position() var body: some View { VStack { Button("Clear") { text.removeAll() } .buttonStyle(.borderedProminent) .controlSize(.large) CodeEditor(text: $text, position: $position, messages: .constant([])) .frame(height: 100) } .onChange(of: position) { oldValue, newValue in print(oldValue, newValue) } } }
- Run it
- Tap
CodeEditorto put the cursor on it - Press the return key repeatedly until it begins to scroll down
- Tap "Clear" button
Expected behavior
CodeEditor will scroll up to the first line just like when you tap "Select All" and press the delete key.
ScreenRecording_05-05-2025.04-03-31_1.mp4
Actual behavior
The text will be removed, but the scroll position won't be changed and you can't even scroll on it until you input some text. Also, onChange(of: position) won't be called.
Environment
- CodeEditorView 0.15.4 and main (aba6c18)
- iPadOS 18.5 Developer Beta 4
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Projects
Status
To do