-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'size' of undefined #6626
Comments
➤ PM Bot commented: Jira ticket: RJS-2805 |
@ronkorland Please provide a reproduction case or at least a stack trace. |
@kneth the following stack trace is not enough?
|
I have the same issue. Seems to have happened after upgrading to react-native 0.74. |
I'm using |
do you have this I fixed it by removing it and adding this to my config instead: overrides: [
{
exclude: /node_modules\/realm\//,
plugins: [['@babel/plugin-transform-private-methods', { loose: true }]],
},
], |
Thanks for reply, me babel config looks like this:
|
did you reset the cache after editing the config file?
|
@Mitch528 I try now with the reset cache but I still have the same error |
Hello @ronkorland did you happen to resolve this issue? |
No
|
Hello. Is any update on this issue? |
Hello. After upgrading react-native from package.json: {
"name": "Test",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"react": "18.2.0",
"react-native": "0.74.1",
"realm": "12.6.2"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.74.83",
"@react-native/eslint-config": "0.74.83",
"@react-native/metro-config": "0.74.83",
"@react-native/typescript-config": "0.74.83",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
} babel.config.js: module.exports = {
presets: ['module:@react-native/babel-preset'],
}; |
Hello everyone, I've tried to figure it out this problem in last days but without success so far. The only thing that did work for me was to modify the code of the module from:
to:
in node_modules/realm/dist/bundle.react-native.js file. |
@davide-ciraolo You have a couple of interesting observations, and I am curious to understand the impact of Babel is (#6626 (comment) is hinting that Babel might have a negative impact). Can you share your Babel configuration? |
Hello @kneth yesterday after putting in place my "temporary fix" I continued developing my application and had another problem with the FlastList component that I ended up fixing following this answer: facebook/react-native#36828 (comment). Today I removed my "temporary fix" and after resetting the cache with
I hope it will be helpful for anyone having the same issue, although I'm not sure what's going on with babel under the hood. In fact, the expo-realm example works without using the
|
solution valid for min using react-native-cli in version v0.74.2 🚀 |
hmm, facing the same issue I've resolved it by adding as I see, the main issue was having this plugin |
can you please share your babel config settings? |
@ronkorland here it is
|
@ApacheEx after adding exclude: /node_modules/realm//, into babel config when I run my application my app is crashing can you please help me |
Can you provide the error message and a stack trace? |
@kneth Error: Babel Config:
|
Removing the plugin ['@babel/plugin-proposal-private-methods', { loose: true }], Fixed my issue. |
The plugin is deprecated so I assume it is safe to remove it 😄 |
Hi everyone, I encountered a similar issue with Babel configuration in my React Native project using Realm, and I found a solution that worked for me:
|
Hi everyone, are there any updates on this one? |
How frequently does the bug occur?
Always
Description
realm: 12.6.2
@realm/react: 0.6.2
I created one react-native page inside react-router; the page uses the
useQuery
hook to query my model.When I open the page, I always get the following error:
TypeError: Cannot read property 'size' of undefined
Stacktrace & log output
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
12.6.2
What services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
Android 13
Build environment
Which debugger for React Native: Flipper
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: