-
Notifications
You must be signed in to change notification settings - Fork 959
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
On iOS app crashes with the message "Got unexpected undefined" #1782
Comments
Got the same issue |
Got the same issue when navigating from login screen to home screen. Using Layout as parent in home screen. |
I'm strugling to produce a repro but I'll try again tomorrow. Hopefully I'll be able to submit a fix then. |
While navigating some times i am getting "Got unexpected undefined" throwing this error. This is happening in iOS. Please help me out in fixing this. |
@chinmay4github1987 One workaround:
This is not pretty and you might need some placeholder so that your interface does not glitch... But if you have more time, go for @psegalen solution. |
T
It is happening during navigation means switching between screens |
Got the same issue with |
I can't find a way to reproduce easily (and I can't publish my client's code), even by using Layout and playing with different things in navigation... :( |
IsFocused workaround isn't supposedly working for me. I don't have a select component rather it happens on tab bar component. So is there a solution/workaround or are they ever going to merge this. |
Has this issue been addressed? |
I am receiving the same issue. Version is js on "@ui-kitten/components": "^5.3.1" and "react-native": "^0.73.1" Issue occurs while navigating between screens and I have spent a ton of time trying to narrow down the bug. :/ Basically produces: Then trace gets to: Any help or workarounds? I am stuck :( |
Experiencing the same issue with 5.3.1, it happens some time between navigations but not every time, really hard to narrow down what's really happening 🤔 |
Has anyone found a workaround or fix? |
@GoDeepBlue you can patch UI Kitten with the code from my PR as a temporary solution until the PR is merged. |
Thank you @psegalen, I implemented the fix and seems to be working so far! You are🥇 😃 |
Hey @GoDeepBlue , could you briefly explain how did you apply the fix? Is it by manually editing the UI Kitten library in node_modules folder? |
I also need that fix. Can someone explain, please? |
Hi @adrianlzx1996 and @brunomartins-com ! |
Hey @psegalen thanks for your advise and reply! |
The solution is in measure.component.js to check for if (node):
However, I guess either a new release is needed or a patch, but not too confident |
For those using yarn patch or patch-package, here's the patch I'm using: diff --git a/node_modules/@ui-kitten/components/devsupport/components/measure/measure.component.js b/node_modules/@ui-kitten/components/devsupport/components/measure/measure.component.js
index 02180f9..b51cca0 100644
--- a/node_modules/@ui-kitten/components/devsupport/components/measure/measure.component.js
+++ b/node_modules/@ui-kitten/components/devsupport/components/measure/measure.component.js
@@ -42,7 +42,7 @@ const MeasureElement = (props) => {
if (frame.origin.x < window.size.width) {
return frame;
}
- const boundFrame = new type_1.Frame(frame.origin.x - window.size.width, frame.origin.y, frame.size.width, frame.size.height);
+ const boundFrame = new type_1.Frame(frame.origin.x - window.size.width, frame.origin.y, Math.round(frame.size.width), Math.round(frame.size.height));
return bindToWindow(boundFrame, window);
};
const onUIManagerMeasure = (x, y, w, h) => {
@@ -51,13 +51,13 @@ const MeasureElement = (props) => {
}
else {
const originY = props.shouldUseTopInsets ? y + react_native_1.StatusBar.currentHeight || 0 : y;
- const frame = bindToWindow(new type_1.Frame(x, originY, w, h), type_1.Frame.window());
+ const frame = bindToWindow(new type_1.Frame(x, originY, Math.round(w), Math.round(h)), type_1.Frame.window());
props.onMeasure(frame);
}
};
const measureSelf = () => {
const node = (0, react_native_1.findNodeHandle)(ref.current);
- react_native_1.UIManager.measureInWindow(node, onUIManagerMeasure);
+ if (node) react_native_1.UIManager.measureInWindow(node, onUIManagerMeasure);
};
if (props.force) {
measureSelf();
|
tested within my current ongoing project, the patch from @jgillick works. |
Project abandoned? |
The solution works! |
when I run Edit |
you need to patch this too |
Here are the steps to fix the issue until patch is released (also fixes #1813):
diff --git a/node_modules/@ui-kitten/components/devsupport/components/measure/measure.component.js b/node_modules/@ui-kitten/components/devsupport/components/measure/measure.component.js
index 02180f9..c952313 100644
--- a/node_modules/@ui-kitten/components/devsupport/components/measure/measure.component.js
+++ b/node_modules/@ui-kitten/components/devsupport/components/measure/measure.component.js
@@ -36,13 +36,18 @@ const type_1 = require("./type");
* but `force` property may be used to measure any time it's needed.
* DON'T USE THIS FLAG IF THE COMPONENT RENDERS FIRST TIME OR YOU KNOW `onLayout` WILL BE CALLED.
*/
-const MeasureElement = (props) => {
+const MeasureElement = ({
+ force = false,
+ shouldUseTopInsets = false,
+ onMeasure,
+ children
+ }) => {
const ref = react_1.default.useRef();
const bindToWindow = (frame, window) => {
if (frame.origin.x < window.size.width) {
return frame;
}
- const boundFrame = new type_1.Frame(frame.origin.x - window.size.width, frame.origin.y, frame.size.width, frame.size.height);
+ const boundFrame = new type_1.Frame(frame.origin.x - window.size.width, frame.origin.y, Math.round(frame.size.width), Math.round(frame.size.height));
return bindToWindow(boundFrame, window);
};
const onUIManagerMeasure = (x, y, w, h) => {
@@ -50,22 +55,19 @@ const MeasureElement = (props) => {
measureSelf();
}
else {
- const originY = props.shouldUseTopInsets ? y + react_native_1.StatusBar.currentHeight || 0 : y;
- const frame = bindToWindow(new type_1.Frame(x, originY, w, h), type_1.Frame.window());
- props.onMeasure(frame);
+ const originY = shouldUseTopInsets ? y + react_native_1.StatusBar.currentHeight || 0 : y;
+ const frame = bindToWindow(new type_1.Frame(x, originY, Math.round(w), Math.round(h)), type_1.Frame.window());
+ onMeasure(frame);
}
};
const measureSelf = () => {
const node = (0, react_native_1.findNodeHandle)(ref.current);
- react_native_1.UIManager.measureInWindow(node, onUIManagerMeasure);
+ if (node) react_native_1.UIManager.measureInWindow(node, onUIManagerMeasure);
};
- if (props.force) {
+ if (force) {
measureSelf();
}
- return react_1.default.cloneElement(props.children, { ref, onLayout: measureSelf });
+ return react_1.default.cloneElement(children, { ref, onLayout: measureSelf });
};
exports.MeasureElement = MeasureElement;
-exports.MeasureElement.defaultProps = {
- shouldUseTopInsets: false,
-};
//# sourceMappingURL=measure.component.js.map
\ No newline at end of file
|
One more step: In package.json "scripts": {
|
Ugh, I was going crazy trying to figure why my app was crashing and these patches fixed it for me |
+1, thanks for posting the fix, spent 2 days no clue lmao |
Thanks for the solution and saved my time |
🐛 Bug Report
The bug seems to occur only on iOS on one app of mine with a very confusing behavior.
To Reproduce
Steps to reproduce the behavior:
On my app:
If you don't open the Select popover there is no crash.
A quick session with Flipper shows that measureSelf passes "null" in the "node" variable.
It seems to be a problem about the Select component keeping reacting to system events after being unmounted... Adding a setTimeout() does not solve anything.
I'm fixing it with a patch adding a null check on the node variable before calling measureInWindow().
I'll work on a repro and a PR as soon as possible.
Expected behavior
App doesn't crash :)
Link to runnable example or repository (highly encouraged)
I'll try to take time to produce one later.
UI Kitten and Eva version
Environment information
The text was updated successfully, but these errors were encountered: