How can I get real elment by node id? react-native

前端 未结 7 1571
被撕碎了的回忆
被撕碎了的回忆 2020-12-30 06:05

  CLOSE


_onPress(e) {
         


        
7条回答
  •  醉酒成梦
    2020-12-30 06:53

    Another way to solve the problem in question is by using a ref (together with createRef) like so:

      const touchableRef = React.createRef();
      return (
         /* use touchableRef.current */ undefined}
        />
      );
    

    Another advantage of doing that is that the ref can be really anything, doesn't have to be the touched node.

提交回复
热议问题