fix warning
This commit is contained in:
		
							parent
							
								
									b47922694d
								
							
						
					
					
						commit
						fa1637a5af
					
				@ -263,7 +263,7 @@ struct PrivateChatView: View {
 | 
				
			|||||||
                                    set: { isComposerFocused = $0 }
 | 
					                                    set: { isComposerFocused = $0 }
 | 
				
			||||||
                                ),
 | 
					                                ),
 | 
				
			||||||
                                isEnabled: currentUserId != nil,
 | 
					                                isEnabled: currentUserId != nil,
 | 
				
			||||||
                                minHeight: 10,
 | 
					                                minHeight: 40,
 | 
				
			||||||
                                maxLines: 4,
 | 
					                                maxLines: 4,
 | 
				
			||||||
                                calculatedHeight: $legacyComposerHeight,
 | 
					                                calculatedHeight: $legacyComposerHeight,
 | 
				
			||||||
                                onSubmit: sendCurrentMessage
 | 
					                                onSubmit: sendCurrentMessage
 | 
				
			||||||
@ -504,7 +504,12 @@ private struct LegacyMultilineTextView: UIViewRepresentable {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        context.coordinator.updatePlaceholderVisibility(for: textView)
 | 
					        context.coordinator.updatePlaceholderVisibility(for: textView)
 | 
				
			||||||
        DispatchQueue.main.async {
 | 
					        DispatchQueue.main.async {
 | 
				
			||||||
            Self.recalculateHeight(for: textView, result: calculatedHeightBinding, minHeight: minHeight, maxLines: maxLines)
 | 
					            Self.recalculateHeight(
 | 
				
			||||||
 | 
					                for: textView,
 | 
				
			||||||
 | 
					                result: calculatedHeightBinding,
 | 
				
			||||||
 | 
					                minHeight: minHeight,
 | 
				
			||||||
 | 
					                maxLines: maxLines
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return textView
 | 
					        return textView
 | 
				
			||||||
@ -534,7 +539,12 @@ private struct LegacyMultilineTextView: UIViewRepresentable {
 | 
				
			|||||||
            uiView.resignFirstResponder()
 | 
					            uiView.resignFirstResponder()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Self.recalculateHeight(for: uiView, result: calculatedHeightBinding, minHeight: minHeight, maxLines: maxLines)
 | 
					        Self.recalculateHeight(
 | 
				
			||||||
 | 
					            for: uiView,
 | 
				
			||||||
 | 
					            result: calculatedHeightBinding,
 | 
				
			||||||
 | 
					            minHeight: minHeight,
 | 
				
			||||||
 | 
					            maxLines: maxLines
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    func makeCoordinator() -> Coordinator {
 | 
					    func makeCoordinator() -> Coordinator {
 | 
				
			||||||
@ -559,12 +569,18 @@ private struct LegacyMultilineTextView: UIViewRepresentable {
 | 
				
			|||||||
        let lineHeight = textView.font?.lineHeight ?? UIFont.preferredFont(forTextStyle: .body).lineHeight
 | 
					        let lineHeight = textView.font?.lineHeight ?? UIFont.preferredFont(forTextStyle: .body).lineHeight
 | 
				
			||||||
        let maxHeight = minHeight + lineHeight * CGFloat(max(maxLines - 1, 0))
 | 
					        let maxHeight = minHeight + lineHeight * CGFloat(max(maxLines - 1, 0))
 | 
				
			||||||
        let clampedHeight = min(max(targetSize.height, minHeight), maxHeight)
 | 
					        let clampedHeight = min(max(targetSize.height, minHeight), maxHeight)
 | 
				
			||||||
 | 
					        let shouldScroll = targetSize.height > maxHeight + 0.5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if abs(result.wrappedValue - clampedHeight) > 0.5 {
 | 
					        if abs(result.wrappedValue - clampedHeight) > 0.5 {
 | 
				
			||||||
            result.wrappedValue = clampedHeight
 | 
					            let newHeight = clampedHeight
 | 
				
			||||||
 | 
					            DispatchQueue.main.async {
 | 
				
			||||||
 | 
					                if abs(result.wrappedValue - newHeight) > 0.5 {
 | 
				
			||||||
 | 
					                    result.wrappedValue = newHeight
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        textView.isScrollEnabled = targetSize.height > maxHeight + 0.5
 | 
					        textView.isScrollEnabled = shouldScroll
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    final class Coordinator: NSObject, UITextViewDelegate {
 | 
					    final class Coordinator: NSObject, UITextViewDelegate {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user