Skip to content Skip to sidebar Skip to footer

Can Not Set As Picker.item Label In Android

For my react-native app, I need Image+Text in label of Picker.Item like in picture below. Everything okay in IOS but on Android I get an error. Here is my Picker Component code. &

Solution 1:

After seeing your complete code, I can see you are using the components from NativeBase. If you see the code, it is trying to merge styles and send that to the react native picker.

By looking at the documentation, you are actually setting the styles and I am guessing the native base code is adding another styles which RN does not like.

So, take a look at this documentation, and instead of using the style prop, use the ones provided by the framework:

https://docs.nativebase.io/Components.html#picker-def-headref

See that they have headerStyle, itemStyle, itemTextStyle and textStyle.

Solution 2:

Text on Android does not allow nested views. Only nested Texts are allowed (they convert to Spans). See this link: https://facebook.github.io/react-native/docs/text.html

Post a Comment for "Can Not Set As Picker.item Label In Android"