Skip to content

Conversation

@Timson020
Copy link

  1. add the activeOpacity props in tabView.js

  2. remove the icon require Image tinifyColor

  3. add the resizeMode in icon require Image props options

  4. 在tabview.js 里面添加 TouchableOpacity的Props,否则没用。。。

  5. icon 和 activeIcon 如果使用图片的话,不能使用库里面的主题颜色啊。。。

  6. icon 和 activeIcon 如果使用图片的话,要设置resizeMode="contain",否则图片回显示不全,可能是我的icon 图片比较大一点

remove the icon require Image tinifyColor
add the resizeMode in icon require Image props options
@rilyu
Copy link
Owner

rilyu commented Mar 10, 2018

TabButton 里的按钮图标的 tintColor 设置符合大多数App的习惯,可以通过 Theme.set({tvBarBtnIconTintColor: undefined}) 取消这个效果,直接删除会影响之前所有使用者,不可取;图标的 resizeMode 模式也属于个性化需求,如需要更多的自定义属性可在 icon 、 activeIcon 直接传入 element ;activeOpacity 是按钮的属性,放在 TabView 在属性名称上会引起误会,可把 TabView.Button 换成你自己的类也能达到目的,而不需要修改组件库的代码。

@Timson020
Copy link
Author

  1. Theme.set({tvBarBtnIconTintColor: undefined})
    这个好像没有作用。重启了 react-native的服务也是一样

  2. 我说的是 tabView.js 里面 的 renderBar函数
    let {type, title, icon, activeIcon, iconContainerStyle, badge, onPress} = item.props;
    缺少了 activeOpacity 这个属性
    我的界面源码是

const props = { iconContainerStyle: { justifyContent: 'flex-end' }, activeOpacity: 0.9 }
		return (
			<TabView style={styles.container} barStyle={styles.tabBarStyle} activeIndex={selected}>
				<TabView.Sheet
					{...props}
					title={<TabTitle title="概况"} />}
					icon={HomeIcon}
					activeIcon={HomeActiveIcon}>
					<OtherPage />
				</TabView.Sheet>

修改后的tabView.js 源码

<this.constructor.Button
                key={index}
                style={buttonStyle}
                title={title}
                icon={icon}
                activeIcon={activeIcon}
                activeOpacity={activeOpacity} // 新增这里
  1. 如果都使用TabView.Button的话 例如我这里有5个button 中间的那个是突出来的 ,会造成其他的4个button 都会有突出来的部分,用户体验就会有点影响,所以目前使用的就是 4个Sheet 1个Button

@rilyu rilyu closed this Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants