styled components themeprovider typescript code example

Example 1: styled components default theme typescript

// import original module declarations
import 'styled-components';

// and extend them!
declare module 'styled-components' {
  export interface DefaultTheme {
    borderRadius: string;

    colors: {
      main: string;
      secondary: string;
    };
  }
}

Example 2: styled components attrs

export const TextInputElement = styled.TextInput.attrs(props => ({
  placeholderTextColor: props.ColorPlaceholder,
}))`
  font-size: 15px;
  line-height: 18px;
  color: '#000';
`;

Tags:

Misc Example