React-Native ActionButton自动触发onPress而不点击按钮

时间:2017-11-01 09:35:06

标签: react-native

我需要的是触发onPress的{​​{1}}方法而不点击它。

这是我的代码:

ActionButton

1 个答案:

答案 0 :(得分:1)

您可能希望按照此答案中的说明操作:How can I trigger a tabItem onPress within a component using React Native?

不要试图调用onPress本身,只需将onPress prop设置为函数并在需要的地方调用该函数。不需要乱搞refs或类似的东西。