如何从反应本地路由器通量中删除动画
问题描述:
如何从react-native-router-flux
禁用动画?如何从反应本地路由器通量中删除动画
我试着加入transitionConfig
但它不起作用。的react-native-router-flux
的版本是4.0.0 ,beta.21
的场景如下:
const transitionConfig =() => ({
transitionSpec: {
duration: 0,
timing: Animated.timing,
easing: Easing.step0,
},
});
const Entry =() => (
<Router getSceneStyle={getSceneStyle} createReducer={reducerCreate} transitionConfig={transitionConfig}>
<Scene key="root">
<Scene key="scene_login"
component={Login}
title={gettext("Login")}
initial={true}
type="reset"
hideTabBar
hideNavBar
navigationBarStyle={styles.navBarStyle}
titleStyle={styles.navBarTitleStyle} />
<Scene key="scene_condition"
tabs={true}
type="reset"
tabBarStyle={styles.tabBarStyle}
tabBarSelectedItemStyle={styles.tabBarSelectedItemStyle}
navigationBarStyle={styles.navBarStyle}
titleStyle={styles.navBarTitleStyle}
hideTabBar={false}
hideNavBar={true}
tabBarPosition="bottom"
labelStyle={{fontSize: 7}}
title="">
<Scene key="scene_condition_car"
tabBarLabel={gettext("Model")}
title={gettext("Model")}
component={Car}
icon={TabIcon}
iconTittleHidden
iconName="directions-car"
leftButtonIconStyle={styles.moduleButton}
leftButtonImage={require('./img/icons/left.png')}
onLeft={(props) => requestOverview(props.request.id)}
navigationBarStyle={styles.navBarStyle}
titleStyle={styles.navBarTitleStyle}/>
<Scene key="scene_condition_checks_features"
tabBarLabel={gettext("Equipment")}
title={gettext("Equipment")}
component={Equipment}
icon={TabIcon}
iconTittleHidden
iconName="playlist-add-check"
leftButtonIconStyle={styles.moduleButton}
leftButtonImage={require('./img/icons/left.png')}
onLeft={(props) => requestOverview(props.request.id)}
navigationBarStyle={styles.navBarStyle}
titleStyle={styles.navBarTitleStyle}/>
<Scene key="scene_condition_specs"
tabBarLabel={gettext("Specifications")}
title={gettext("Specifications")}
labelStyle={{fontSize: 18}}
component={CarSpecs}
icon={TabIcon}
iconTittleHidden
iconName="control-point-duplicate"
leftButtonIconStyle={styles.moduleButton}
leftButtonImage={require('./img/icons/left.png')}
onLeft={(props) => requestOverview(props.request.id)}
navigationBarStyle={styles.navBarStyle}
titleStyle={styles.navBarTitleStyle}/>
</Scene>
</Scene>
</Router>
);
任何想法?
答
我试过同一个月前我通过在主要成分或你想要的特定的场景中使用
duration={0}
解决它。试试这个,让我们知道
答
我在一个旧版本的router-flux
,但我利用getSceneStyle
处理的过渡,就像这样:
export function noAnimation(props): Object {
const {
// layout,
position,
scene,
} = props;
const index = scene.index;
// [willGainFocus, isFocused, lostFocus]
const inputRange = [index - 1, index, index + 1];
// const height = layout.initHeight;
const opacity = position.interpolate({
inputRange,
outputRange: ([1, 1, 1]: Array<number>),
});
const scale = position.interpolate({
inputRange,
outputRange: ([1, 1, 1]: Array<number>),
});
const translateX = 0;
const translateY = position.interpolate({
inputRange,
outputRange: ([0, 0, -0]: Array<number>),
});
return {
opacity,
transform: [
{ scale },
{ translateX },
{ translateY },
],
};
}
+0
(只需将该函数传递给'getSceneStyle') –
我试过了,但它并没有帮助。 – Boky
我在这种情况下的建议是回到你需要的更稳定版本,我建议@ 3.38.0。那就是我要做的 –