10 examples of 'react native margin' in JavaScript

Every line of 'react native margin' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
9var marginStyle = function marginStyle(props) {
10 if (typeof props.margin === 'string') {
11 var margin = props.theme.global.edgeSize[props.margin];
12 return '\n margin-top: ' + margin + ';\n margin-bottom: ' + margin + ';\n margin-left: ' + margin + ';\n margin-right: ' + margin + ';\n ';
13 }
14 if (props.margin.vertical) {
15 return '\n margin-top: ' + props.theme.global.edgeSize[props.margin.vertical] + ';\n margin-bottom: ' + props.theme.global.edgeSize[props.margin.vertical] + ';\n ';
16 }
17 if (props.margin.horizontal) {
18 return '\n margin-left: ' + props.theme.global.edgeSize[props.margin.horizontal] + ';\n margin-right: ' + props.theme.global.edgeSize[props.margin.horizontal] + ';\n ';
19 }
20 if (props.margin.top) {
21 return 'margin-top: ' + props.theme.global.edgeSize[props.margin.top] + ';';
22 }
23 if (props.margin.bottom) {
24 return 'margin-bottom: ' + props.theme.global.edgeSize[props.margin.bottom] + ';';
25 }
26 if (props.margin.left) {
27 return 'margin-left: ' + props.theme.global.edgeSize[props.margin.left] + ';';
28 }
29 if (props.margin.right) {
30 return 'margin-right: ' + props.theme.global.edgeSize[props.margin.right] + ';';
31 }
32 return '';
33};
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

7var marginStyle = function marginStyle(props) {
8 if (typeof props.margin === 'string') {
9 if (props.margin === 'none') {
10 return '\n margin-top: 0;\n margin-bottom: 0;\n ';
11 }
12 var margin = props.theme.global.edgeSize[props.margin];
13 return '\n margin-top: ' + margin + ';\n margin-bottom: ' + margin + ';\n ';
14 }
15 if (props.margin.top) {
16 return 'margin-top: ' + props.theme.global.edgeSize[props.margin.top] + ';';
17 }
18 if (props.margin.bottom) {
19 return 'margin-bottom: ' + props.theme.global.edgeSize[props.margin.bottom] + ';';
20 }
21 return '';
22};
23setNativeProps(props) {
24 this._component.setNativeProps(props);
25}
117value: function setNativeProps(props) {
118 if (this._listRef) {
119 this._listRef.setNativeProps(props);
120 }
121}
27const NavigationNativeContainer = React.forwardRef(function NativeContainer(
28 { theme = DefaultTheme, ...rest }: Props,
29 ref: React.Ref<NavigationContainerRef>
30) {
31 const refContainer = React.useRef<NavigationContainerRef>(null);
32
33 useBackButton(refContainer);
34
35 React.useImperativeHandle(ref, () => refContainer.current);
36
37 return (
38 <ThemeProvider value={theme}>
39 <NavigationContainer {...rest} ref={refContainer} />
40 </ThemeProvider>
41 );
42});
49value: function componentDidMount() {
50 this.updateWiderPadding();
51 this.resizeEvent = addEventListener(window, 'resize', this.updateWiderPadding);
52}
118setNativeProps(nativeProps) {
119 this._root && this._root.setNativeProps(nativeProps);
120}
93calcMargin() {
94 if (is_defined(this.icon)) {
95 const {width} = this.icon.getBoundingClientRect();
96 this.setState({margin: width / 2});
97 }
98}
91export function useNativeValue(node: Animated.Node<number>, init: number): number {
92 const [state, setState] = useState(init)
93 Animated.useCode(() => Animated.call([node], ([val]) => setState(val)), [])
94 return state
95}
492onChange: function onChange(v) {
493 return _this2.changeCustomMargin({ customMargin: v.target.checked });
494} }),

Related snippets