
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-native-in-port
Advanced tools
Use LightHouse and Ship to detect if a children component is inside the Viewport
Use LightHouse and Ship to detect if a children component is inside the (View)port.
npm install react-native-in-port
const ScrollViewExample = () => {
return (
// LightHouse's child component can only be ScrollView or FlatList.
// When scroll and focus events occur, LightHouse asks the Ship if it is within a (view)port.
// throttleTime: dafault === 500
<LightHouse throttleTime={100}>
<ScrollView style={styles.scrollView} scrollEventThrottle={1}>
{colors.map((color, index) => (
<Ship
key={index}
detectPercent={50}
// Adjust the detection condition by adjusting the viewport area.
viewportMargin={{ top: headerHeight, bottom: 70 }}
onPort={(state) => {
// You may call the tracking API in this part.
// --------------------------------------------
// await analytics().logEvent('viewed', {
// useId: 3745092,
// description: 'User viewed an ad space.',
// })
// --------------------------------------------
const { isInPort, inPortCount } = state;
// Return values can be passed as child props.
return {
nextProps: { backgroundColor: isInPort ? 'gray' : color },
isValidInPort: inPortCount < 1,
};
}}
>
<Box backgroundColor={color} />
</Ship>
))}
</ScrollView>
</LightHouse>
);
};
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library
FAQs
Use LightHouse and Ship to detect if a children component is inside the Viewport
We found that react-native-in-port demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.