
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
react-native-appear-observer
Advanced tools
A React Native library to detect element appearance on the screen
Version 2.0 considers the mistakes of first version and expands functionality, briefly it:
Proper documentation will be added later!
Wrap the parent component with provider and supply it with parent view ref.
const App = () => {
return (
<AppearObserverProvider>
<ScrollView>{/* content */}</ScrollView>
</AppearObserverProvider>
)
}
Or use useAppearObserver hook if you want to attach callback to visibility change without changing state.
const TestView = ({ onAppear, onDisappear }: any) => {
const { refProps } = useAppearObserver({
elementRef,
onAppear,
onDisappear
})
return <View {...refProps} style={elementStyle} />
}
Usage with react navigation
const TestView = ({ onAppear, onDisappear }: any) => {
const isFocused = useIsFocused()
const { refProps } = useAppearObserver({
enabled: isFocused,
onAppear,
onDisappear,
onDisable: onDisappear // Optional
})
return <View {...refProps} style={elementStyle} />
}
useAppearObserver
| Option | Description | Default value |
|---|---|---|
| visibilityThreshold | Defines what part of an element should be visible for it to trigger callback, from 0 to 1. | 0 |
| intervalDelay | Determines a delay in milliseconds between visibility check repetitions. | 100 |
| recalculateParentBoundaries | Tells whether observer should measure parent element boundaries on every on every check or measure once and cache. | false |
useAppearObserverProvider
| Option | Description | Default value |
|---|---|---|
| enableInteractionMode | If true, the touch handlers are attached to child view of context provider and observer runs checks only upon interactions, which could affect element visibility - touch move or scroll, stopping them on after a period of inactivity. If false, checks will run permanently. | true |
FAQs
Utility to check React Native node visibility on the screen.
The npm package react-native-appear-observer receives a total of 226 weekly downloads. As such, react-native-appear-observer popularity was classified as not popular.
We found that react-native-appear-observer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.