Giter Site home page Giter Site logo

Comments (9)

wesleyvandevoorde avatar wesleyvandevoorde commented on June 11, 2024

We are having the same issue, also objects as values don't seem to work. Only strings are working

from react-native-picker-select.

karo-dc avatar karo-dc commented on June 11, 2024

Same here, any update?

from react-native-picker-select.

joeldebont avatar joeldebont commented on June 11, 2024

I'm having the same issue on react-native 73.2.

from react-native-picker-select.

zabojad avatar zabojad commented on June 11, 2024

Has anyone found a solution?

from react-native-picker-select.

dpatra avatar dpatra commented on June 11, 2024

Any Solutions please

from react-native-picker-select.

zabojad avatar zabojad commented on June 11, 2024

use strings only with picker and convert them to numbers when needed...

from react-native-picker-select.

girardinsamuel avatar girardinsamuel commented on June 11, 2024

I experienced the same issue !
I will convert values to strings in the meantime.

from react-native-picker-select.

andrejpavlovic avatar andrejpavlovic commented on June 11, 2024

Seems issue originates from here: react-native-picker/picker#538

from react-native-picker-select.

hardchopshoppirate avatar hardchopshoppirate commented on June 11, 2024

Temporary solution: create a wrapper component that converts a value (if it is a number) to a string, then back to the original type. Cannot use prev version due to expo 50 complains. That is the only way it may work for me :(

Pseudocode below:

type SelectProps = {
  value: string | number;
  options: { value: string | number; label: string };
  onChange: (value: any) => void;
}

const Select = ({ selectedValue, options, onChange }) => {
  const originalValueType = useRef(
    detectType(value),
  );

  const valueString = String(selectedValue);
  const options = options.map((item) => ({ label: item.label, value: String(item.value) }));
  const handleChange = (value: any) => {
    onChange(
      convertToType(value, originalValueType),
     );
  };

  return (
    <RNPickerSelect
      value={valueString}
      items={options}
      onValueChange={handleChange}
    />
  );
}

from react-native-picker-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.