javascript - 传递 props react-native-router-flux 时防止场景转换

标签 javascript react-native frontend

当我尝试将 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/

相关文章:

angularjs - 使用 angularjs 和 gruntjs 进行前端开发工作流程

javascript - 如果选中复选框,则将 css 应用于 href

ios - Admob 奖励广告不适用于 iOS 上的 Expo App

html - 是否有可能使文本溢出 :ellipsis for select with css only?

react-native - React Native 与 CRNA

react-native - 如何在 react-native-router-flux 导航栏中实现 Logo ?

html - IE9 中的 XHTML 字体浏览器兼容性

javascript - 终极版 ReactJS : How Components have access to the store?

javascript - 垂直滚动的 html 列表

javascript - jQuery .load();不工作