uptick / react-keyed-file-browser

Folder based file browser given a flat keyed list of objects, powered by React.
MIT License
307 stars 145 forks source link

Offer easy way to disable detailRenderer #42

Open danksch opened 5 years ago

danksch commented 5 years ago

I tried disabling the detailRenderer by setting detailRenderer={null}, which is an unexpected type and doesn't work. In the tutorial, I saw headerRenderer set to nullonce and thought this would work here as well.

How can I disable the item details ?

jarekwg commented 5 years ago

Maybe try passing in a blank renderer (have it return nothing in its render method)?

Also could you describe your use case a little for us (just curious)?

DarioDiem commented 5 years ago

Hi I have the same question, in my case the user doesn't have the need of the item details since the table already contains all that the user needs.

how can I pass the blank renderer? is there any example?

DarioDiem commented 5 years ago

Hi I have the same question, in my case the user doesn't have the need of the item details since the table already contains all that the user needs.

how can I pass the blank renderer? is there any example?

Answering my own question, just created a new Class which had the render() return what I wanted, either nothing or something that the users in my project would need and passed it as:

   <FileBrowser
     ...
     detailRenderer={MyRenderer}
     ...
   /> 

the class is something like this:

class MyRenderer extends React.Component {
  constructor(props) {
    super(props)
  }
  render() {
    return (
      <div>
        <p>something</p>
      </div>
    );
  }
}

export default MyRenderer;
jarekwg commented 5 years ago

Neat. I'll leave this open, as we'd probs like to offer a neater way of doing this in future.

danksch commented 5 years ago

Also could you describe your use case a little for us (just curious)?

I'm trying to implement a file browser with drag and drop functionality, where a user selects files/folders on a drive.

Maybe try passing in a blank renderer (have it return nothing in its render method)?

Yes, that's what I've one for now. Similar to @DarioDiem 's approach, I just passed a (functional) component which returns nothing:

`function EmptyRenderer() { return (

 )

}`

ziaulrehman40 commented 4 years ago

Well, this works:

detailRenderer={() => null}

I think this issue should be closed

jlo-1 commented 3 years ago

Closing due to suitable solutions above