Ability to disable individual control items. #50
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey Kyle,
See below for the issue we were talking about last week.
Sorry for the delayed response, I've been completely swamped with worth this past week (still am!).
I agree that the logic to render a control or not should ideally be outside of the render function. I have just run some tests with the shorthand method you gave as an example, turns out that returning null does effect the flex-box layout, unlike the first approach.
See my test code in the branch '2configurableControls' inside my fork, please forgive the branch names ha ha!!
I've taken both of our approaches in a third branch inside my fork, called... you guessed it '3configurableControls', in this branch I perform the conditional logic for the controls outside of the JSX, storing the result of each conditional in a local variable, which the return statement's JSX references.
See an example snippet below for what i've done in this latest branch
This keeps the separation of concerns between the render top/bottom methods and the render *individual control methods, it also does not break the view layout as there is still technically a control in each ones place, just an empty one if a control has been disabled.
Hope that makes sense. Sorry again about the delay in response. Fire away any questions, happy to discuss further if needed.
Lastly, I like the approach you're talking about at the top of your response. I'd be happy to pitch in on making that happen in the future.