diff --git a/Tusker/Screens/Compose/ComposeTextView.swift b/Tusker/Screens/Compose/ComposeTextView.swift index dd606240..b5ab6d59 100644 --- a/Tusker/Screens/Compose/ComposeTextView.swift +++ b/Tusker/Screens/Compose/ComposeTextView.swift @@ -69,6 +69,8 @@ struct WrappedTextView: UIViewRepresentable { var textDidChange: ((UITextView) -> Void)? var font = UIFont.systemFont(ofSize: 20) + @Environment(\.isEnabled) private var isEnabled: Bool + func makeUIView(context: Context) -> UITextView { let textView = UITextView() textView.delegate = context.coordinator @@ -82,6 +84,7 @@ struct WrappedTextView: UIViewRepresentable { func updateUIView(_ uiView: UITextView, context: Context) { uiView.text = text + uiView.isEditable = isEnabled context.coordinator.textView = uiView context.coordinator.text = $text context.coordinator.didChange = textDidChange diff --git a/Tusker/Screens/Compose/MainComposeTextView.swift b/Tusker/Screens/Compose/MainComposeTextView.swift index 4a6bb4fd..090740d3 100644 --- a/Tusker/Screens/Compose/MainComposeTextView.swift +++ b/Tusker/Screens/Compose/MainComposeTextView.swift @@ -78,6 +78,7 @@ struct MainComposeWrappedTextView: UIViewRepresentable { @EnvironmentObject var uiState: ComposeUIState @EnvironmentObject var mastodonController: MastodonController + @Environment(\.isEnabled) var isEnabled: Bool func makeUIView(context: Context) -> UITextView { let textView = WrappedTextView() @@ -98,6 +99,8 @@ struct MainComposeWrappedTextView: UIViewRepresentable { uiView.text = text } + uiView.isEditable = isEnabled + context.coordinator.text = $text context.coordinator.didChange = textDidChange context.coordinator.uiState = uiState