Это мой Router navigation setup
. Я перешел от компонента EmployeeList
к компоненту EmployeeCreate
. Я хочу вернуться к списку сотрудников, когда нажимаю кнопку Создать.
<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>
Я пробовал вот так. Но получил ошибку:
«Для ключевого employeeCreate не определен маршрут. Должен быть одним из: «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 внутри основной сцены?