Browse Source

ref(live-streaming): remove picker state to remove componentWillReceiveProps

master
Leonard Kim 7 years ago
parent
commit
d6216f21d5

+ 1
- 30
react/features/recording/components/LiveStream/AbstractStreamKeyForm.js View File

@@ -33,24 +33,13 @@ export type Props = {
33 33
     value: string
34 34
 };
35 35
 
36
-/**
37
- * The state of the component.
38
- */
39
-type State = {
40
-
41
-    /**
42
-     * The value entered in the field.
43
-     */
44
-    value: string
45
-}
46
-
47 36
 /**
48 37
  * An abstract React Component for entering a key for starting a YouTube live
49 38
  * stream.
50 39
  *
51 40
  * @extends Component
52 41
  */
53
-export default class AbstractStreamKeyForm extends Component<Props, State> {
42
+export default class AbstractStreamKeyForm extends Component<Props> {
54 43
     helpURL: string;
55 44
 
56 45
     /**
@@ -61,10 +50,6 @@ export default class AbstractStreamKeyForm extends Component<Props, State> {
61 50
     constructor(props: Props) {
62 51
         super(props);
63 52
 
64
-        this.state = {
65
-            value: props.value
66
-        };
67
-
68 53
         this.helpURL = (typeof interfaceConfig !== 'undefined'
69 54
             && interfaceConfig.LIVE_STREAMING_HELP_LINK)
70 55
             || LIVE_STREAMING_HELP_LINK;
@@ -73,17 +58,6 @@ export default class AbstractStreamKeyForm extends Component<Props, State> {
73 58
         this._onInputChange = this._onInputChange.bind(this);
74 59
     }
75 60
 
76
-    /**
77
-     * Implements {@code Component}'s componentWillReceiveProps.
78
-     *
79
-     * @inheritdoc
80
-     */
81
-    componentWillReceiveProps(newProps: Props) {
82
-        this.setState({
83
-            value: newProps.value
84
-        });
85
-    }
86
-
87 61
     _onInputChange: Object => void
88 62
 
89 63
     /**
@@ -99,9 +73,6 @@ export default class AbstractStreamKeyForm extends Component<Props, State> {
99 73
     _onInputChange(change) {
100 74
         const value = typeof change === 'object' ? change.target.value : change;
101 75
 
102
-        this.setState({
103
-            value
104
-        });
105 76
         this.props.onChange(value);
106 77
     }
107 78
 }

+ 1
- 1
react/features/recording/components/LiveStream/native/StreamKeyForm.js View File

@@ -50,7 +50,7 @@ class StreamKeyForm extends AbstractStreamKeyForm {
50 50
                     onChangeText = { this._onInputChange }
51 51
                     placeholder = { t('liveStreaming.enterStreamKey') }
52 52
                     style = { styles.streamKeyInput }
53
-                    value = { this.state.value } />
53
+                    value = { this.props.value } />
54 54
                 <TouchableOpacity
55 55
                     onPress = { this._onOpenHelp }
56 56
                     style = { styles.streamKeyHelp } >

+ 1
- 1
react/features/recording/components/LiveStream/web/StreamKeyForm.js View File

@@ -51,7 +51,7 @@ class StreamKeyForm extends AbstractStreamKeyForm {
51 51
                     placeholder = { t('liveStreaming.enterStreamKey') }
52 52
                     shouldFitContainer = { true }
53 53
                     type = 'text'
54
-                    value = { this.state.value } />
54
+                    value = { this.props.value } />
55 55
                 { this.helpURL
56 56
                     ? <div className = 'form-footer'>
57 57
                         <a

Loading…
Cancel
Save