import { TouchableOpacity, Text, StyleSheet, View, StyleProp, ViewStyle } from 'react-native'; import React, { ComponentType } from 'react'; import { useTheme } from './ThemeContext'; export type ButtonProps = { readonly active?: boolean; readonly onPress?: () => void; readonly text: string; readonly width?: number; readonly wrapperStyle?: StyleProp; }; const Button: ComponentType = ({ text, onPress, active = false, width, wrapperStyle = {}, }: ButtonProps) => { const theme = useTheme(); const wrapperWidth: StyleProp = width ? { flexBasis: width } : {}; return ( {text} ); }; type ButtonGroupProps = { readonly children: React.ReactNode }; const ButtonGroup: ComponentType = ({ children }: ButtonGroupProps) => { const theme = useTheme(); return {children}; }; const CompoundButtonGroup = ButtonGroup as typeof ButtonGroup & { Button: typeof Button; }; CompoundButtonGroup.Button = Button; export default CompoundButtonGroup;