mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 12:45:37 +08:00
Fixed null argument errors for timers and layout animations
This commit is contained in:
@@ -49,8 +49,7 @@ var LayoutEventExample = React.createClass({
|
|||||||
() => {
|
() => {
|
||||||
console.log('layout animation done.');
|
console.log('layout animation done.');
|
||||||
this.addWrapText();
|
this.addWrapText();
|
||||||
},
|
}
|
||||||
(error) => { throw new Error(JSON.stringify(error)); }
|
|
||||||
);
|
);
|
||||||
this.setState({
|
this.setState({
|
||||||
viewStyle: {
|
viewStyle: {
|
||||||
|
|||||||
@@ -26,11 +26,11 @@
|
|||||||
- (void)setUp
|
- (void)setUp
|
||||||
{
|
{
|
||||||
#if __LP64__
|
#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
|
#endif
|
||||||
|
|
||||||
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
|
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);
|
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerIntegrationTests/js/IntegrationTestsApp", nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,12 @@
|
|||||||
|
|
||||||
- (void)setUp
|
- (void)setUp
|
||||||
{
|
{
|
||||||
#ifdef __LP64__
|
#if __LP64__
|
||||||
RCTAssert(!__LP64__, @"Snapshot 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
|
#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 = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerApp.ios", nil);
|
||||||
_runner.recordMode = NO;
|
_runner.recordMode = NO;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ var LayoutEventsTest = React.createClass({
|
|||||||
() => {
|
() => {
|
||||||
debug('layout animation done.');
|
debug('layout animation done.');
|
||||||
this.checkLayout(this.addWrapText);
|
this.checkLayout(this.addWrapText);
|
||||||
},
|
}
|
||||||
(error) => { throw new Error(JSON.stringify(error)); }
|
|
||||||
);
|
);
|
||||||
this.setState({viewStyle: {margin: 60}});
|
this.setState({viewStyle: {margin: 60}});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ RCT_EXPORT_MODULE(TestModule)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(testMethod:(NSInteger)integer
|
RCT_EXPORT_METHOD(testMethod:(NSInteger)integer
|
||||||
number:(NSNumber *)number
|
number:(nonnull NSNumber *)number
|
||||||
string:(NSString *)string
|
string:(NSString *)string
|
||||||
dictionary:(NSDictionary *)dict
|
dictionary:(NSDictionary *)dict
|
||||||
callback:(RCTResponseSenderBlock)callback)
|
callback:(RCTResponseSenderBlock)callback)
|
||||||
|
|||||||
@@ -69,9 +69,11 @@ type Config = {
|
|||||||
delete?: Anim;
|
delete?: Anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
function configureNext(config: Config, onAnimationDidEnd?: Function, onError?: Function) {
|
function configureNext(config: Config, onAnimationDidEnd?: Function) {
|
||||||
configChecker({config}, 'config', 'LayoutAnimation.configureNext');
|
configChecker({config}, 'config', 'LayoutAnimation.configureNext');
|
||||||
RCTUIManager.configureNextLayoutAnimation(config, onAnimationDidEnd, onError);
|
RCTUIManager.configureNextLayoutAnimation(
|
||||||
|
config, onAnimationDidEnd || function() {}, function() { /* unused */ }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function create(duration: number, type, creationProp): Config {
|
function create(duration: number, type, creationProp): Config {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ var JSTimers = {
|
|||||||
return func.apply(undefined, args);
|
return func.apply(undefined, args);
|
||||||
};
|
};
|
||||||
JSTimersExecution.types[freeIndex] = JSTimersExecution.Type.setTimeout;
|
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;
|
return newID;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ var JSTimers = {
|
|||||||
return func.apply(undefined, args);
|
return func.apply(undefined, args);
|
||||||
};
|
};
|
||||||
JSTimersExecution.types[freeIndex] = JSTimersExecution.Type.setInterval;
|
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;
|
return newID;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user