-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
In-app inspector throws error when assigning percentage strings to padding(like this --> padding: '10%'), although it works in the UI. #17496
Comments
+1 this issue occurs when using StyleSheet and ExtendedStyleSheet |
This comment has been minimized.
This comment has been minimized.
Re-opening because 0.52 was the latest on Jan 9. |
How has this not received any attention? I've read multiple issues describing the same behaviour, yet they keep on being closed because they become 'stale'. |
Can confirm this happening in React Native version 0.53.3 and 0.55.3 |
This comment has been minimized.
This comment has been minimized.
@ggtmtmgg the layout is rendered correctly but error is thrown when you inspect through the react-native inspector. |
Ran into this issue with Digging deeper, getting the actual content size actually seems fairly involved. Still, I think this should be a much higher priority issue than it is being treated as. |
for now I monkey patched the offending code to avoid the errors |
@hramos I'm interested in helping out with fixing this, but I'm a bit stuck on how to debug the inspector. I'd like to run the CLI with the modified version of the library. I've tried copying over the relevant parts (resulting in package declaration clashes), and I've also tried importing the Inspector.js file from the modified RN codebase from within a test project (resulting in a module not resolved error). Do you have any suggestions? |
@gandreadis the easiest way to debug this would be to use the RNTester app, and edit in the repo directly. |
@ericlewis Thanks for the suggestion, that's exactly what I needed! I'll have a look. |
I've submitted a fix for this at #23804, let me know if you have any feedback! |
Summary: Currently, when relative sizes are given in margin or padding stylings (be it a percentage or an auto measure), the inspector crashes, due to frame rendering not properly handling those kinds of measurements. This PR adds a resolution step for them: * Percentages are evaluated relative to the window size. * I decided to simply not render `auto` margins/paddings, due to the complexities involved (e.g. when the margin is between multiple elements with relative sizes). Since the inspector does not crash anymore on relative sizes on paddings or margins, I believe that this addresses #17496. Fixes #17496 [General] [Fixed] - Fix inspector rendering of relative margins and paddings Pull Request resolved: #23804 Differential Revision: D14437273 Pulled By: cpojer fbshipit-source-id: c9f0f71a2e1b2399a2b2148cef2124787703ead3
Is this a bug report?
YES
Have you read the Contributing Guidelines?
YES
Environment
Environment:
OS: macOS Sierra 10.12
Node: 7.5.0
Yarn: 0.20.3
npm: 5.4.2
Watchman: 4.7.0
Xcode: Xcode 8.3.1 Build version 8E1000a
Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.52.0 => 0.52.0
Target Platform: iOS (10.3)
Steps to Reproduce
padding: '10%'
.Expected Behavior
The inspector shouldn't have thrown an error. It should have work the same way if I have given a padding as a number.
Actual Behavior
React-Native supports padding using percentage strings but the inspector is throwing error that the padding should be a number rather than a string.
Reproducible Demo
I have added a padding as a string in this app.js file. Just replace the default app.js file with this one.
PR opportunity
I think it is a good first bug. I would love to send a PR for this.
Thank You 😄
The text was updated successfully, but these errors were encountered: