React native React Navigator StackNavigator:goBack在同一场景中调用两次时不起作用
假设我想实现一个具有目录结构的文件浏览器。我创建了一个React本地组件,它列出了特定文件夹的文件和目录。当我点击一个文件夹时,我希望进入新文件夹并列出它的文件和文件夹。显然,我希望能够使用相同的React组件渲染不同的文件夹 我用。这是我的密码 以下是我的尝试,但没有成功:React native React Navigator StackNavigator:goBack在同一场景中调用两次时不起作用,react-native,navigation,react-navigation,React Native,Navigation,React Navigation,假设我想实现一个具有目录结构的文件浏览器。我创建了一个React本地组件,它列出了特定文件夹的文件和目录。当我点击一个文件夹时,我希望进入新文件夹并列出它的文件和文件夹。显然,我希望能够使用相同的React组件渲染不同的文件夹 我用。这是我的密码 以下是我的尝试,但没有成功: import React, { Component } from 'react'; import { AppRegistry, BackHandler, ListView, StyleSheet, Te
import React, { Component } from 'react';
import {
AppRegistry,
BackHandler,
ListView,
StyleSheet,
Text,
TouchableNativeFeedback,
View
} from 'react-native';
import {
StackNavigator,
} from 'react-navigation';
export default class FileExplorerScene extends Component {
// Initialize the hardcoded data
constructor(props) {
super(props);
// Empty list before adding entries
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2 });
this.state = {
dataSource: ds.cloneWithRows(['a', 'b', 'c'])
};
}
onPress(rowData) {
console.log("onPress(" + rowData + ")");
this.props.navigation.navigate('FileExplorer', { parent: rowData });
}
goBack() {
this.props.navigation.goBack();
return true;
}
componentWillMount() {
BackHandler.addEventListener('hardwareBackPress', this.goBack.bind(this));
}
renderRow(rowData, sectionID, rowID) {
return (
<TouchableNativeFeedback onPress={ () => { this.onPress(rowData); }}>
<Text style={{ margin:5, fontSize: 20}}>{ rowData }</Text>
</TouchableNativeFeedback>
);
}
render() {
const { params } = this.props.navigation.state;
var currentPath;
if (params) {
currentPath = (<Text style={{ margin:10, fontSize: 24}}>Current Path: {params.parent}</Text>);
} else {
currentPath = (<Text style={{ margin:10, fontSize: 24}}>Root path</Text>);
}
return (
<View>
{ currentPath }
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderRow.bind(this)}
enableEmptySections={true}
/>
</View>
);
}
}
const App = StackNavigator(
{
FileExplorer: { screen: FileExplorerScene },
},{
headerMode: 'none',
}
);
AppRegistry.registerComponent('ReactProject', () => App);
当前路径:b
I/ReactNativeJS( 1125): onPress(b)
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 1125): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 1125): routeName: 'FileExplorer',
I/ReactNativeJS( 1125): params: { parent: 'b' },
I/ReactNativeJS( 1125): action: undefined },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 2,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 1,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 1125): goBack()
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: 'id-1497310673011-3' },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 2,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 3,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'c' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-3',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 2045): onPress(b)
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 2045): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 2045): routeName: 'FileExplorer',
I/ReactNativeJS( 2045): params: { parent: 'b' },
I/ReactNativeJS( 2045): action: undefined },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 1,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 2045): goBack()
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: null },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 3,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'c' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-3',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
当前路径:c
I/ReactNativeJS( 1125): onPress(c)
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 1125): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 1125): routeName: 'FileExplorer',
I/ReactNativeJS( 1125): params: { parent: 'c' },
I/ReactNativeJS( 1125): action: undefined },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 3,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'c' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-3',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 2,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 2045): onPress(c)
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 2045): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 2045): routeName: 'FileExplorer',
I/ReactNativeJS( 2045): params: { parent: 'c' },
I/ReactNativeJS( 2045): action: undefined },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 3,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'c' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-3',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
当前路径:b
I/ReactNativeJS( 1125): onPress(b)
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 1125): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 1125): routeName: 'FileExplorer',
I/ReactNativeJS( 1125): params: { parent: 'b' },
I/ReactNativeJS( 1125): action: undefined },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 2,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 1,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 1125): goBack()
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: 'id-1497310673011-3' },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 2,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 3,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'c' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-3',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 2045): onPress(b)
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 2045): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 2045): routeName: 'FileExplorer',
I/ReactNativeJS( 2045): params: { parent: 'b' },
I/ReactNativeJS( 2045): action: undefined },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 1,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 2045): goBack()
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: null },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 3,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'c' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-3',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 1125): goBack()
I/ReactNativeJS( 1125): goBack()
I/ReactNativeJS( 1125): goBack()
I/ReactNativeJS( 1125): goBack()
我是否正确使用了
goBack
?或者这是StackNavigator
中的一个问题?实际上将这个.props.navigation.goBack()替换为这个.props.navigation.goBack(null)
使它工作起来
这很令人困惑
现在,一切都按照我的愿望进行:
- 点击
a
:我可以看到当前路径:a
I/ReactNativeJS( 1125): onPress(a)
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 1125): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 1125): routeName: 'FileExplorer',
I/ReactNativeJS( 1125): params: { parent: 'a' },
I/ReactNativeJS( 1125): action: undefined },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 1,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 0,
I/ReactNativeJS( 1125): routes: [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' } ] } }
I/ReactNativeJS( 2045): onPress(a)
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 2045): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 2045): routeName: 'FileExplorer',
I/ReactNativeJS( 2045): params: { parent: 'a' },
I/ReactNativeJS( 2045): action: undefined },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 1,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 0,
I/ReactNativeJS( 2045): routes: [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' } ] } }
I/ReactNativeJS( 2045): goBack()
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: null },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 1,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
- 点击
b
:我可以看到当前路径:b
I/ReactNativeJS( 1125): onPress(b)
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 1125): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 1125): routeName: 'FileExplorer',
I/ReactNativeJS( 1125): params: { parent: 'b' },
I/ReactNativeJS( 1125): action: undefined },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 2,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 1,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 1125): goBack()
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: 'id-1497310673011-3' },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 2,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 3,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'c' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-3',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 2045): onPress(b)
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 2045): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 2045): routeName: 'FileExplorer',
I/ReactNativeJS( 2045): params: { parent: 'b' },
I/ReactNativeJS( 2045): action: undefined },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 1,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 2045): goBack()
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: null },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 3,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'c' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-3',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
- 点击
c
:我可以看到当前路径:c
I/ReactNativeJS( 1125): onPress(c)
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 1125): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 1125): routeName: 'FileExplorer',
I/ReactNativeJS( 1125): params: { parent: 'c' },
I/ReactNativeJS( 1125): action: undefined },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 3,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'c' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-3',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 2,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 2045): onPress(c)
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 2045): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 2045): routeName: 'FileExplorer',
I/ReactNativeJS( 2045): params: { parent: 'c' },
I/ReactNativeJS( 2045): action: undefined },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 3,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'c' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-3',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
- 回去。我可以看到
当前路径:b
I/ReactNativeJS( 1125): onPress(b)
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 1125): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 1125): routeName: 'FileExplorer',
I/ReactNativeJS( 1125): params: { parent: 'b' },
I/ReactNativeJS( 1125): action: undefined },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 2,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 1,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 1125): goBack()
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: 'id-1497310673011-3' },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 2,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 3,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'b' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-2',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' },
I/ReactNativeJS( 1125): { params: { parent: 'c' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-3',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 2045): onPress(b)
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 2045): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 2045): routeName: 'FileExplorer',
I/ReactNativeJS( 2045): params: { parent: 'b' },
I/ReactNativeJS( 2045): action: undefined },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 1,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
I/ReactNativeJS( 2045): goBack()
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: null },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 3,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'c' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-3',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
- 回去。我可以看到
当前路径:a
I/ReactNativeJS( 1125): onPress(a)
I/ReactNativeJS( 1125): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 1125): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 1125): routeName: 'FileExplorer',
I/ReactNativeJS( 1125): params: { parent: 'a' },
I/ReactNativeJS( 1125): action: undefined },
I/ReactNativeJS( 1125): newState:
I/ReactNativeJS( 1125): { index: 1,
I/ReactNativeJS( 1125): routes:
I/ReactNativeJS( 1125): [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' },
I/ReactNativeJS( 1125): { params: { parent: 'a' },
I/ReactNativeJS( 1125): key: 'id-1497310673011-1',
I/ReactNativeJS( 1125): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 1125): lastState:
I/ReactNativeJS( 1125): { index: 0,
I/ReactNativeJS( 1125): routes: [ { routeName: 'FileExplorer', key: 'Init-id-1497310673011-0' } ] } }
I/ReactNativeJS( 2045): onPress(a)
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action:
I/ReactNativeJS( 2045): { type: 'Navigation/NAVIGATE',
I/ReactNativeJS( 2045): routeName: 'FileExplorer',
I/ReactNativeJS( 2045): params: { parent: 'a' },
I/ReactNativeJS( 2045): action: undefined },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 1,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 0,
I/ReactNativeJS( 2045): routes: [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' } ] } }
I/ReactNativeJS( 2045): goBack()
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: null },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 1,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 2,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' },
I/ReactNativeJS( 2045): { params: { parent: 'b' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-2',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
- 回去。我可以看到
根路径
I/ReactNativeJS( 2045): goBack()
I/ReactNativeJS( 2045): 'Navigation Dispatch: ', { action: { type: 'Navigation/BACK', key: null },
I/ReactNativeJS( 2045): newState:
I/ReactNativeJS( 2045): { index: 0,
I/ReactNativeJS( 2045): routes: [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' } ] },
I/ReactNativeJS( 2045): lastState:
I/ReactNativeJS( 2045): { index: 1,
I/ReactNativeJS( 2045): routes:
I/ReactNativeJS( 2045): [ { routeName: 'FileExplorer', key: 'Init-id-1497998297948-0' },
I/ReactNativeJS( 2045): { params: { parent: 'a' },
I/ReactNativeJS( 2045): key: 'id-1497998297948-1',
I/ReactNativeJS( 2045): routeName: 'FileExplorer' } ] } }
- 回去。没有预期的结果:-)