修改 react-native 文件
Modifying react-native files
我在 react-native 中更改了一个 BaseViewManager.java 文件,使 resource-id 通过 react-native 可用。问题是无论我做什么,都没有任何效果,即使我在 .java 文件中输入了拼写错误。我的同事告诉我这可能是因为没有构建 .java。
那么如何构建 react-native .java 文件??
我当然尝试了 npm start 但没有任何效果。
这是我要更改的代码
@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);
}
您必须从源代码构建 React Native。这是教程:https://facebook.github.io/react-native/docs/android-building-from-source.html 我试过了并且有效:)
我在 react-native 中更改了一个 BaseViewManager.java 文件,使 resource-id 通过 react-native 可用。问题是无论我做什么,都没有任何效果,即使我在 .java 文件中输入了拼写错误。我的同事告诉我这可能是因为没有构建 .java。
那么如何构建 react-native .java 文件??
我当然尝试了 npm start 但没有任何效果。
这是我要更改的代码
@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);
}
您必须从源代码构建 React Native。这是教程:https://facebook.github.io/react-native/docs/android-building-from-source.html 我试过了并且有效:)