mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 07:04:05 +08:00
[LayoutAnimation] RCTAnimationTypeKeyboard
Summary: This adds the Keyboard animation type for when you want to animate UI based on the keyboard appearing/disappearing. Closes https://github.com/facebook/react-native/pull/1366 Github Author: Stanislav Vishnevskiy <vishnevskiy@gmail.com> Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
@@ -51,20 +51,23 @@ static NSDictionary *RCTPropsMerge(NSDictionary *beforeProps, NSDictionary *newP
|
||||
|
||||
@implementation RCTAnimation
|
||||
|
||||
static UIViewAnimationCurve UIViewAnimationCurveFromRCTAnimationType(RCTAnimationType type)
|
||||
static UIViewAnimationOptions UIViewAnimationOptionsFromRCTAnimationType(RCTAnimationType type)
|
||||
{
|
||||
switch (type) {
|
||||
case RCTAnimationTypeLinear:
|
||||
return UIViewAnimationCurveLinear;
|
||||
return UIViewAnimationOptionCurveLinear;
|
||||
case RCTAnimationTypeEaseIn:
|
||||
return UIViewAnimationCurveEaseIn;
|
||||
return UIViewAnimationOptionCurveEaseIn;
|
||||
case RCTAnimationTypeEaseOut:
|
||||
return UIViewAnimationCurveEaseOut;
|
||||
return UIViewAnimationOptionCurveEaseOut;
|
||||
case RCTAnimationTypeEaseInEaseOut:
|
||||
return UIViewAnimationCurveEaseInOut;
|
||||
return UIViewAnimationOptionCurveEaseInOut;
|
||||
case RCTAnimationTypeKeyboard:
|
||||
// http://stackoverflow.com/questions/18870447/how-to-use-the-default-ios7-uianimation-curve
|
||||
return (UIViewAnimationOptions)(7 << 16);
|
||||
default:
|
||||
RCTLogError(@"Unsupported animation type %zd", type);
|
||||
return UIViewAnimationCurveEaseInOut;
|
||||
return UIViewAnimationOptionCurveEaseInOut;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +119,7 @@ static UIViewAnimationCurve UIViewAnimationCurveFromRCTAnimationType(RCTAnimatio
|
||||
} else {
|
||||
|
||||
UIViewAnimationOptions options = UIViewAnimationOptionBeginFromCurrentState |
|
||||
UIViewAnimationCurveFromRCTAnimationType(_animationType);
|
||||
UIViewAnimationOptionsFromRCTAnimationType(_animationType);
|
||||
|
||||
[UIView animateWithDuration:_duration
|
||||
delay:_delay
|
||||
|
||||
Reference in New Issue
Block a user