gxsshallot / react-native-pure-navigation-bar

A fully customizable navigation bar in React Native.
MIT License
96 stars 19 forks source link

safeOptions bug #22

Open santomegonzalo opened 5 years ago

santomegonzalo commented 5 years ago

If I set the property safeOptions={forceInset(0, 0, 0, 0)} then the following function will break the code

const func = (pos) => safeOptions[pos] === 'always' ? safeArea[pos] : undefined;

because if we use 0,0,0,0 will never return always and in the next step you have

height: func('top') + this.props.navbarHeight,

and that will return NaN because func('top') will return undefined.

I fixed it applying a local patch replacing it with:

const func = (pos) => safeOptions[pos] === 'always' ? safeArea[pos] : 0;

Let me know if you want me to create a PR.

Best