2016-10-10 9 views
4

最近では、単純なテキストビューでアプリケーションにネイティブの反応を統合しました。あらゆる種類のデバイスでこのクラッシュが発生しています。JSApplicationIllegalArgumentExceptionがネイティブAndroidに対応しています

Fatal Exception: com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'flex' in shadow node of type: RCTView 
     at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateShadowNodeProp(ViewManagersPropertyCache.java:109) 
     at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackShadowNodeSetter.setProperty(ViewManagerPropertyUpdater.java:148) 
     at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:52) 
     at com.facebook.react.uimanager.ReactShadowNode.updateProperties(ReactShadowNode.java:222) 
     at com.facebook.react.uimanager.UIImplementation.createView(UIImplementation.java:177) 
     at com.facebook.react.uimanager.UIManagerModule.createView(UIManagerModule.java:222) 
     at java.lang.reflect.Method.invoke(Method.java) 
     at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318) 
     at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158) 
     at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java) 
     at android.os.Handler.handleCallback(Handler.java:739) 
     at android.os.Handler.dispatchMessage(Handler.java:95) 
     at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
     at android.os.Looper.loop(Looper.java:234) 
     at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
     at java.lang.Thread.run(Thread.java:818) 
Caused by java.lang.IllegalArgumentException: method com.facebook.react.uimanager.LayoutShadowNode.setFlex argument 1 has type float, got java.lang.String 
     at java.lang.reflect.Method.invoke(Method.java) 
     at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateShadowNodeProp(ViewManagersPropertyCache.java:99) 
     at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackShadowNodeSetter.setProperty(ViewManagerPropertyUpdater.java:148) 
     at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:52) 
     at com.facebook.react.uimanager.ReactShadowNode.updateProperties(ReactShadowNode.java:222) 
     at com.facebook.react.uimanager.UIImplementation.createView(UIImplementation.java:177) 
     at com.facebook.react.uimanager.UIManagerModule.createView(UIManagerModule.java:222) 
     at java.lang.reflect.Method.invoke(Method.java) 
     at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318) 
     at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158) 
     at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java) 
     at android.os.Handler.handleCallback(Handler.java:739) 
     at android.os.Handler.dispatchMessage(Handler.java:95) 
     at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
     at android.os.Looper.loop(Looper.java:234) 
     at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
     at java.lang.Thread.run(Thread.java:818) 

我々が使用リアクトネイティブ

'use strict'; 

import React from 'react'; 
import { 
    AppRegistry, 
    StyleSheet, 
    Text, 
    View 
} from 'react-native'; 

class HelloWorld extends React.Component { 
    render() { 
    return (
     <Text style={{color: 'white'}}>React Native is running</Text> 
    ) 
    } 
} 

AppRegistry.registerComponent('8fit',() => HelloWorld); 

との単純なテキストを表示するには、ネイティブ0.35.0-rc.0反応するが、我々は安定版リリース0.33.1でも同じクラッシュを取得してきました。

ここで完全なクラッシュレポートを見つけることができます。 https://gist.github.com/sealskej/1e2398ef1cd9dda2d1b2630348fa612a

問題を解決する助けがあれば幸いです。

+0

ねえ、あなたは上記のコードで問題を再現できますか?私は同じコードを試しましたが、クラッシュしませんでした。 – Jickson

+0

flexキーワードを使用していて、その値が文字列の場合は、反応ネイティブコードベースをチェックインしてください。エラーは、float型の代わりに文字列値が渡されることを明確に指定します。 – Jickson

+0

あなたは '統合する 'と言ったので、純粋なReact Nativeプロジェクトではありません。コードは良く見えますが、セットアップエラーかもしれません。あなたのセットアップの部分をチェックして、何かを見つけるかもしれません。 – Swordsman

答えて

1

なぜこれが機能しないのかはわかりませんが、おそらく解決策はViewにラップしてflexという値を設定することです。例:

render() { 
    return (
     <View style={{flex: 1}}> 
     <Text style={{color: 'white'}}>React Native is running</Text> 
     </View> 
    ) 
    } 
+0

私はそれを試してみましょう。 – sealskej

+0

ありがとう、それは問題を解決しました。 – sealskej

0

使用されているreaction in package.jsonファイルのバージョンは、apkで使用されているsdkバージョンと異なる場合があります。

これにより、毎回IllegalArgumentExceptionが発生する可能性があります。

+0

私は 'maven {url" $ rootDir/node_modules/react-native/android "}"と 'compile" com.facebook.react:react-native:+ "'を使用しています。 npm install'、いいえ? – sealskej

関連する問題