nuclearpasta / react-native-drax

A drag-and-drop system for React Native
MIT License
554 stars 69 forks source link

support styles on both `DraxList` and its `FlatList` #40

Closed chrisdrackett closed 3 years ago

chrisdrackett commented 4 years ago

to have full control over the styles of this component I think it is currently needed to be able to pass styles both to the FlatList and to the DraxList. For example if I want to add padding to inside the FlatList or have effectively flex: 1 it is needed to add styles to both elements.

lafiosca commented 4 years ago

@chrisdrackett I will take a look at your PR this evening. In the meantime, if at all possible, could you share a code/screenshot example of a styling you're not able to accomplish without this?

chrisdrackett commented 4 years ago

For example I want my flatlist to have flex: 1. For this to work it needs to be both on the wrapper and the FlatList.

I also like to add padding on the top and bottom of the scrolling content of a FlatList and this is only possible if I have access to its styles

lafiosca commented 4 years ago

Thanks for clarifying. I want to mess around with this some to refresh my memory before I review the PR. I'll try to tackle it this weekend.

lafiosca commented 4 years ago

I've been working on the older issues/PRs first and haven't gotten to this one yet, but I have not forgotten about it. I still want to experiment a bit and understand the problem space more deeply. For example, if we add a prop to pass through to the FlatList's style, we might also want one to pass through to its contentContainerStyle.

chrisdrackett commented 4 years ago

agreed, I think the more that can be accessed on the native FlatList the better

lafiosca commented 3 years ago

Now that I have revisited this, I realized my previous comment above is a bit foolish because we can already pass contentContainerStyle through. DraxList accepts all the props of a FlatList and passes through the ones that it doesn't modify or generate.

lafiosca commented 3 years ago

It would be ideal to me if there were some way to make the wrapping view almost "invisible" for the sake of styling and layouts, only relying on the FlatList's style and passing the prop directly to it. Unfortunately I don't think this is easily achievable. My current preference is to have a new DraxList prop named something like listStyle and pass it to the underlying FlatList as its style prop.

lafiosca commented 3 years ago

Merged in #91, new DraxList prop is flatListStyle, and it will be in the 0.8.0 release tonight or tomorrow.