class TabIcon extends React.Component {
render(){
return (
<Icon style={{color: this.props.focused ? '#8B327C' :'#3F8B99'}} name={this.props.name}></Icon>
);
}
}
在每个场景中放置图标{TabIcon}和name=“cart”
对我来说是这样的:
import { Icon} from 'native-base';
class TabIcon extends React.Component {
render(){
return (
<Icon style={{color: this.props.focused ? '#8B327C' :'#3F8B99'}} name={this.props.name}></Icon>
);
}
}
export default class App extends React.Component {
render() {
const RouterWithRedux = connect()(Router);
return (
<Provider store={store}>
<RouterWithRedux>
....
{/* tabbar */}
<Scene
type={ActionConst.REPLACE}
tabs
animationEnabled={true}
key="tabbar"
activeTintColor='#8d6669'
headerMode="none"
tabBarPosition='bottom'
tabBarStyle={{height:60}}
labelStyle={{fontSize:10, fontFamily:"IRANSansMobile"}}
>
<Scene
key="user"
component={user}
activeTintColor={"#8d6669"}
icon={TabIcon} name="person"
tabBarLabel={"پرÙÙØ§Û٠کاربرÛ"}
>
<Scene key="login" component={login}/>
<Scene key="profile" component={profile}/>
</Scene>
<Scene
key="fav"
component={fav}
icon={TabIcon}
name="cart"
tabBarLabel={"بازارÚÙ"}
/>
<Scene
key="events"
component={events}
icon={TabIcon}
name="list-box"
tabBarLabel={"رÙÛØ¯Ø§Ø¯ ÙØ§"}
/>
<Scene
key="location"
component={location}
icon={TabIcon}
name="map"
tabBarLabel={"ÙÙØ´Ù"}
/>
<Scene
key="home"
component={home}
icon={TabIcon}
name="home"
tabBarLabel={"ØµÙØÙ Ø§ØµÙÛ"}
>
</Scene>
....
</RouterWithRedux>
</Provider>
)
}