Skip to content
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

change height while running #578

Open
rashawa opened this issue Oct 21, 2021 · 6 comments
Open

change height while running #578

rashawa opened this issue Oct 21, 2021 · 6 comments

Comments

@rashawa
Copy link

rashawa commented Oct 21, 2021

hello I'm having an issue
my logic is
I have a swipe item list which contains a toggler too when I click on the toggle it shows another component in a vertical
way so this affects the height of the item and on this case the new hight of the visible row isn't reflected on the hidden one
is there a way to set a hight dependency to it ?
Simulator Screen Shot - iPhone 11 - 2021-10-21 at 11 48 10

@jemise111
Copy link
Owner

@rashawa did you try the prop recalculateHiddenLayout={true}?

@Pashkagreen
Copy link

have the same problem, did you solve it?

@KaneDenzil
Copy link

KaneDenzil commented Jun 7, 2022

I also have the same problem, my renderHiddenItem are not matching the renderItem height. even while adding recalculateHiddenLayout={true}

  <SwipeListView
        testID="notesComponent.notesListView"
        keyExtractor={item => item._id}
        data={publishedNotes}
        renderItem={renderNotesListRow}
        renderHiddenItem={renderEditListRow}
        leftOpenValue={100}
        rightOpenValue={0}
        stopLeftSwipe={100}
        recalculateHiddenLayout={true}
      />
      
const renderNotesListRow = (noteItem: ListRenderItemInfo<INoteInternalContent>) => (
    <NotesListRow
      generalNote={noteItem.item.data.note}
      expirationWindowDuration={getExpirationWindowDuration(
        noteItem.item.data.fromDate,
        noteItem.item.data.toDate
      )}
      expirationWindowInDays={noteItem.item.data.scheduleWindow}
      lastUpdatedDate={calculateLastUpdatedDate(noteItem.item.audits?.edit?.date)}
      lastUpdatedName={`${noteItem.item.audits?.edit?.firstName} ${noteItem.item.audits?.edit?.lastName}`}
    />
  );

  const renderEditListRow = (noteItem: ListRenderItemInfo<INoteInternalContent>) => (
    <TouchableOpacity onPress={() => editNote(noteItem)}>
      <EditButtonContainer>
        <EditImage source={{ uri: 'editIcon' }} />
        <EditText>Edit</EditText>
      </EditButtonContainer>
    </TouchableOpacity>
  );`
`import { responsiveHeight, responsiveWidth } from 'react-native-responsive-dimensions';
import styled from 'styled-components/native';

export const NotesContainer = styled.View`
  display: flex;
  padding-horizontal: ${responsiveWidth(1)}px;
  height: 100%;
`;

export const EditButtonContainer = styled.View`
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  margin-top: ${responsiveHeight(0.5)}px;
  padding-vertical: ${responsiveHeight(2.8)}px;
  padding-left: ${responsiveWidth(1.5)}px;
  background-color: rgba(20, 30, 146, 1);
`;
export const EditImage = styled.Image`
  height: 13.33px;
  width: 13.33px;
  margin-right: ${responsiveWidth(1)}px;
`;
export const EditText = styled.Text`
  font-size: 16px;
  font-weight: 400;
  color: white;
`;
`

image

@Pashkagreen
Copy link

I also have the same problem, my renderHiddenItem are not matching the renderItem height. even while adding recalculateHiddenLayout={true}

+++

@mmaass
Copy link

mmaass commented Jul 27, 2022

recalculateHiddenLayout fixed my problem. As for you who have still problems, check if you have the flexGrow: 1 or absolute positioning with top/bottom: 0 styles set to your hiddenItem View

@Pashkagreen
Copy link

recalculateHiddenLayout fixed my problem. As for you who have still problems, check if you have the flexGrow: 1 or absolute positioning with top/bottom: 0 styles set to your hiddenItem View

vielen Dank! Alles funktioniert wie es soll)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants