0.0.3 • Published 6 years ago

react-native-inwindow v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

react-native-inwindow

Detects if a element is inside a ScrollView or a ListView and reports back

Install

npm i -S react-native-inwindow

Usage

import { ScrollView, View, Text } from 'react-native';
import InWindow from 'react-native-inwindow';

onViewChange = (isVisible) => {
    if(isVisible) {
        console.log('component is inside window');
    }
}

render() {
    return (
        <ScrollView style={{flex: 1}}>
            <InWindow
                duration={100} // Intervals that check if the element is in the window. default is 100
                active={true} // Check if the element is in the window. defautt is true
                onChange={this.onViewChange}>
                <View style={{flex: 1, height: 40, borderColot: '#f0f', borderColor: 1}}>
                    <Text>react-native-inwindow</Text>
                </View>
            </InWindow>
        </ScrollView>
    );
}