The constants class provides an implementation of the IConstants interface. It is a nested tree of classes
the have a set of sane default values for the constants. The constants can be overridden by providing the nested
classes as options to the constants.
`ts
import {
Constants,
Border,
Spacing,
Font,
Colours,
Opacity,
Timing,
Animation,
Safe,
Theme,
} from '@ef-carbon/react-native-style';
// These classes can also all be customised
const font = new Font();
const border = new Border({ base: { radius: this.font.size.normal / 2 } });
const spacing = new Spacing({ base: this.font.size.normal });
const colour = new Colours();
const opacity = new Opacity();
const timing = new Timing();
const animation = new Animation();
const safe = new Safe();
// Bundle up the constants
const class = new Constants({
font,
border,
spacing,
colour,
opacity,
timing,
animation,
safe,
});
const theme = new Theme({ base: 'blue', constants });
`
The constants class provides an implementation of the IConstants interface. It is a nested tree of classes the have a set of sane default values for the constants. The constants can be overridden by providing the nested classes as options to the constants.
`
ts import { Constants, Border, Spacing, Font, Colours, Opacity, Timing, Animation, Safe, Theme, } from '@ef-carbon/react-native-style';// These classes can also all be customised const font = new Font(); const border = new Border({ base: { radius: this.font.size.normal / 2 } }); const spacing = new Spacing({ base: this.font.size.normal }); const colour = new Colours(); const opacity = new Opacity(); const timing = new Timing(); const animation = new Animation(); const safe = new Safe();
// Bundle up the constants const class = new Constants({ font, border, spacing, colour, opacity, timing, animation, safe, });
const theme = new Theme({ base: 'blue', constants });
`
Font
Border
Spacing
Colours
Opacity
Timing
Animation
Safe