Skip to content

Flickering of screen when loading font files inside createGlobalStyles #2900

@rahul3103

Description

@rahul3103

Environment

`## System:

  • OS: macOS 10.15.1
  • CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  • Memory: 42.50 MB / 16.00 GB
  • Shell: 5.7.1 - /bin/zsh

Binaries:

  • Node: 13.2.0 - ~/.nvm/versions/node/v13.2.0/bin/node
  • Yarn: 1.19.2 - /usr/local/bin/yarn
  • npm: 6.13.1 - ~/.nvm/versions/node/v13.2.0/bin/npm

npmPackages:

  • babel-plugin-styled-components: ^1.10.6 => 1.10.6
  • styled-components: ^5.0.0-rc.2 => 5.0.0-rc.2`
  • @material-ui/core": "^4.7.0",

Reproduction

I have provided the video link where I have used 1 component with transition and other without it. Where i haven't used transition its working correctly but where I am using transition the whole screen flickers.

Steps to reproduce

import { createGlobalStyle } from 'styled-components';

const GlobalStyle = createGlobalStyle`
  @font-face {
    font-family: "MyFont";
    src: url("static/fonts/Std-Regular.otf");
  }
  @font-face {
    font-family: "MyFont";
    font-weight: bold;
    src: url("static/fonts/Std-Bold.otf");
  }
  @font-face {
    font-family: "MyFont";
    font-weight: 600;
    src: url("static/fonts/Std-SemiBold.otf");
  }
  
`;

export default GlobalStyle;

Expected Behavior

No flickering on first time pop up

Actual Behavior

https://youtu.be/oah3JzZDOl0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions