summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-07-18 13:33:53 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-07-18 20:06:22 +0200
commit4ee82a1d456158635cd6998cbf087ef32fb68c41 (patch)
tree013e1a655ee03a80a85e755c6b834e1c0e572335 /app
parente6dc383704b1c7a6aff8abfad2bd5e2d948138cc (diff)
downloadmullvadvpn-4ee82a1d456158635cd6998cbf087ef32fb68c41.tar.xz
mullvadvpn-4ee82a1d456158635cd6998cbf087ef32fb68c41.zip
Do not depend on node.type.name, instead compare prototypes
Diffstat (limited to 'app')
-rw-r--r--app/components/AppButton.js5
-rw-r--r--app/components/Cell.js10
2 files changed, 8 insertions, 7 deletions
diff --git a/app/components/AppButton.js b/app/components/AppButton.js
index 7419203472..4ce085af49 100644
--- a/app/components/AppButton.js
+++ b/app/components/AppButton.js
@@ -3,6 +3,7 @@ import * as React from 'react';
import { Button, Text, Component } from 'reactxp';
import styles from './AppButtonStyles';
import blurStyles from './BlurAppButtonStyles';
+import Img from './Img';
export class Label extends Text {}
@@ -32,11 +33,11 @@ class BaseButton extends Component {
if (React.isValidElement(node)) {
let updatedProps = {};
- if (node.type.name === 'Label') {
+ if (node.type === Label) {
updatedProps = { style: [styles.label, this.textStyle()] };
}
- if (node.type.name === 'Img') {
+ if (node.type === Img) {
updatedProps = { tintColor: 'currentColor', style: [styles.icon, this.iconStyle()] };
}
diff --git a/app/components/Cell.js b/app/components/Cell.js
index 9f0efaab2c..2b3c06a3b1 100644
--- a/app/components/Cell.js
+++ b/app/components/Cell.js
@@ -2,9 +2,9 @@
import * as React from 'react';
import { Button, Text, Component, Types } from 'reactxp';
-import { colors } from '../config';
-
+import Img from './Img';
import { createViewStyles, createTextStyles } from '../lib/styles';
+import { colors } from '../config';
const styles = {
...createViewStyles({
@@ -86,20 +86,20 @@ export class CellButton extends Component<CellButtonProps, State> {
if (React.isValidElement(node)) {
let updatedProps = {};
- if (node.type.name === 'Label') {
+ if (node.type === Label) {
updatedProps = {
style: [styles.label, node.props.style, this.textStyle(node.props.cellHoverStyle)],
};
}
- if (node.type.name === 'Img') {
+ if (node.type === Img) {
updatedProps = {
tintColor: 'currentColor',
style: [styles.icon, node.props.style, this.iconStyle(node.props.cellHoverStyle)],
};
}
- if (node.type.name === 'SubText') {
+ if (node.type === SubText) {
updatedProps = {
style: [
styles.subtext,