Skip to content

Commit

Permalink
♻️ 一部propsの展開を許可
Browse files Browse the repository at this point in the history
  • Loading branch information
miyasan31 committed Oct 26, 2021
1 parent 5d0ff91 commit 2e7871e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/Themed.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/destructuring-assignment */
/**
* Learn more about Light and Dark modes:
* https://docs.expo.io/guides/color-schemes/
Expand Down Expand Up @@ -31,13 +32,15 @@ export type TextProps = ThemeProps & DefaultText["props"];
export type ViewProps = ThemeProps & DefaultView["props"];

export const Text: VFC<TextProps> = (props) => {
const color = useThemeColor({ light: props.lightColor, dark: props.darkColor }, "text");
const { style, lightColor, darkColor, ...otherProps } = props;
const color = useThemeColor({ light: lightColor, dark: darkColor }, "text");

return <DefaultText style={[{ color }, props.style]} {...props} />;
return <DefaultText style={[{ color }, style]} {...otherProps} />;
};

export const View: VFC<ViewProps> = (props) => {
const backgroundColor = useThemeColor({ light: props.lightColor, dark: props.darkColor }, "background");
const { style, lightColor, darkColor, ...otherProps } = props;
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, "background");

return <DefaultView style={[{ backgroundColor }, props.style]} {...props} />;
return <DefaultView style={[{ backgroundColor }, style]} {...otherProps} />;
};

0 comments on commit 2e7871e

Please sign in to comment.