Skip to content

TypeError: theme[_base.themePropertyMap[property]] is not a function #4116

@seyaobey-dev

Description

@seyaobey-dev

Describe the bug
I am suddenly getting the following error after having upgraded to v3.2.0:

TypeError: theme[_base.themePropertyMap[property]] is not a function. (In 'theme[_base.themePropertyMap[property]](colorModeProps)', 'theme[_base.themePropertyMap[property]]' is an instance of Object)
This error is located at:
    in ForwardRef (at Icon.tsx:30)

Now even after having downgradedback to v3.1.0 I'm still having the same error, not sure why...

To Reproduce
This code was working before upgrading. I'm not sure exactly what steps to follow to reproduce it.
Here is the breaking codes:
1. breaking component: IconButton

    <IconButton
      onPress={onPress}
      variant={active ? "outline" : "ghost"}
      borderColor={active ? "theme-primary" : "gray.200"}
      rounded="full"
      bg={active ? "violet.200" : "gray.300"}
      _pressed={{
        bg: "violet.200",
      }}
      shadow={8}
      style={{...}}
      icon={
        <Icon
          shadow={3}
          size={8}
          color={active ? "theme-primary" : "blueGray.500"}
          as={MaterialIcons}
          name={name}
        />
      }
    />

And here is my theme object:

export const appTheme = extendTheme({
  colors: {
    "theme-primary": baseTheme.colors.green[500],
    "theme-secondary": baseTheme.colors.lime[300],
  },
  components: {
    Text: {
      baseStyle: {
        color: "blueGray.500",
      },
    },
    Heading: {
      baseStyle: {
        color: "blueGray.500",
        fontWeight: "light",
      },
    },
  },
});

Expected behaviour
Application should not crash and work like before

Platform

  • NativeBase version 3.2.0 && 3.1.0
  • Device: iphone 12, android
  • React Native version sdk 42
  • Expo sdk 42
  • node 14
  • yarn 1

IMG_E2A46D292764-1
Additional information

  1. Add any other context about the problem here.
  2. Is the bug present in both iOS and Android or in any one of them?
  3. If you want your issue to be looked at quicker, please attach a snack reproducible with your issue. Makes it easier for us!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions