Here is the problem I am facing:
I have a component in react native called Header. Header has 3 properties - left suffix (for back button for example), right suffix (for additional actions, sometimes 1 button, sometimes 2 buttons, sometimes none) and title.
Layout rules are as follows:
- Title should always be centered in a header no matter if Right or Left suffixes are present. If Right suffix is present but Left suffix is not, title should still be centered in the middle of the header.
- Right and Left suffixes should always be visible if they are declared. Meaning if I have Right Suffix + Left Suffix + a very long title, title should shrink to make space for suffixes.
I have made snack to demonstrate my problem: https://snack.expo.io/@anjayka/header-challenge
As you can see most of the layout works fine - If I add right suffix, title stays in position, if I remove left suffix - its still in position. The problem comes after title is a very long text - it expands so much that it pushes out suffixes entirely.
Any help solving this puzzle is appreciated