/* eslint-enable import/no-unresolved, import/extensions */
import { black } from './colors';
import { ELEVATION_ZINDEX } from './constants';

const getPlatformElevation = (elevation) => {
    if (elevation !== 0) {
        return {
            shadowColor: black,
            shadowOpacity: 0.3,
            shadowRadius: elevation,
            shadowOffset: {
                height: 2,
                width: 0,
            },
            // we need to have zIndex on iOS, otherwise the shadow is under components that
            // are rendered later
            zIndex: ELEVATION_ZINDEX,
        };
    }
    return { };
};

export default getPlatformElevation;

/* eslint-enable import/no-unresolved, import/extensions */
import { black, transparent } from './colors';
import { ELEVATION_ZINDEX } from './constants';

const getPlatformElevation = (elevation) => {
    return {
        shadowColor: elevation > 0 ? black : transparent,
        shadowOpacity: 0.3,
        shadowRadius: elevation / 2,
        shadowOffset: {
            height: 1,
            width: 0,
        },
        // we need to have zIndex on iOS, otherwise the shadow is under components that
        // are rendered later
        zIndex: ELEVATION_ZINDEX,
    };
};

export default getPlatformElevation;

Fix shadow props on iOS (#225)