akveo / react-native-ui-kitten

:boom: React Native UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/react-native-ui-kitten/
MIT License
10.19k stars 952 forks source link

accessoryRight of Input prop not working on expo andriod #1733

Open Joshyahweh opened 1 year ago

Joshyahweh commented 1 year ago

🐛 Bug Report

When I tried to render an icon with accessoRight it gives an error on my expo go app that "Attempt to invoke virtual method 'int.java.lang.Integer.intValue()' on a null object reference" It does not give the error on ios

To Reproduce

` export const PasswordInput: FC = ({ placeholder, value, onChangeText, status }) => { const [secureTextEntry, setSecureTextEntry] = useState(true); const theme = useTheme(); const toggleSecureEntry = () => { setSecureTextEntry(!secureTextEntry); };

const renderIcon = (properties: IconProps) => (
    <TouchableWithoutFeedback onPress={toggleSecureEntry}>
        <Icon {...properties} name={secureTextEntry ? "eye-off" : "eye"} />
    </TouchableWithoutFeedback>
);

return (
    <Input
        placeholder={placeholder}
        accessoryRight={renderIcon}
        style={[
            InputStyles.password,
            {
                borderColor: theme["color-primary-border"],
                backgroundColor: theme["color-basic-transparent-100"],
            },
        ]}
        value={value}
        onChangeText={onChangeText}
        status={status}
        secureTextEntry={secureTextEntry}
    />
);

}; `

Expected behavior

You should get the error if you run it on expo andriod

rigorcadiz commented 1 year ago

I believe this is related to this issue. https://github.com/akveo/react-native-ui-kitten/issues/1675, I think it should have not been closed because the workaround is just a dirty patch.

TL;DR; Add color="" attribute in your Icon component.

Joshyahweh commented 1 year ago

Yes, you are correct.