Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Safeguard Container style when used cross-platform

Bettenbuk Zoltan31638133b7a6
diff --git a/react/features/base/react/components/AbstractContainer.js b/react/features/base/react/components/AbstractContainer.js
index 08309b6a15..932f74d53a 100644
--- a/react/features/base/react/components/AbstractContainer.js
+++ b/react/features/base/react/components/AbstractContainer.js
@@ -2,6 +2,8 @@
import React, { Component } from 'react';
+import { getFixedPlatformStyle } from '../../styles';
+
/**
* {@code AbstractContainer} component's property types.
*/
@@ -80,6 +82,7 @@ export default class AbstractContainer<P: Props> extends Component<P> {
_render(type, props?: P) {
const {
children,
+ style,
/* eslint-disable no-unused-vars */
@@ -94,7 +97,12 @@ export default class AbstractContainer<P: Props> extends Component<P> {
...filteredProps
} = props || this.props;
+ const _style = getFixedPlatformStyle(style);
+
// $FlowFixMe
- return React.createElement(type, filteredProps, children);
+ return React.createElement(type, {
+ style: _style,
+ ...filteredProps
+ }, children);
}
}
diff --git a/react/features/base/styles/functions.js b/react/features/base/styles/functions.any.js
similarity index 100%
rename from react/features/base/styles/functions.js
rename to react/features/base/styles/functions.any.js
diff --git a/react/features/base/styles/functions.native.js b/react/features/base/styles/functions.native.js
new file mode 100644
index 0000000000..854d134726
--- /dev/null
+++ b/react/features/base/styles/functions.native.js
@@ -0,0 +1,18 @@
+// @flow
+
+import { type StyleType } from './functions.any';
+
+export * from './functions.any';
+
+/**
+ * Fixes the style prop that is passed to a platform generic component based on platform specific
+ * format requirements.
+ *
+ * @param {StyleType} style - The passed style prop to the component.
+ * @returns {StyleType}
+ */
+export function getFixedPlatformStyle(style: StyleType): StyleType {
+ // There is nothing to do on mobile - yet.
+
+ return style;
+}
diff --git a/react/features/base/styles/functions.web.js b/react/features/base/styles/functions.web.js
new file mode 100644
index 0000000000..77de0c9ad8
--- /dev/null
+++ b/react/features/base/styles/functions.web.js
@@ -0,0 +1,26 @@
+// @flow
+
+import { type StyleType } from './functions.any';
+
+export * from './functions.any';
+
+/**
+ * Fixes the style prop that is passed to a platform generic component based on platform specific
+ * format requirements.
+ *
+ * @param {StyleType} style - The passed style prop to the component.
+ * @returns {StyleType}
+ */
+export function getFixedPlatformStyle(style: StyleType): StyleType {
+ if (Array.isArray(style)) {
+ const _style = {};
+
+ for (const component of style) {
+ Object.assign(_style, component);
+ }
+
+ return _style;
+ }
+
+ return style;
+}