Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-14563] Suppress valueChange when reloading row #4642

Merged
merged 2 commits into from
Sep 3, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion iphone/Classes/TiUITextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,14 @@ -(void)setSelectionFrom:(id)start to:(id)end

- (void)textFieldDidBeginEditing:(UITextField *)tf
{
TiUITextWidgetProxy * ourProxy = (TiUITextWidgetProxy *)[self proxy];

//TIMOB-14563. Set the right text value.
if ([ourProxy suppressFocusEvents]) {
NSString* theText = [ourProxy valueForKey:@"value"];
[tf setText:theText];
}

[self textWidget:tf didFocusWithText:[tf text]];
[self performSelector:@selector(textFieldDidChange:) onThread:[NSThread currentThread] withObject:nil waitUntilDone:NO];
}
Expand Down Expand Up @@ -523,7 +531,13 @@ - (void)textFieldDidEndEditing:(UITextField *)tf

- (void)textFieldDidChange:(NSNotification *)notification
{
[(TiUITextFieldProxy *)self.proxy noteValueChange:[(UITextField *)textWidgetView text]];
TiUITextWidgetProxy * ourProxy = (TiUITextWidgetProxy *)[self proxy];

//TIMOB-14563. This is incorrect when passowrd mark is used. Just ignore.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments have spelling mistake. but i don't care.

if ([ourProxy suppressFocusEvents]) {
return;
}
[ourProxy noteValueChange:[(UITextField *)textWidgetView text]];
}

- (BOOL)textFieldShouldEndEditing:(UITextField *)tf
Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiUITextWidgetProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ -(void)noteValueChange:(NSString *)newValue
{
if (![[self valueForKey:@"value"] isEqual:newValue])
{
[self contentsWillChange];
[self replaceValue:newValue forKey:@"value" notification:NO];
[self contentsWillChange];
[self fireEvent:@"change" withObject:[NSDictionary dictionaryWithObject:newValue forKey:@"value"]];
}
}
Expand Down