Я пишу обертку для реакции родной в SCALA-JsautoGenerateWrapperClass является недействительным реагировать родной
lazy val reactNative = js.Dynamic.global.require("react-native")
val View = reactNative.View
val component = ReactNativeB[Unit]("NativeYeah")
.render(P => {
reactNative.createElement(View,null)
}).buildU
reactNative.AppRegistry.registerComponent("iOSscala",() => component())
компонент зарегистрирован мелкий, но его неудачу при создании Просмотр элемента!
нуль не является функцией (оценка 'autoGenerateWrapperClass (тег)')»
Полный трассировки стека:
CTJSLog> "Error:
stack:
getComponentClassForElement index.ios.bundle:5894
validatePropTypes index.ios.bundle:5634
createElement index.ios.bundle:5681
renderApplication index.ios.bundle:33913
run index.ios.bundle:33858
runApplication index.ios.bundle:33880
jsCall index.ios.bundle:7237
_callFunction index.ios.bundle:7484
applyWithGuard index.ios.bundle:877
guardReturn index.ios.bundle:7286
callFunctionReturnFlushedQueue index.ios.bundle:7493
URL: http://localhost:8081/index.ios.bundle
line: 5894
message: null is not a function (evaluating 'autoGenerateWrapperClass(tag)')"
при отладке этой функции
function getComponentClassForElement(element) {
if (typeof element.type === 'function') {
return element.type;
}
var tag = element.type;
var componentClass = tagToComponentClass[tag];
if (componentClass == null) {
tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
}
return componentClass;
}
тег Значение ReactElement
Примечание: приведенный выше код отлично работает в реакциях с тегом div/компонентом реакции.
Редактировать: его проблема от конструктора scalajs-реагирования, который подчиняется ReactJS API, а не AppRegistry, закрывая проблему.
Я думаю, что компонент в порядке, компонент является экземпляром ReactComponentU (un установлен). при регистрации var componentClass = ReactNativeComponent.getComponentClassForElement ( элемент ); эта строка выполняется отлично, и даже я вижу там имя компонента. Единственная часть сбоя - это создание элемента View, в который я верю! – invariant
Хорошо, тогда каково значение View, когда оно передается createElement? –
reactNative.View – invariant