-
-
Notifications
You must be signed in to change notification settings - Fork 452
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
Version 1.6.2 stops working on react-native 0.74.5 #479
Comments
Hmm, probably caused by #475 Do you have a small reproduction of this issue? |
Same for me I had to downgrade to 1.6.1 for it to work again |
Same issue for me 1.6.2 is no longer working with Expo 51 |
Same Issue for me |
Same issue for me. It occurred after I updated to Expo 51 SDK (react native 0.74). |
Same issue with 1.6.1. if |
Same issue for me on react-native 0.73.9 with 1.6.2. 1.6.1 works well. |
RCA: In react-native-collapsible/Collapsible.js Line 191 in 038f436
Height will be 0 if hasKnownHeight is false. But hasKnownHeight is true only when users expand options (collapsed change from true to false) react-native-collapsible/Collapsible.js Line 45 in 038f436
In case the collapse is false initially, we should show the content, but we don’t have the logic to measure content -> hasKnownHeight is false -> height is 0 Solution: We should trigger _toggleCollapsed in componentDidMount or _handleLayoutChange if this.props.collapsed is false componentDidMount(){
if(!this.props.collapsed){
this._toggleCollapsed(this.props.collapsed)
}
} |
@oblador What do you think about my solution above? |
Same issue. |
@truph01 I agree with the RCA, initially we don't have a logic to measure the content height and due to that height will remain 0 initially.
As proposed I think either we need to call function @truph01 can you plz raise a PR, @oblador will review it there. |
Thank you so much. |
Here is a diff based on the PR @Pujan92 was kind enough to file. index dc4d3b8..d69d1e7 100644
--- a/node_modules/react-native-collapsible/Collapsible.js
+++ b/node_modules/react-native-collapsible/Collapsible.js
@@ -53,6 +53,12 @@ export default class Collapsible extends Component {
contentHandle = null;
+ componentDidMount() {
+ if (!this.props.collapsed) {
+ this._measureContent((height) => this.state.height.setValue(height));
+ }
+ }
+
_handleRef = (ref) => {
this.contentHandle = ref;
};``` |
In my case, I encountered a crash when rotating the device to landscape mode under specific circumstances. The crash occurred if I opened a modal from the page where the accordion component is used, and the modal supports landscape orientation. To prevent this, I had to add an additional check to the patch. Without this fix, rotating the device while the modal is open causes the app to crash. + componentDidMount() {
+ if (!this.props.collapsed) {
+ this._measureContent((height) => height != null && this.state.height.setValue(height));
+ }
+ }
+ |
Hello there,
a while ago I updated to the new version and it stopped working on react-native 0.74.5, I do not know if it is something expected but at the moment I left forced to the previous version that still works perfectly.
See how in the new version (1.6.2) as soon as the screen loads nothing is displayed and should do as seen on version 1.6.1.
Note: ignoring the warning below is a behavior of my application.
The text was updated successfully, but these errors were encountered: