Skip to content
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

Undefined is not an object( evaluating 'React.PropTypes.func') #19

Open
om-harry10 opened this issue Sep 30, 2020 · 1 comment
Open

Comments

@om-harry10
Copy link

I am trying to implemnet the same code which is mentioned in this library. which is

export default class Inviewport extends Component{
    constructor(props){
        super(props);
        this.state={
                visible:false,
        }
    }

checkVisible = (isVisible) => {
    if(isVisible){
      if(!this.state.visible){
        this.setState({visible: true});
      }
    }else{
      if(this.state.visible){
        this.setState({visible: false});
      }
    }
}

        render() {
        return (
            
            <ScrollView style={{flex: 1}}>
            <InViewPort onChange={(isVisible) => this.checkVisible(isVisible)}>
              <View style={{flex: 1, height: 200, backgroundColor: 'blue'}}>
                <Text style={{color: 'white'}}>View is visible? {this.state.visible}</Text>
              </View>
            </InViewPort>
        
            <InViewPort onChange={(isVisible) => this.checkVisible(isVisible)}>
              <View style={{flex: 1, height: 200, backgroundColor: 'green'}}>
                <Text style={{color: 'white'}}>View is visible? {this.state.visible}</Text>
              </View>
            </InViewPort>
        
            <InViewPort onChange={(isVisible) => this.checkVisible(isVisible)}>
              <View style={{flex: 1, height: 200, backgroundColor: 'red'}}>
                <Text style={{color: 'white'}}>View is visible? {this.state.visible}</Text>
              </View>
            </InViewPort>
        
            <InViewPort onChange={(isVisible) => this.checkVisible(isVisible)}>
              <View style={{flex: 1, height: 200, backgroundColor: 'orange'}}>
                <Text style={{color: 'white'}}>View is visible? {this.state.visible}</Text>
              </View>
            </InViewPort>
        
            <InViewPort onChange={(isVisible) => this.checkVisible(isVisible)}>
              <View style={{flex: 1, height: 200}}>
                <Text>View is visible? {this.state.visible}</Text>
              </View>
            </InViewPort>
          </ScrollView>
            
            
            );

        }
}

When I run this code I get error:
PT

Please suggest a solution for it. Thanks in advance.

@yamill @ChelseyM @haiderali101

@sharmapr25
Copy link

@om-harry10 this repo is not getting maintain for a long time. Even I have raised a pr for this issue as a fix, not have been merged. Meanwhile, I have deployed a new library with the same functionality https://www.npmjs.com/package/@coffeebeanslabs/react-native-inviewport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants