React-native-tab-view: Shadow iOS

Created on 10 Oct 2016  路  13Comments  路  Source: satya164/react-native-tab-view

Works great! Removed the other scroll tab component and replaced it with this one..

The only thing that bothers me a bit is that there's no shadow on iOS, only Android. Any way to fix this?

Most helpful comment

@WillyRamirez this is only for iOS. On Android you need to pass elevation: 0

All 13 comments

@GCour Thank you. You can pass a style prop to the tab bar with box shadow

@satya164 I have added following style but the shadow is not showing:

shadowColor: '#000',
    shadowOpacity: 0.3,
    shadowRadius: 2,
    shadowOffset: {
      height: 2
    }

@GCour thanks. I'll have a look at it in an hour.

@GCour Hey, just tried this. Shadow works fine when you set a zIndex to move the tab up :)

    shadowColor: '#000',
    shadowOpacity: 0.3,
    shadowRadius: 2,
    shadowOffset: {
      height: 2,
    },
    zIndex: 1,

In next release there'll be a hairline shadow (like the navbar) below the tab bar by default. https://github.com/react-native-community/react-native-tab-view/commit/6c767ced7636302303922ee7332d0b5d841fe136

image

@satya164 how do I remove this default hairline shadow? Passing a style object with shadowOpacity: 0, to the tabBar does not seem to work..

@WillyRamirez passing style should work on iOS. do you have code/repro?

@satya164 I use android? Does that matter?

 _renderHeader = (props) => {
    props = {...props, social: this.props.profile.social };
    return <TabBar style={{shadowOpacity: 0}}
                   indicatorStyle={{borderWidth: 0, height: 0}}
                   renderIndicator={this._renderIndicator}
                   renderLabel={this._renderLabel(props, this.props.profile.social)} {...props} />;
  };

@WillyRamirez this is only for iOS. On Android you need to pass elevation: 0

I'm getting this behavior even with an high zIndex value

screen shot 2017-05-11 at 17 03 38

I exaggerated on the shadow height and opacity so you can see better what I'm referring to.

Any thoughts?

Having the same issue as @tomasfrancisco
The only way I managed to get around it was to set content background to transparent, which works in some cases but when you have a list view with items with background different from main bg this gets problematic.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

itzsaga picture itzsaga  路  3Comments

karthikeyansundaram2 picture karthikeyansundaram2  路  3Comments

ahmedrowaihi picture ahmedrowaihi  路  3Comments

ios-dev-newbie picture ios-dev-newbie  路  3Comments

t3chnoboy picture t3chnoboy  路  3Comments