0
這是我的Router navigation setup
。我導航從EmployeeList
到EmployeeCreate
組件。當我點擊創建按鈕時,我想回到EmployeeList。從堆棧彈出反應native-router-flux導航
<Router>
<Scene key="root" hideNavBar={true}>
<Scene key="auth">
<Scene key="login" component={LoginForm} title="Login" />
</Scene>
<Scene key="main">
<Scene
onRight={() => Actions.employeeCreate()}
rightTitle="Add"
key="employeeList"
component={EmployeeList}
title="Employee List"
initial={true}
/>
<Scene key="employeeCreate" component={EmployeeCreate} title="Employee Create"/>
</Scene>
</Scene>
</Router>
我試過這樣。但得到了一個錯誤:
"There is no route defined for key employeeCreate. Must be one of: 'auth','main'"
Actions.employeeCreate({ type: 'reset' });
EmployeeCreate。 JS
onButtonPress() {
const { name, phone, shift } = this.props;
this.props.employeeCreate({name, phone, shift: shift || 'Monday'});
}
export const employeeCreate = ({ name, phone, shift }) => {
return() => {
Actions.employeeCreate({ type: 'reset' });
}
};
我怎麼能叫EmployeeList的場景主場景裏面?
你能平安的關鍵你創建按鈕的代碼調用PLZ? –
@GabrielDiez更新。請立即檢查 – Balasubramanian
嘗試Actions.pop()返回到之前的組件 –