Skip to content

Custom Component Mapping not applying correctly  #1833

Description

@AngelRmrz

💬 ¿How to correctly use Custom Component Mapping?

Im facing several issues trying to use a custom component mapping, i first base on the documentation but it doesnt works, here is my currently not working approach

The IconButton.tsx file

import React from 'react';
import {EvaProp, withStyles} from '@ui-kitten/components';
import {TouchableOpacity, TouchableOpacityProps} from 'react-native';

interface IconButtonProps extends TouchableOpacityProps {
  eva?: EvaProp;
}

const IconButton: React.FC<IconButtonProps> = ({eva, style, ...props}) => {
  return <TouchableOpacity style={[eva?.style, style]} {...props} />;
};

export default withStyles(IconButton);

Here is my mapping.json file

"IconButton": {
      "meta": {
        "parameters": {
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          },
          "borderRadius": {
            "type": "number"
          },
          "backgroundColor": {
            "type": "string"
          }
        }
      },
      "appearances": {
        "filled": {
          "mapping": {
            "width": 40,
            "height": 40,
            "borderRadius": 20,
            "backgroundColor": "color-white"
          }
        }
      }
    }

I got this error log on the simulator

Simulator Screenshot - iPhone Xs - 2024-11-05 at 15 32 53

I appreciate any comments here for this approach or another.

UI Kitten and Eva version

Package Version
@eva-design/eva ^2.2.0
@ui-kitten/components ^5.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions