Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions packages/react-native-ficus-ui/src/components/center/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { NativeFicusProps, ficus } from '../system';
import { ThemingProps, omitThemingProps } from '../../style-system';
import { NativeFicusProps, ficus, useStyleConfig } from '../system';

export interface CenterProps extends NativeFicusProps<'View'> {}
export interface CenterProps
extends NativeFicusProps<'View'>,
ThemingProps<'View'> {}

export const Center = ficus('View', {
baseStyle: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
});
export const Center = function Center(props: CenterProps) {
const styles = useStyleConfig('Center', props);
const { ...rest } = omitThemingProps(props);

return <ficus.View __styles={styles} {...rest} />;
};
13 changes: 13 additions & 0 deletions packages/react-native-ficus-ui/src/theme/components/center.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { TextProps } from '../../components';
import { defineStyle, defineStyleConfig } from '../../style-system';

const baseStyle = defineStyle<TextProps>({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
});

export const centerTheme = defineStyleConfig({
baseStyle,
defaultProps: {},
});
2 changes: 2 additions & 0 deletions packages/react-native-ficus-ui/src/theme/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { avatarTheme } from './avatar';
import { badgeTheme } from './badge';
import { buttonTheme } from './button';
import { centerTheme } from './center';
import { checkboxTheme } from './checkbox';
import { checkboxGroupTheme } from './checkbox-group';
import { iconButtonTheme } from './icon-button';
Expand All @@ -20,6 +21,7 @@ export const components = {
Badge: badgeTheme,
Button: buttonTheme,
Checkbox: checkboxTheme,
Center: centerTheme,
CheckboxGroup: checkboxGroupTheme,
Radio: radioTheme,
RadioGroup: radioGroupTheme,
Expand Down