React-native: Error while updating property 'lineHeight' in shadow node of type: RCTText

Created on 1 Jun 2016  路  4Comments  路  Source: facebook/react-native

Apparently this happens because I use

       cardContentText:{
        lineHeight: h*0.031,
      },

as the style of a <Text/>

This is the trace I got from logcat:

ViewManager: Error while updating prop lineHeight
E:ViewManager:     com.facebook.react.bridge.UnexpectedNativeTypeException: TypeError: expected dynamic type `int64', but had type `double'
E:ViewManager:     at com.facebook.react.bridge.ReadableNativeMap.getInt(Native Method)
E:ViewManager:     at com.facebook.react.uimanager.ReactStylesDiffMap.getInt(ReactStylesDiffMap.java:67)
E:ViewManager:     at com.facebook.react.uimanager.ViewManagersPropertyCache$IntPropSetter.extractProperty(ViewManagersPropertyCache.java:133)
E:ViewManager:     at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateShadowNodeProp(ViewManagersPropertyCache.java:98)
E:ViewManager:     at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackShadowNodeSetter.setProperty(ViewManagerPropertyUpdater.java:150)
E:ViewManager:     at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:52)
E:ViewManager:     at com.facebook.react.uimanager.ReactShadowNode.updateProperties(ReactShadowNode.java:176)
E:ViewManager:     at com.facebook.react.uimanager.UIImplementation.createView(UIImplementation.java:152)
E:ViewManager:     at com.facebook.react.uimanager.UIManagerModule.createView(UIManagerModule.java:198)
E:ViewManager:     at java.lang.reflect.Method.invokeNative(Native Method)
E:ViewManager:     at java.lang.reflect.Method.invoke(Method.java:511)
E:ViewManager:     at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:316)
E:ViewManager:     at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.call(NativeModuleRegistry.java:187)
E:ViewManager:     at com.facebook.react.bridge.NativeModuleRegistry.call(NativeModuleRegistry.java:62)
E:ViewManager:     at com.facebook.react.bridge.CatalystInstanceImpl$NativeModulesReactCallback.call(CatalystInstanceImpl.java:432)
E:ViewManager:     at com.facebook.react.bridge.queue.NativeRunnableDeprecated.run(Native Method)
E:ViewManager:     at android.os.Handler.handleCallback(Handler.java:725)
E:ViewManager:     at android.os.Handler.dispatchMessage(Handler.java:92)
E:ViewManager:     at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
E:ViewManager:     at android.os.Looper.loop(Looper.java:137)
E:ViewManager:     at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:187)
E:ViewManager:     at java.lang.Thread.run(Thread.java:856)

Apparently this is the same is this https://github.com/facebook/react-native/issues/3715 or this https://github.com/facebook/react-native/issues/3589 , but I'm using react native 26.1 on Android, and I still get this error.

I'm testing on:
a Genymotion Samsung Galaxy S4 with API 17.
"react-native": "^0.26.1",
"react": "15.0.2",

What to do?

Locked

Most helpful comment

lineHeight must be an integer, numbers with decimals are not considered as valid values.

All 4 comments

Should I be using lineHeight in the <Text> itself and not on its style?

lineHeight must be an integer, numbers with decimals are not considered as valid values.

@nicowrp Thanks, I know that, but that is supposed to be fixed many versions now.

Integer numbers cannot achieve the level of detail I wish to have.

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/error-while-updating-property-lineheight-in-shadow-node-of-type-rcttext

Product Pains has been very useful in highlighting the top bugs and feature requests:
https://productpains.com/product/react-native?tab=top

Also, if this issue is a bug, please consider sending a pull request with a fix.

Was this page helpful?
0 / 5 - 0 ratings