File tree 1 file changed +17
-3
lines changed
1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ import WebSearchTab from "./WebSearchTab/WebSearchTab";
65
65
export class FilePicker extends React . Component <
66
66
IFilePickerProps ,
67
67
IFilePickerState
68
- > {
68
+ > {
69
69
private fileBrowserService : FileBrowserService ;
70
70
private oneDriveService : OneDriveService ;
71
71
private orgAssetsService : OrgAssetsService ;
@@ -115,6 +115,20 @@ export class FilePicker extends React.Component<
115
115
} ) ;
116
116
}
117
117
118
+ /**
119
+ * componentWillReceiveProps lifecycle hook
120
+ *
121
+ * @param nextProps
122
+ */
123
+ public componentWillReceiveProps ( nextProps : IFilePickerProps ) : void {
124
+ if ( nextProps . isPanelOpen || nextProps . isPanelOpen !== this . props . isPanelOpen ) {
125
+ this . setState ( {
126
+ panelOpen : nextProps . isPanelOpen
127
+ } ) ;
128
+
129
+ }
130
+ }
131
+
118
132
public render ( ) : JSX . Element {
119
133
// If no acceptable file type was passed, and we're expecting images, set the default image filter
120
134
const accepts : string [ ] = this . props . accepts ;
@@ -161,8 +175,8 @@ export class FilePicker extends React.Component<
161
175
{ this . props . buttonIcon || this . props . buttonIconProps ? (
162
176
< ActionButton iconProps = { buttonIconProps } { ...buttonProps } />
163
177
) : (
164
- < PrimaryButton { ...buttonProps } />
165
- ) }
178
+ < PrimaryButton { ...buttonProps } />
179
+ ) }
166
180
167
181
< Panel
168
182
isOpen = { this . state . panelOpen }
You can’t perform that action at this time.
0 commit comments