Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Conversation

jekel1818
Copy link

No description provided.

* @param value
*/
onValueChange: (value: any) => void
onValueChange: (value: string) => void
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the android code, I think the only possible value is a string

final String finalValue = value;
...
callback.invoke(finalValue);

hide: () => void,
}

export type Item = number | string | { label: string; value: number | string }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the android code, I think items could have a more specific type than any

        if (mDataset.getType(position) == ReadableType.Map) {
            if (mDataset.getMap(position).getType("value") != ReadableType.Null) {
                if (mDataset.getMap(position).getType("value") == ReadableType.String) {
                    value = mDataset.getMap(position).getString("value");
                } else {
                    double number = mDataset.getMap(position).getDouble("value");
                    if (number == Math.rint(number)) {
                        value = String.valueOf((int) number);
                    } else {
                        value = String.valueOf(number);
                    }
                }
                if (mDataset.getMap(position).getType("label") == ReadableType.String) {
                    text = mDataset.getMap(position).getString("label");
                } else {
                    double number = mDataset.getMap(position).getDouble("label");
                    if (number == Math.rint(number)) {
                        text = String.valueOf((int) number);
                    } else {
                        text = String.valueOf(number);
                    }
                }
            }
        } else if (mDataset.getType(position) == ReadableType.String) {
            text = mDataset.getString(position);
            value = mDataset.getString(position);
        } else if (mDataset.getType(position) == ReadableType.Number) {
            double number = mDataset.getDouble(position);
            if (number == Math.rint(number)) {
                text = String.valueOf((int) number);
                value = String.valueOf((int) number);
            } else {
                text = String.valueOf(number);
                value = String.valueOf(number);
            }
        }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant