Coder Social home page Coder Social logo

Comments (8)

christianchownsan avatar christianchownsan commented on July 17, 2024 22

In case anyone else still experiences problems with the above, I found the secret sauce for me was:

"transformIgnorePatterns": [
  "node_modules/(?!(jest-)?react-native|@react-native-community|@react-native-picker)",
],

from picker.

Maker-Mark avatar Maker-Mark commented on July 17, 2024 6

Still seeing this issue, even if using transformIgnorePatterns

from picker.

HugoLiconV avatar HugoLiconV commented on July 17, 2024 4

I added this to my package.json

"jest": {
    "transformIgnorePatterns": [
      "node_modules/(?!(react-native|react-native-vector-icons|@react-native-community/picker)/)"
    ],
}

After adding this, you'll get this error: TypeError: Cannot read property 'default' of undefined. To solve it go to node_modules/@react-native-community/picker/js/PickerIOS.ios.js and add a constructor to the PickerIOS component:

class PickerIOS extends React.Component<Props, State> {
  _picker: ?ElementRef<RNCPickerIOSType> = null;
+  constructor(props) {
+    super(props)
+  }
  state = {
    selectedIndex: 0,
    items: [],
  };
// ...

from picker.

ebaynaud avatar ebaynaud commented on July 17, 2024

Thanks @HugoLiconV, adding constructor was not required but adding @react-native-community/picker to transformIgnorePatterns helped.

from picker.

SebastianMieszczanczyk avatar SebastianMieszczanczyk commented on July 17, 2024

In case anyone else still experiences problems with the above, I found the secret sauce for me was:

"transformIgnorePatterns": [
  "node_modules/(?!(jest-)?react-native|@react-native-community|@react-native-picker)",
],

Make sure you add this under "jest" in package.json or jest config
Works for me. Thanks

from picker.

cs-manughian avatar cs-manughian commented on July 17, 2024

To fix the unexpected token error, I updated the config-overrides.js with:

module.exports = override(
    babelInclude([
        ...
        path.resolve('src'),
        path.resolve(__dirname, 'node_modules/@react-native-picker/picker'),
    ]),
);

from picker.

sorodrigo avatar sorodrigo commented on July 17, 2024

Just in case it helps. I had the same issue because I was using expo-image-picker my solution was to also ignore expo-modules-core.

from picker.

Maker-Mark avatar Maker-Mark commented on July 17, 2024

Just in case it helps. I had the same issue because I was using expo-image-picker my solution was to also ignore expo-modules-core.

I was seeing this issue without using expo-image-picker.

from picker.

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.