mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1diff --git a/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m b/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m
2index e916023..5049c33 100644
3--- a/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m
4+++ b/node_modules/@mattermost/react-native-paste-input/ios/PasteInputView.m
5@@ -4,6 +4,7 @@
6 //
7 // Created by Elias Nahum on 04-11-20.
8 // Copyright © 2020 Facebook. All rights reserved.
9+// Updated to remove parent’s default text view
10 //
11
12 #import "PasteInputView.h"
13@@ -12,49 +13,78 @@
14
15 @implementation PasteInputView
16 {
17- PasteInputTextView *_backedTextInputView;
18+ // We'll store the custom text view in this ivar
19+ PasteInputTextView *_customBackedTextView;
20 }
21
22 - (instancetype)initWithBridge:(RCTBridge *)bridge
23 {
24+ // Must call the super’s designated initializer
25 if (self = [super initWithBridge:bridge]) {
26- _backedTextInputView = [[PasteInputTextView alloc] initWithFrame:self.bounds];
27- _backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
28- _backedTextInputView.textInputDelegate = self;
29+ // 1. The parent (RCTMultilineTextInputView) has already created
30+ // its own _backedTextInputView = [RCTUITextView new] in super init.
31+ // We can remove that subview:
32
33- [self addSubview:_backedTextInputView];
34- }
35+ id<RCTBackedTextInputViewProtocol> parentInputView = super.backedTextInputView;
36+ if ([parentInputView isKindOfClass:[UIView class]]) {
37+ UIView *parentSubview = (UIView *)parentInputView;
38+ if (parentSubview.superview == self) {
39+ [parentSubview removeFromSuperview];
40+ }
41+ }
42
43+ // 2. Now create our custom PasteInputTextView
44+ _customBackedTextView = [[PasteInputTextView alloc] initWithFrame:self.bounds];
45+ _customBackedTextView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
46+ _customBackedTextView.textInputDelegate = self;
47+
48+ // Optional: disable inline predictions for iOS 17+
49+ if (@available(iOS 17.0, *)) {
50+ _customBackedTextView.inlinePredictionType = UITextInlinePredictionTypeNo;
51+ }
52+
53+ // 3. Add your custom text view as the only subview
54+ [self addSubview:_customBackedTextView];
55+ }
56 return self;
57 }
58
59+/**
60+ * Override the parent's accessor so that anywhere in RN that calls
61+ * `self.backedTextInputView` will get the custom PasteInputTextView.
62+ */
63 - (id<RCTBackedTextInputViewProtocol>)backedTextInputView
64 {
65- return _backedTextInputView;
66+ return _customBackedTextView;
67 }
68
69-- (void)setDisableCopyPaste:(BOOL)disableCopyPaste {
70- _backedTextInputView.disableCopyPaste = disableCopyPaste;
71+#pragma mark - Setters for React Props
72+
73+- (void)setDisableCopyPaste:(BOOL)disableCopyPaste
74+{
75+ _customBackedTextView.disableCopyPaste = disableCopyPaste;
76 }
77
78-- (void)setOnPaste:(RCTDirectEventBlock)onPaste {
79- _backedTextInputView.onPaste = onPaste;
80+- (void)setOnPaste:(RCTDirectEventBlock)onPaste
81+{
82+ _customBackedTextView.onPaste = onPaste;
83 }
84
85-- (void)setSmartPunctuation:(NSString *)smartPunctuation {
86- if ([smartPunctuation isEqualToString:@"enable"]) {
87- [_backedTextInputView setSmartDashesType:UITextSmartDashesTypeYes];
88- [_backedTextInputView setSmartQuotesType:UITextSmartQuotesTypeYes];
89- [_backedTextInputView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeYes];
90- } else if ([smartPunctuation isEqualToString:@"disable"]) {
91- [_backedTextInputView setSmartDashesType:UITextSmartDashesTypeNo];
92- [_backedTextInputView setSmartQuotesType:UITextSmartQuotesTypeNo];
93- [_backedTextInputView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeNo];
94- } else {
95- [_backedTextInputView setSmartDashesType:UITextSmartDashesTypeDefault];
96- [_backedTextInputView setSmartQuotesType:UITextSmartQuotesTypeDefault];
97- [_backedTextInputView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeDefault];
98- }
99+- (void)setSmartPunctuation:(NSString *)smartPunctuation
100+{
101+ if ([smartPunctuation isEqualToString:@"enable"]) {
102+ [_customBackedTextView setSmartDashesType:UITextSmartDashesTypeYes];
103+ [_customBackedTextView setSmartQuotesType:UITextSmartQuotesTypeYes];
104+ [_customBackedTextView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeYes];
105+ } else if ([smartPunctuation isEqualToString:@"disable"]) {
106+ [_customBackedTextView setSmartDashesType:UITextSmartDashesTypeNo];
107+ [_customBackedTextView setSmartQuotesType:UITextSmartQuotesTypeNo];
108+ [_customBackedTextView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeNo];
109+ } else {
110+ [_customBackedTextView setSmartDashesType:UITextSmartDashesTypeDefault];
111+ [_customBackedTextView setSmartQuotesType:UITextSmartQuotesTypeDefault];
112+ [_customBackedTextView setSmartInsertDeleteType:UITextSmartInsertDeleteTypeDefault];
113+ }
114 }
115
116 #pragma mark - UIScrollViewDelegate
117@@ -62,7 +92,6 @@
118 - (void)scrollViewDidScroll:(UIScrollView *)scrollView
119 {
120 RCTDirectEventBlock onScroll = self.onScroll;
121-
122 if (onScroll) {
123 CGPoint contentOffset = scrollView.contentOffset;
124 CGSize contentSize = scrollView.contentSize;
125@@ -71,22 +100,22 @@
126
127 onScroll(@{
128 @"contentOffset": @{
129- @"x": @(contentOffset.x),
130- @"y": @(contentOffset.y)
131+ @"x": @(contentOffset.x),
132+ @"y": @(contentOffset.y)
133 },
134 @"contentInset": @{
135- @"top": @(contentInset.top),
136- @"left": @(contentInset.left),
137- @"bottom": @(contentInset.bottom),
138- @"right": @(contentInset.right)
139+ @"top": @(contentInset.top),
140+ @"left": @(contentInset.left),
141+ @"bottom": @(contentInset.bottom),
142+ @"right": @(contentInset.right)
143 },
144 @"contentSize": @{
145- @"width": @(contentSize.width),
146- @"height": @(contentSize.height)
147+ @"width": @(contentSize.width),
148+ @"height": @(contentSize.height)
149 },
150 @"layoutMeasurement": @{
151- @"width": @(size.width),
152- @"height": @(size.height)
153+ @"width": @(size.width),
154+ @"height": @(size.height)
155 },
156 @"zoomScale": @(scrollView.zoomScale ?: 1),
157 });