admin管理员组

文章数量:1279042

I am new in React-Native. and I am trying to set image delay to load function in react native.

              <Image  style={{  width:250, height: 250 }}
                source={require('../images/cart.png')}
                onLoad={() => {
                   this.props.navigation.navigate('HomeScreen')
                }}
             />

I am trying this but it gets an error

                 onLoad={() => {
                   setTimeout(function(){
                      this.props.navigation.navigate('HomeScreen')
                  }, 3000);
                  }}

I am new in React-Native. and I am trying to set image delay to load function in react native.

              <Image  style={{  width:250, height: 250 }}
                source={require('../images/cart.png')}
                onLoad={() => {
                   this.props.navigation.navigate('HomeScreen')
                }}
             />

I am trying this but it gets an error

                 onLoad={() => {
                   setTimeout(function(){
                      this.props.navigation.navigate('HomeScreen')
                  }, 3000);
                  }}
Share Improve this question edited Aug 4, 2021 at 3:24 Federico Baù 7,7355 gold badges40 silver badges48 bronze badges asked Oct 4, 2018 at 11:01 Rushi daveRushi dave 1642 gold badges6 silver badges20 bronze badges 1
  • @ShibinRajuMathew redirect after sometimes – Rushi dave Commented Oct 4, 2018 at 11:07
Add a ment  | 

1 Answer 1

Reset to default 10

Can you try this arrow function notation

setTimeout(() => {
this.props.navigation.navigate('HomeScreen');
}, 3000);

本文标签: javascripthow to set timeout function in react nativeStack Overflow