React Native : how to change value dynamically

前端 未结 2 1164
有刺的猬
有刺的猬 2021-02-01 04:43

I want to change value dynamically at some event

Event:

BackgroundGeolocation.on(\'location\', (location) => {      
    currentDistance =  distance(         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-02-01 05:32

    Use:

     this._MyComponent=component}/> 
    

    instead of:

    
    

    Then you can change the text this way:

    onPress= {()=> {
        this._MyComponent.setNativeProps({text:'my new text'});
    }
    

提交回复
热议问题