import React from 'react'; import { ScrollView, StyleSheet, View } from 'react-native'; import useSandbox from '../../../useSandbox'; import { useTheme } from '../../theme'; import TabGroup, { TAB_HEIGHT } from './components/TabGroup'; const styles = StyleSheet.create({ container: { flex: 1, flexDirection: 'row', }, frame: { flex: 1, }, controls: { width: 250, borderLeftWidth: 1, }, tabGroup: { right: '100%', bottom: 0, position: 'absolute', flexDirection: 'row', }, }); export default function HorizontalFrameContent(props) { const { activeComponent, componentPanels } = props; const { activePanel, setActivePanel, layers } = useSandbox(); const { colors } = useTheme(); const [tabsWidth, setTabsWidth] = React.useState(0); const Component = (activeComponent as any).component; const panel = activePanel ? componentPanels.find(p => p.id === activePanel) : componentPanels[0]; const Panel = panel?.component; return ( {layers.filter(l => l.level !== undefined && l.level < 0).map(({ id, component: Layer }) => ( ))} {layers.filter(l => l.level === undefined || l.level >= 0).map(({ id, component: Layer }) => ( ))} {!!panel && ( ({ id: p.id, title: p.title, activeColor: p.activeTabColor, isSelected: p.id === panel.id, onPress: setActivePanel }))} onLayout={(e) => setTabsWidth(e.nativeEvent.layout.width)} /> )} ) }