Просмотр исходного кода

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

master
Leonard Kim 7 лет назад
Родитель
Сommit
d6216f21d5

+ 1
- 30
react/features/recording/components/LiveStream/AbstractStreamKeyForm.js Просмотреть файл

33
     value: string
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
  * An abstract React Component for entering a key for starting a YouTube live
37
  * An abstract React Component for entering a key for starting a YouTube live
49
  * stream.
38
  * stream.
50
  *
39
  *
51
  * @extends Component
40
  * @extends Component
52
  */
41
  */
53
-export default class AbstractStreamKeyForm extends Component<Props, State> {
42
+export default class AbstractStreamKeyForm extends Component<Props> {
54
     helpURL: string;
43
     helpURL: string;
55
 
44
 
56
     /**
45
     /**
61
     constructor(props: Props) {
50
     constructor(props: Props) {
62
         super(props);
51
         super(props);
63
 
52
 
64
-        this.state = {
65
-            value: props.value
66
-        };
67
-
68
         this.helpURL = (typeof interfaceConfig !== 'undefined'
53
         this.helpURL = (typeof interfaceConfig !== 'undefined'
69
             && interfaceConfig.LIVE_STREAMING_HELP_LINK)
54
             && interfaceConfig.LIVE_STREAMING_HELP_LINK)
70
             || LIVE_STREAMING_HELP_LINK;
55
             || LIVE_STREAMING_HELP_LINK;
73
         this._onInputChange = this._onInputChange.bind(this);
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
     _onInputChange: Object => void
61
     _onInputChange: Object => void
88
 
62
 
89
     /**
63
     /**
99
     _onInputChange(change) {
73
     _onInputChange(change) {
100
         const value = typeof change === 'object' ? change.target.value : change;
74
         const value = typeof change === 'object' ? change.target.value : change;
101
 
75
 
102
-        this.setState({
103
-            value
104
-        });
105
         this.props.onChange(value);
76
         this.props.onChange(value);
106
     }
77
     }
107
 }
78
 }

+ 1
- 1
react/features/recording/components/LiveStream/native/StreamKeyForm.js Просмотреть файл

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

+ 1
- 1
react/features/recording/components/LiveStream/web/StreamKeyForm.js Просмотреть файл

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

Загрузка…
Отмена
Сохранить