-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix based on #4 #7
base: master
Are you sure you want to change the base?
Conversation
src/index.tsx
Outdated
@@ -16,7 +16,7 @@ export interface Props { | |||
|
|||
const VisibilitySensor: React.FC<Props> = (props) => { | |||
const myView: any = useRef(null); | |||
const [lastValue, setLastValue] = useState<boolean>(false); | |||
const [lastValue, setLastValue] = useState<boolean>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋🏽 Argument of type 'null' is not assignable to parameter of type 'boolean'. Why can't we stick with false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just following from this #4 (comment)
@@ -16,7 +16,7 @@ export interface Props { | |||
|
|||
const VisibilitySensor: React.FC<Props> = (props) => { | |||
const myView: any = useRef(null); | |||
const [lastValue, setLastValue] = useState<boolean>(false); | |||
const [lastValue, setLastValue] = useState<boolean | null>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, me again with some feedback. I'm trying to understand why we go for a double type declaration here. What's the scenario where setting this to false
(instead of null
), and removing line 29, that it would still show undesired behavior?
Happy to merge this PR, just trying to wrap my head around why this would work.
No description provided.