question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to customise FlexDirective with custom breakpoints?

See original GitHub issue

I have defined a set of custom breakpoints and have successfully managed to create custom directives for:

  • LayoutDirective
  • ShowHideDirective

However, I ran into a problem when trying to customise the FlexDirective. A snippet of my customised code looks like this

import { FlexDirective, LayoutDirective, StyleUtils, MediaMonitor } from '@angular/flex-layout';
import { LAYOUT_CONFIG, LayoutConfigOptions } from '@angular/flex-layout/core';

@Directive({
  selector: `
    [fxFlex.mobile],
    [fxFlex.s.tablet],
    [fxFlex.l.tablet],
    [fxFlex.l.tablet.landscape],
    [fxFlex.web]
  `
})
export class CustomFlexDirective extends FlexDirective {
  constructor(monitor: MediaMonitor,
              elRef: ElementRef,
              @Optional() @Self() layout: LayoutDirective,
              styleUtils: StyleUtils,
              @Inject(LAYOUT_CONFIG) layoutConfig: LayoutConfigOptions) {
    super(monitor, elRef, layout, styleUtils, layoutConfig);
  }

  ...
}

The problem I get is that the elements LAYOUT_CONFIG and LayoutConfigOptions do not seem to be available anywhere - the import for LAYOUT_CONFIG and LayoutConfigOptions fails. I also did a search across all of @angular/flex-layout in my node_modules folder and could not find these anywhere.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
simeylacommented, Jun 19, 2018

The documentation for custom breakpoints really needs to be made clearer with better examples, and explanation on overriding defaults.

The default breakpoints for tablet sized devices are 600 and 960 and the width of an iPad (most of them) is 768. So 600 is way too small and 960 won’t get triggered.

So many people will be wanting to add a breakpoint corresponding to that size and the documentation essentially just talks about printing breakpoints.

1reaction
MarcusMorbacommented, Aug 24, 2018

Totally agree to @simeyla . An example with modifying the default breakpoints and adding additional ones and add e.g. a “lt-xl”-directive would be very useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Fxlayout Custom Breakpoints - StackBlitz
function updateBreakpoints(bp:BreakPoint) {. switch(bp.alias) {. case 'sm' : bp. ... register a Custom BREAKPOINT Provider. {. provide: BREAKPOINTS,.
Read more >
How to Use Breakpoints in MUI's SX Prop (5 Examples)
Here's a guide to customizing breakpoints in the MUI Theme. Create Responsive Layout with MUI SX Breakpoints. Perhaps the most common ...
Read more >
MUI System
The system lets you quickly build custom UI components leveraging the values defined in your theme. Demo. (Resize the window to see the...
Read more >
Breakpoints - NativeBase
Breakpoints are the building blocks of responsive design. ... useBreakpointValue is a custom hook which returns the value for the current breakpoint from ......
Read more >
React-admin - Theming
For instance, to create a custom <Datagrid> component with the header style defined in the ... Use the theme breakpoints to check for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found