React-native-swipe-list-view: hiddenRow height wrong

Created on 1 Jun 2017  路  10Comments  路  Source: jemise111/react-native-swipe-list-view

hi:
SwipeRow.js
render() {
return (
styles.hidden,
{
//height: this.state.hiddenHeight,
//width: this.state.hiddenWidth,
}
]}>
{this.props.children[0]}

{this.renderRowContent()}

);
}

7 8 lines, i think is wrong, when i delete row ,the height is change but the value is not true,
in my code , i just set the hidden row style = 1 and fix this code ,
it can make the height right, i hope you can check it

All 10 comments

@OstrichRunning not sure what your issue is here. If you wouldn't mind pasting a more complete example I'd be happy to take a look.

Also people with height issues after deleting a row often have success by setting the recalculateHiddenLayout prop to false.

Maybe give that a shot as well

(sorry for the delay in responding!)

render() {
        return (
            <View style={this.props.style ? this.props.style : styles.container}>
                <View style={[
                    styles.hidden,
                    {
                        //height: this.state.hiddenHeight,
                        //width: this.state.hiddenWidth,
                    }
                ]}>
                    {this.props.children[0]}
                </View>
                {this.renderRowContent()}
            </View>
        );
    }

In my code, my rows height is differ, sometimes my hidden row height show error, can not equal row height, so when i comments this tow line out and set the hidden row flex = 1. the hidden row height is ok. so i think this tow line is wrong
(sorry for the delay in responding too!)

Hey @OstrichRunning, so I'm not sure what problem you're facing specifically, but basically the way the component usually works is the hidden row's height and width are initially set to 0, and then it uses the height and width of the visible row component to set the height and width of the hidden row (see here: https://github.com/jemise111/react-native-swipe-list-view/blob/master/components/SwipeRow.js#L73).

So I can't get rid of those lines otherwise the hidden row wouldn't have the correct height/width in most cases.

My guess is maybe you are hard coding the heights of your hidden rows, and that is being overridden by the component.

Could you paste more code? I'd love to see how you are calling renderRow, renderHiddenRow, and the StyleSheet for those components. Thanks!

hey @jemise111, I have a bug, when i render different height rows, render row without set height(auto with text image component height), i do not know row height so i can not set hidden row. when the row component render i use onLayout callback method get row height, then set hidden row height, sometimes the hidden row height no equal row height.
i change your code, and set hidden row style flex = 1, in my app, i find this hidden row show right.
show like :
9fa4eed6-f8b3-4921-a711-4ddf89e58f70

Hey @OstrichRunning sorry for the delay. When you say

and set hidden row style flex = 1, in my app

Are you referring to the styles set here?

https://github.com/jemise111/react-native-swipe-list-view/blob/fc25078c703864f4f8b08f786f2012d8cfe1d42f/components/SwipeRow.js#L317

If so I can add a prop to you to set styles of the hidden row and maybe it's a win win for everyone :)

I think setting only flex without setting width&height, hidden row will show right.
if set height&width and set flex, set flex not work.
in my code, i set flex is not work, because in your code, you set height&width.
i hope you can make a test, set flex without height&width. if this ok, we will not care hidden row

Okay @OstrichRunning I just pushed a branch called dont-set-hidden-height-width. Could you give this a try by setting your package.json to point to it in your project. Like this:

dependencies: {
    "react-native-swipe-list-view": "git://github.com/jemise111/react-native-swipe-list-view.git#dont-set-hidden-height-width"
}

Then you should be able to set the flex yourself and hopefully that fixes your issue. If that works I'll get it merged in and push it out in a new release. Let me know, thanks!

Hi: @jemise111,
I use your demo(SwipeListExample) test, set different height, the bug did not reappear. so i think you do not need <#dont-set-hidden-height-width>, but in my old code( "react": "^16.0.0-alpha.12",
"react-native": "0.36.1") ,when i set hiddenRow flex = 1, sometimes hiddenRow height show error.

However, I think there is no need to take the initiative to set the width and height (SwipRow.js onContentLayout), this view layout by this.props.children[1]. if onContentLayout error, the hiddenRow height&width will show error.

final, thank you follow this issue very mach and i feel so sorry

Hey @OstrichRunning thanks for giving it a shot!

I'm gonna think about it and maybe implement a change in the future but seeing as you're not affected by this issue anymore and I don't have anyone else experiencing this I'm going to leave it alone for now and close this issue.

Good luck in your new job :)

I have this issue too, the hidden height won't rerender when an item is removed on the list

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mohitmishra22 picture mohitmishra22  路  6Comments

m-ruhl picture m-ruhl  路  6Comments

ramisalem picture ramisalem  路  5Comments

baicuhaha picture baicuhaha  路  6Comments

kopax picture kopax  路  4Comments