修改react-native文件

时间:2017-07-25 13:37:14

标签: java android react-native ui-testing

我在react-native中更改了一个BaseViewManager.java文件,以通过react-native使资源ID可用。问题在于,无论我做什么,即使我在.java文件中输入拼写错误也没有任何效果。我的同事告诉我,可能是因为.java没有建成。

那么如何构建react-native .java文件?

我当然尝试了npm,但没有任何效果。

这是我想要更改的代码

@ReactProp(name = PROP_TEST_ID)
  public void setTestId(T view, String testId) {
    view.setTag(R.id.react_test_id, testId);

    // temporarily set the tag and keyed tags to avoid end to end test regressions
    view.setTag(testId);
  }

  @ReactProp(name = PROP_NATIVE_ID)
  public void setNativeId(T view, String nativeId) {
    view.setTag(R.id.view_tag_native_id, nativeId);
    ReactFindViewUtil.notifyViewRendered(view);
}

1 个答案:

答案 0 :(得分:2)

您必须从源代码构建React Native。这是教程:https://facebook.github.io/react-native/docs/android-building-from-source.html我尝试了它并且它有效:)