react-native-elements icon indicating copy to clipboard operation
react-native-elements copied to clipboard

ButtonGroup fails on iOS Expo Dev Client

Open trajano opened this issue 1 year ago • 1 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

Explain what you did

Use ButtonGroup in an iOS Expo Dev Client

Expected behavior

Works as expected

Describe the bug

Got this error

TypeError: (0, _color.default)(underlayColor).alpha(activeOpacity).rgb is not a function (it is undefined)

Appears to be used here

https://github.com/react-native-elements/react-native-elements/blob/72a4ac51ac60e305c1ef8fab4f81fdc7f0b7c9dd/packages/base/src/ButtonGroup/ButtonGroup.tsx#L204C6-L207C19

This is not "blocked" by a platform check

Steps To Reproduce

1. Create a custom dev client for Expo with the peer deps of RNEUI
2. Create a button group

        <ButtonGroup
          buttons={["English", "French", "Japanese", "System"]}
          onPress={async (nextLanguageIndex) => {
            const langs = ["en", "ja", "fr", null];
            await setLanguageAsync(langs[nextLanguageIndex]);
          }}
          // selectedIndex={isSystemLanguage ? 3 : ["en", "ja", "fr"].findIndex(it => it === language)}
        />
  1. try to load up the app in DevClient


### Screenshots

_No response_

### Your Environment

React Native Elements Env Info

## Global Dependencies:

   No related dependency found

## Local Dependencies:

 - @rneui/base : ^4.0.0-rc.8
 - @rneui/themed : ^4.0.0-rc.8
 - expo : 49
 - react : 18.2.0
 - react-native : 0.72.6
 - @types/react : ~18.2.14

trajano avatar Dec 04 '23 02:12 trajano

It appears to be because of activeOpacity which is undefined by default.

Adding this to the theme seems to work

  components: {
    ButtonGroup: {
      activeOpacity: 1.0
    },

But why would that work around be needed? Perhaps a better workaround would be to have a platform specific file for android to skip the android_ripple computation as it is not needed.

trajano avatar Dec 04 '23 02:12 trajano