diff --git a/Tusker/Screens/Compose/ComposeTextView.swift b/Tusker/Screens/Compose/ComposeTextView.swift index 306907c8..b56e08ac 100644 --- a/Tusker/Screens/Compose/ComposeTextView.swift +++ b/Tusker/Screens/Compose/ComposeTextView.swift @@ -27,13 +27,7 @@ struct ComposeTextView: View { var body: some View { ZStack(alignment: .topLeading) { - WrappedTextView( - text: $text, - textDidChange: self.textDidChange, - backgroundColor: backgroundColor, - font: .systemFont(ofSize: fontSize) - ) - .frame(height: height ?? minHeight) + Color(backgroundColor) if text.isEmpty, let placeholder = placeholder { placeholder @@ -41,6 +35,13 @@ struct ComposeTextView: View { .foregroundColor(.secondary) .offset(x: 4, y: 8) } + + WrappedTextView( + text: $text, + textDidChange: self.textDidChange, + font: .systemFont(ofSize: fontSize) + ) + .frame(height: height ?? minHeight) } } @@ -73,14 +74,13 @@ struct WrappedTextView: UIViewRepresentable { @Binding var text: String var textDidChange: ((UITextView) -> Void)? - var backgroundColor = UIColor.secondarySystemBackground var font = UIFont.systemFont(ofSize: 20) func makeUIView(context: Context) -> UITextView { let textView = UITextView() textView.delegate = context.coordinator textView.isEditable = true - textView.backgroundColor = backgroundColor + textView.backgroundColor = .clear textView.font = font textView.textContainer.lineBreakMode = .byWordWrapping return textView diff --git a/Tusker/Screens/Compose/MainComposeTextView.swift b/Tusker/Screens/Compose/MainComposeTextView.swift index d17b65d9..a65bd626 100644 --- a/Tusker/Screens/Compose/MainComposeTextView.swift +++ b/Tusker/Screens/Compose/MainComposeTextView.swift @@ -20,6 +20,15 @@ struct MainComposeTextView: View { var body: some View { ZStack(alignment: .topLeading) { + Color(UIColor.secondarySystemBackground) + + if draft.text.isEmpty { + placeholder + .font(.system(size: 20)) + .foregroundColor(.secondary) + .offset(x: 4, y: 8) + } + MainComposeWrappedTextView( text: $draft.text, visibility: draft.visibility, @@ -28,13 +37,6 @@ struct MainComposeTextView: View { self.height = max(textView.contentSize.height, minHeight) } .frame(height: height ?? minHeight) - - if draft.text.isEmpty { - placeholder - .font(.system(size: 20)) - .foregroundColor(.secondary) - .offset(x: 4, y: 8) - } }.onAppear { if !hasFirstAppeared { hasFirstAppeared = true @@ -59,7 +61,7 @@ struct MainComposeWrappedTextView: UIViewRepresentable { let textView = UITextView() textView.delegate = context.coordinator textView.isEditable = true - textView.backgroundColor = .secondarySystemBackground + textView.backgroundColor = .clear textView.font = .systemFont(ofSize: 20) textView.textContainer.lineBreakMode = .byWordWrapping context.coordinator.textView = textView