|
@@ -1,6 +1,6 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
|
-import React, { Component } from 'react';
|
|
3
|
+import React, { PureComponent } from 'react';
|
4
|
4
|
import { View } from 'react-native';
|
5
|
5
|
|
6
|
6
|
import { ColorSchemeRegistry } from '../../../base/color-scheme';
|
|
@@ -46,37 +46,10 @@ type Props = {
|
46
|
46
|
dispatch: Function
|
47
|
47
|
};
|
48
|
48
|
|
49
|
|
-/**
|
50
|
|
- * The type of {@link Toolbox}'s React {@code Component} state.
|
51
|
|
- */
|
52
|
|
-type State = {
|
53
|
|
-
|
54
|
|
- /**
|
55
|
|
- * The detected width for this component.
|
56
|
|
- */
|
57
|
|
- width: number
|
58
|
|
-};
|
59
|
|
-
|
60
|
49
|
/**
|
61
|
50
|
* Implements the conference toolbox on React Native.
|
62
|
51
|
*/
|
63
|
|
-class Toolbox extends Component<Props, State> {
|
64
|
|
- state = {
|
65
|
|
- width: 0
|
66
|
|
- };
|
67
|
|
-
|
68
|
|
- /**
|
69
|
|
- * Initializes a new {@code Toolbox} instance.
|
70
|
|
- *
|
71
|
|
- * @inheritdoc
|
72
|
|
- */
|
73
|
|
- constructor(props: Props) {
|
74
|
|
- super(props);
|
75
|
|
-
|
76
|
|
- // Bind event handlers so they are only bound once per instance.
|
77
|
|
- this._onLayout = this._onLayout.bind(this);
|
78
|
|
- }
|
79
|
|
-
|
|
52
|
+class Toolbox extends PureComponent<Props> {
|
80
|
53
|
/**
|
81
|
54
|
* Implements React's {@link Component#render()}.
|
82
|
55
|
*
|
|
@@ -86,7 +59,6 @@ class Toolbox extends Component<Props, State> {
|
86
|
59
|
render() {
|
87
|
60
|
return (
|
88
|
61
|
<Container
|
89
|
|
- onLayout = { this._onLayout }
|
90
|
62
|
style = { styles.toolbox }
|
91
|
63
|
visible = { this.props._visible }>
|
92
|
64
|
{ this._renderToolbar() }
|
|
@@ -125,20 +97,6 @@ class Toolbox extends Component<Props, State> {
|
125
|
97
|
};
|
126
|
98
|
}
|
127
|
99
|
|
128
|
|
- _onLayout: (Object) => void;
|
129
|
|
-
|
130
|
|
- /**
|
131
|
|
- * Handles the "on layout" View's event and stores the width as state.
|
132
|
|
- *
|
133
|
|
- * @param {Object} event - The "on layout" event object/structure passed
|
134
|
|
- * by react-native.
|
135
|
|
- * @private
|
136
|
|
- * @returns {void}
|
137
|
|
- */
|
138
|
|
- _onLayout({ nativeEvent: { layout: { width } } }) {
|
139
|
|
- this.setState({ width });
|
140
|
|
- }
|
141
|
|
-
|
142
|
100
|
/**
|
143
|
101
|
* Renders the toolbar. In order to avoid a weird visual effect in which the
|
144
|
102
|
* toolbar is (visually) rendered and then visibly changes its size, it is
|