Skip to content

Commit 8cacad1

Browse files
committed
Merge pull request slackhq#194 from slackhq/misc-fixes
Misc fixes
2 parents a98cb94 + 613be00 commit 8cacad1

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

Source/Additions/UIResponder+SLKAdditions.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ + (instancetype)slk_currentFirstResponder
2727
{
2828
___currentFirstResponder = nil;
2929
[[UIApplication sharedApplication] sendAction:@selector(slk_findFirstResponder:) to:nil from:nil forEvent:nil];
30+
3031
return ___currentFirstResponder;
3132
}
3233

Source/Classes/SLKTextView.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,13 @@ - (void)layoutSubviews
110110
[super layoutSubviews];
111111

112112
self.placeholderLabel.hidden = [self slk_shouldHidePlaceholder];
113+
113114
if (!self.placeholderLabel.hidden) {
114-
self.placeholderLabel.frame = [self slk_placeholderRectThatFits:self.bounds];
115-
[self sendSubviewToBack:self.placeholderLabel];
115+
116+
[UIView performWithoutAnimation:^{
117+
self.placeholderLabel.frame = [self slk_placeholderRectThatFits:self.bounds];
118+
[self sendSubviewToBack:self.placeholderLabel];
119+
}];
116120
}
117121
}
118122

Source/Classes/SLKTextViewController.m

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ @interface SLKTextViewController ()
5959
@property (nonatomic) BOOL newWordInserted;
6060

6161
// YES if the view controller did appear and everything is finished configurating. This allows blocking some layout animations among other things.
62-
@property (nonatomic) BOOL isViewVisible;
62+
@property (nonatomic, getter=isViewVisible) BOOL viewVisible;
6363

6464
// The setter of isExternalKeyboardDetected, for private use.
6565
@property (nonatomic, getter = isRotating) BOOL rotating;
@@ -201,7 +201,7 @@ - (void)viewDidAppear:(BOOL)animated
201201

202202
[self.scrollViewProxy flashScrollIndicators];
203203

204-
self.isViewVisible = YES;
204+
self.viewVisible = YES;
205205
}
206206

207207
- (void)viewWillDisappear:(BOOL)animated
@@ -211,7 +211,7 @@ - (void)viewWillDisappear:(BOOL)animated
211211
// Stops the keyboard from being dismissed during the navigation controller's "swipe-to-pop"
212212
self.textView.didNotResignFirstResponder = self.isMovingFromParentViewController;
213213

214-
self.isViewVisible = NO;
214+
self.viewVisible = NO;
215215

216216
// Caches the text before it's too late!
217217
[self slk_cacheTextView];
@@ -1297,8 +1297,10 @@ - (void)slk_didChangeTextViewText:(NSNotification *)notification
12971297
// Animated only if the view already appeared.
12981298
[self textDidUpdate:self.isViewVisible];
12991299

1300-
// Process the text at text change
1301-
[self slk_processTextForAutoCompletion];
1300+
// Process the text at every change, when the view is visible
1301+
if (self.isViewVisible) {
1302+
[self slk_processTextForAutoCompletion];
1303+
}
13021304
}
13031305

13041306
- (void)slk_didChangeTextViewContentSize:(NSNotification *)notification
@@ -1720,7 +1722,7 @@ - (void)textViewDidChange:(UITextView *)textView
17201722
// Keep to avoid unnecessary crashes. Was meant to be overriden in subclass while calling super.
17211723
}
17221724

1723-
- (void)textViewDidChangeSelection:(SLKTextView *)textView
1725+
- (void)textViewDidChangeSelection:(UITextView *)textView
17241726
{
17251727
// Keep to avoid unnecessary crashes. Was meant to be overriden in subclass while calling super.
17261728
}

0 commit comments

Comments
 (0)