Skip to content

@rneui/themed - New version of react results in error for Button -> "undefined is not an object (evaluating 'theme.spacing[radius]')" #3519

@brycedeneen

Description

@brycedeneen

Is there an existing issue for this?

  • I have searched the existing issues

Explain what you did

Upgraded to the new react version on a working project. When I go back to the standard react button the error goes away

Expected behavior

The button to load/work

Describe the bug

When using the @rneui/themed regardless of what I use for radius (or don't use) it crashes the app and the error message is "undefined is not an object (evaluating 'theme.spacing[radius]')"

Steps To Reproduce

Here is my code for easy reference  (I commented a few things out but did try to set radius to different sizes, numeric values, etc, all result in this error).

import {Button} from '@rneui/themed';
import React from 'react';
import {StyleSheet} from 'react-native';

export default function MYButton(props: any) {
    return (
        <Button
            buttonStyle={[styles.button, props.buttonStyle]}
            titleStyle={props.titleStyle}
            title={props.title}
            type={props.type}
            onPress={props.onPress}
            disabled={props.disabled ?? false}
            loading={props.loading}
            icon={{name: props.iconName, color: props.iconColor}}
            // loadingRight={props.loading ? props.loading : true}
            // radius={'xs'}
        />
    );
}

const styles = StyleSheet.create({
    button: {
        marginBottom: 7,
        marginTop: 10,
        // borderRadius: 20,
    },
});

Screenshots

No response

Your Environment

`npx @rneui/envinfo`
  ```
    Output from `npx @rneui/envinfo` goes here.
  ```

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