類似于繼承模式,有基類的屬性,有擴(kuò)展的屬性
...BaseConfig
實(shí)現(xiàn)繼承效果
var BaseConfig = {
defaultTransitionVelocity: 1.5,
// 動(dòng)畫樣式
animationInterpolators: {
into: buildStyleInterpolator(directionMapping.FromTheEnd),
out: buildStyleInterpolator(directionMapping.FadeToTheStart),
},
};
var NavigatorSceneConfigs = {
FloatFromRight: {
...BaseConfig,
// We will want to customize this soon
},
PushFromRight: {
...BaseConfig,
// 覆蓋基類的屬性
animationInterpolators: {
into: buildStyleInterpolator(directionMapping.FromTheEnd),
out: buildStyleInterpolator(directionMapping.ToTheStartIOS),
},
},
};
module.exports = NavigatorSceneConfigs;
BaseConfig
是基礎(chǔ)屬性猪杭,其余的PushFromRight
FloatFromRight
FloatFromLeft
都是在基礎(chǔ)屬性上的擴(kuò)展