Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error: Exception in HostFunction: TypeError: expected dynamic type string', but had type null' #659

Open
LongHP105 opened this issue Feb 13, 2025 · 1 comment

Comments

@LongHP105
Copy link

Describe the bug

When tapping on the react-native-picker-select dropdown, it throws the following error instead of opening:
Warning: Error: Exception in HostFunction: TypeError: expected dynamic typestring', but had type null'

To Reproduce

Expected behavior

The picker should open normally and allow the user to select an option without throwing an error.

Screenshots

Image

Additional details

  • Device: iPhone 16 Pro Max
  • OS: iOS 17+
  • react-native-picker-select version: ^9.3.1
  • react-native version: 0.76.6
  • react version: 18.3.1
  • expo sdk version: 52.0.28
  • React Native new architecture: Enabled

Reproduction and/or code sample

import React, { useState } from 'react';
import { View } from 'react-native';
import RNPickerSelect from 'react-native-picker-select';

const App = () => {
  const [value, setValue] = useState(null);

  return (
    <View style={{ flex: 1, justifyContent: 'center', padding: 20 }}>
      <RNPickerSelect
        onValueChange={(val) => setValue(val)}
        items={[
          { label: 'Option 1', value: '1' },
          { label: 'Option 2', value: '2' },
        ]}
        value={value} // Added explicitly
        style={{inputIOSContainer: {pointerEvents: "none"},


}}
      />
    </View>
  );
};

export default App;
@jorgeap12345
Copy link

As for me, the problem was on the placeholder value, mine used to be this:
placeholder={{ label: "Select an option...", value: null}}

Changing it to a " " or undefined should do the trick:
placeholder={{ label: "Select an option...", value: undefined }}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants