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-13064] iOS: Date Picker getValue() returns null #4037

Merged
merged 2 commits into from
Mar 27, 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
2 changes: 2 additions & 0 deletions iphone/Classes/TiUIPicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
BOOL propertiesConfigured; // We're order-dependent on type being configured first, so have to re-configure after the initial setup. What a pain!
}

@property (nonatomic, readonly, copy) id value_;

-(NSArray*)columns;
-(void)reloadColumn:(id)column;
-(TiProxy*)selectedRowForColumn:(NSInteger)column;
Expand Down
8 changes: 8 additions & 0 deletions iphone/Classes/TiUIPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ -(void)setValue_:(id)date
}
}

- (id)value_
{
if ([self isDatePicker] && ([(UIDatePicker*)picker datePickerMode] != UIDatePickerModeCountDownTimer)) {
return [(UIDatePicker*)[self picker] date];
}
return nil;
}

-(void)setLocale_:(id)value
{
ENSURE_SINGLE_ARG_OR_NIL(value,NSString);
Expand Down
10 changes: 10 additions & 0 deletions iphone/Classes/TiUIPickerProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ -(void)addDefault:(NSDictionary*)params {

#pragma mark Public APIs

- (id)value
{
if (![NSThread isMainThread]) {
__block id result = nil;
TiThreadPerformOnMainThread(^{result = [[[self picker] value_] retain];}, YES);
return [result autorelease];
}
return [[self picker] value_];
}

-(void)add:(id)args
{
// TODO: Probably take advantage of Jeff's performance improvements in ordinary views.
Expand Down