Skip to content

Commit cc13a73

Browse files
MateusAndradefacebook-github-bot
authored andcommitted
Improving Modal visible prop check to handle undefined and null (facebook#22072)
Summary: Changing the the this.props.visible if to be ` if (!!this.props.visible === false)` . So passing undefined, or other values wont set the modal to be visible. Granting that anything that is not true, will set the modal to null on the render. I make this this PR, because on the company that im working, we used a lot of RN. At the moment, we arent using anything like flow or TS. But to grant that the modals will only show if they are set visible to true i have changed the if made. _Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_ Pull Request resolved: facebook#22072 Differential Revision: D12918086 Pulled By: TheSavior fbshipit-source-id: 8f9c63ac6fd56d83949bb8428ad7c5b7bf805c49
1 parent b03b9d5 commit cc13a73

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Libraries/Modal/Modal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class Modal extends React.Component<Props> {
217217
}
218218

219219
render(): React.Node {
220-
if (this.props.visible === false) {
220+
if (this.props.visible !== true) {
221221
return null;
222222
}
223223

0 commit comments

Comments
 (0)