当我尝试将 listview 与react-native-router-flux结合起来时,我遇到了一个问题
预期行为
我使用 Action.SCENE_NAME 将 Prop 从父级传递给子级,它在手机上完美运行。
但在平板电脑中,我使用分割 View 。我想要的结果如下:
左边是父级,右边是子级。当我点击左侧时,它应该 立即显示在右侧,没有任何过渡动画。 Screen shot of tablet
实际行为
在平板电脑上显示 当我单击左侧时,它会引发到子组件的过渡动画 我该如何预防?
这是我的代码:
renderRow(rowData) {
return (
<View style={styles.generalStyle}>
<TouchableOpacity
onPress={() => {
if (window.width <= 600) {
Actions.calendarDetail({ eventtop: rowData });
} else if (window.width > 600) {
// HOW CAN I PASS PROPS TO <TabletComponent />;
// without causing any transition animation
}
}}>
<View>
<Text style={styles.evenType}>
{rowData.EventType}
</Text>
<Text style={{ ...styles.contentStyle, ...styles.contenStyle2 }}>
{dateFormat(rowData.EventDate, 'mm/dd/yyyy')}
</Text>
<Icon
name='chevron-thin-right'
style={styles.iconStyle}
/>
<View
style={styles.titleStyle}
>
<Text style={styles.contentStyle}>
{rowData.Title}
</Text>
</View>
</View>
</TouchableOpacity>
</View>
);
}
最佳答案
当使用react-native-router-flux时,我发现在场景声明中设置duration={1}会导致跳过过渡动画:
<Scene key={'someScene'} component={SomeComponent} title="Some Title" duration={1}/>
我从未尝试过将 duration
作为 prop 传递,但我认为它没有理由不起作用。
关于javascript - 传递 props react-native-router-flux 时防止场景转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43702422/