This commit is contained in:
Gerard Burns 2023-08-18 12:23:35 +01:00
parent e5f818a0ce
commit 5aea392616
1 changed files with 13 additions and 3 deletions

View File

@ -998,12 +998,17 @@ export const getFrontendStore = () => {
const componentId = state.selectedComponentId
const screen = get(selectedScreen)
const parent = findComponentParent(screen.props, componentId)
// Check we aren't right at the top of the tree
const index = parent?._children.findIndex(x => x._id === componentId)
if (!parent || componentId === screen.props._id) {
if (componentId === 'screen') {
return null
}
if (componentId === 'navigation') {
return "screen"
}
if (parent._id === screen.props._id && index === 0) {
return "navigation"
}
// If we have siblings above us, choose the sibling or a descendant
if (index > 0) {
@ -1025,12 +1030,17 @@ export const getFrontendStore = () => {
return parent._id
},
getNext: () => {
const state = get(store)
const component = get(selectedComponent)
const componentId = component?._id
const screen = get(selectedScreen)
const parent = findComponentParent(screen.props, componentId)
const index = parent?._children.findIndex(x => x._id === componentId)
if (state.selectedComponentId === 'screen') {
return 'navigation'
}
// If we have children, select first child
if (component._children?.length) {
return component._children[0]._id