callstack / react-native-paper

Material Design for React Native (Android & iOS)
https://reactnativepaper.com
MIT License
12.49k stars 2.05k forks source link

Pagination drop-down not working #4359

Open parneetkaur7729 opened 3 months ago

parneetkaur7729 commented 3 months ago

Current behaviour

Added the template of the Datatable.pagination in which i added numberOfItemsPerPageList={numberOfItemsPerPageList} but when clicked on it its toogle state never get true and cant see the drop-down.

Expected behaviour

when clicked on the rows per page drop-down must open and accordingly items filteration could be done.

How to reproduce?

check the file datatablepagination-> search menu and check why it is not showing up.

Preview

https://github.com/callstack/react-native-paper/assets/109802307/200d5aec-e3e6-4a4f-8cf0-0535af36e7a9

What have you tried so far?

checked the values in the paper library and also tried to give data directly but nothing helped.

Your Environment

software version
ios 14
android 33
react-native 0.72.5
react-native-paper 5.12.3
node 16
npm or yarn 1.1.2
expo sdk x.x.x
gedu commented 3 months ago

Hey, can you show some code or snack? I'm assuming that the list you pass to numberOfItemsPerPageList has values, because if it is an empty list, the Menu won't show up

parneetkaur7729 commented 2 months ago
 constructor(props) {
    super(props);
    this.state = {
        rows: [],
        column: [],
        max: 0,
        items: [],
        page: 0,
        setData: {},
        numberOfItemsPerPageList: [5, 25, 100],
        itemsPerPage: 5,
        selectedIndex: null, // Initialize selectedIndex
    };
}

const { page, itemsPerPage, numberOfItemsPerPageList, items } = this.state; <DataTable.Pagination page={page} numberOfPages={Math.ceil(this.state.max / itemsPerPage)} onPageChange={page => this.setState({ page })} label={${from + 1}-${to} of ${this.state.max}} numberOfItemsPerPageList={numberOfItemsPerPageList} numberOfItemsPerPage={itemsPerPage} onItemsPerPageChange={this.onItemsPerPageChange} selectPageDropdownLabel={'Rows per page'} /> No, numberOfItemsPerPageList is not empty it have value 5,25,100

gedu commented 2 months ago

I couldn't reproduce it, if you can create a snack where I can see the code and try to reproduce it would be really helpful

parneetkaur7729 commented 2 months ago

here this is the snack of the code kindly take the reference for menu of numberoflistitems to resolve the issue of drop-down.

gedu commented 2 months ago

Hey, the snack you sent isn't using the last version, can you try with the last react-native-paper version 5.12.2

parneetkaur7729 commented 2 months ago

Hi, Checked with the latest version Here , still the issue is their dopdown is not coming for Android