-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invariant Violation: requireNativeComponent:"***" was not found in theUIManager #28836
Comments
|
我的环境信息 |
在MyWebViewPackage.java中, 需要將MyWebViewManager 添加到createViewManagers method之中, ` @OverRide @OverRide } |
我已经找到问题了,是我js注册的时候发生了问题,但是还是感谢哦。 |
在MyWebViewManager.java中
`
public class MyWebViewManager extends SimpleViewManager {
public static final String REACT_CLASS = "MyWebViewManager";
@OverRide
public String getName() {
return REACT_CLASS;
}
@OverRide
protected TextView createViewInstance(ThemedReactContext reactContext) {
TextView tv = new TextView(reactContext);
tv.setText("hello from android !");
return tv;
}
}
`
在MyWebViewPackage.java中
`
public class MyWebViewPackage implements ReactPackage {
@OverRide
public List createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
@OverRide
public List createNativeModules(
ReactApplicationContext reactContext) {
List modules = new ArrayList<>();
}
}
`
在ScannerView.js中
`
import React, { Component } from 'react'
import { View, requireNativeComponent } from 'react-native'
const MyWebViewManager = requireNativeComponent('MyWebViewManager', ScannerView);
class ScannerView extends Component {
render() {
return
}
}
ScannerView.propTypes = {
...View.propTypes
}
export default ScannerView
`
在模拟器中发生错误
Invariant Violation: requireNativeComponent:"MyWebViewManager" was not found in theUIManager.
The text was updated successfully, but these errors were encountered: