-2

in react-native ui kitten Button when i want to make a condition about loading to show the Spinner icon it not work when the icon props return null or false

Image of code

when the icon exist it shows like this so its good for me image of app response

but when the response is false i gives a error i hope its not a bug :'(

Image of error

Omar Borji
  • 223
  • 2
  • 9

1 Answers1

0

This is incorrect usage of icon property. You can't return a function that renders nothing, but you can return a function or nothing. In your case it should be:

icon={loading && spinnerIcon}
artyorsh
  • 372
  • 1
  • 2
  • 6