Fixed null argument errors for timers and layout animations

This commit is contained in:
Nick Lockwood 2015-08-01 07:44:05 -01:00
parent 3e79838a31
commit 95d1fd142e
7 changed files with 16 additions and 15 deletions

View File

@ -49,8 +49,7 @@ var LayoutEventExample = React.createClass({
() => {
console.log('layout animation done.');
this.addWrapText();
},
(error) => { throw new Error(JSON.stringify(error)); }
}
);
this.setState({
viewStyle: {

View File

@ -26,11 +26,11 @@
- (void)setUp
{
#if __LP64__
RCTAssert(false, @"Tests should be run on 32-bit device simulators (e.g. iPhone 5)");
RCTAssert(NO, @"Tests should be run on 32-bit device simulators (e.g. iPhone 5)");
#endif
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
RCTAssert(version.majorVersion == 8 || version.minorVersion == 3, @"Tests should be run on iOS 8.3, found %zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion);
RCTAssert(version.majorVersion == 8 || version.minorVersion >= 3, @"Tests should be run on iOS 8.3+, found %zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion);
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerIntegrationTests/js/IntegrationTestsApp", nil);
}

View File

@ -32,11 +32,12 @@
- (void)setUp
{
#ifdef __LP64__
RCTAssert(!__LP64__, @"Snapshot tests should be run on 32-bit device simulators (e.g. iPhone 5)");
#if __LP64__
RCTAssert(NO, @"Tests should be run on 32-bit device simulators (e.g. iPhone 5)");
#endif
NSString *version = [[UIDevice currentDevice] systemVersion];
RCTAssert([version isEqualToString:@"8.3"], @"Snapshot tests should be run on iOS 8.3, found %@", version);
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
RCTAssert(version.majorVersion == 8 || version.minorVersion >= 3, @"Snapshot tests should be run on iOS 8.3+, found %zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion);
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerApp.ios", nil);
_runner.recordMode = NO;
}

View File

@ -51,8 +51,7 @@ var LayoutEventsTest = React.createClass({
() => {
debug('layout animation done.');
this.checkLayout(this.addWrapText);
},
(error) => { throw new Error(JSON.stringify(error)); }
}
);
this.setState({viewStyle: {margin: 60}});
},

View File

@ -170,7 +170,7 @@ RCT_EXPORT_MODULE(TestModule)
}
RCT_EXPORT_METHOD(testMethod:(NSInteger)integer
number:(NSNumber *)number
number:(nonnull NSNumber *)number
string:(NSString *)string
dictionary:(NSDictionary *)dict
callback:(RCTResponseSenderBlock)callback)

View File

@ -69,9 +69,11 @@ type Config = {
delete?: Anim;
}
function configureNext(config: Config, onAnimationDidEnd?: Function, onError?: Function) {
function configureNext(config: Config, onAnimationDidEnd?: Function) {
configChecker({config}, 'config', 'LayoutAnimation.configureNext');
RCTUIManager.configureNextLayoutAnimation(config, onAnimationDidEnd, onError);
RCTUIManager.configureNextLayoutAnimation(
config, onAnimationDidEnd || function() {}, function() { /* unused */ }
);
}
function create(duration: number, type, creationProp): Config {

View File

@ -47,7 +47,7 @@ var JSTimers = {
return func.apply(undefined, args);
};
JSTimersExecution.types[freeIndex] = JSTimersExecution.Type.setTimeout;
RCTTiming.createTimer(newID, duration, Date.now(), /** recurring */ false);
RCTTiming.createTimer(newID, duration || 0, Date.now(), /** recurring */ false);
return newID;
},
@ -63,7 +63,7 @@ var JSTimers = {
return func.apply(undefined, args);
};
JSTimersExecution.types[freeIndex] = JSTimersExecution.Type.setInterval;
RCTTiming.createTimer(newID, duration, Date.now(), /** recurring */ true);
RCTTiming.createTimer(newID, duration || 0, Date.now(), /** recurring */ true);
return newID;
},