Created
May 28, 2026 16:44
-
-
Save dillonhafer/760e93020a2a10d9c308bc5e50a8b60c to your computer and use it in GitHub Desktop.
A copy of Expo's ListForEachView.swift sans-onDelete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal import ExpoModulesCore | |
| import SwiftUI | |
| final class ListForEachMoveView: Module { | |
| func definition() -> ModuleDefinition { | |
| Name("ListForEachMoveView") | |
| View(ListForEachMoveSwiftUIView.self) | |
| } | |
| } | |
| final class ListForEachMoveProps: ExpoSwiftUI.ViewProps { | |
| var onMove = EventDispatcher() | |
| } | |
| struct ListForEachMoveSwiftUIView: ExpoSwiftUI.View { | |
| @ObservedObject var props: ListForEachMoveProps | |
| init(props: ListForEachMoveProps) { | |
| self.props = props | |
| } | |
| var body: some View { | |
| Children() | |
| .onMove(perform: handleMove) | |
| } | |
| func handleMove(from sources: IndexSet, to destination: Int) { | |
| let sourceIndices = Array(sources) | |
| props.onMove(["sourceIndices": sourceIndices, "destination": destination]) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment