iRoachie / react-native-material-tabs

Material Design implementation of Tabs
MIT License
121 stars 56 forks source link

Feature icon with label #46

Closed araujobarret closed 5 years ago

araujobarret commented 5 years ago

Hi,

this PR closes #34

Two tests are failing now due the the changes in Tab.js, now there is a minor block stateless component TabItem, I was thinking about the logic to show the vertical/horizontal(label+element) and thought that splitting this if/else/styling questions into a minor stateless component was more easy to understand.

NOTE: PLEASE, DO NOT MERGE YET, STILL WIP

image

Now we can pass two props when passing an Element, text and vertical, as the name says if we pass the text will show by default the Element + text horizontally, and if we pass vertical(value true) the Element + text will be shown vertically, in this order as the image above shows up.

how to use:

import Ionicons from 'react-native-vector-icons/Ionicons';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';

....
<MaterialTabs
  items={[
    'One',
    <Ionicons key='md-globe' name='md-globe' />,
    <Ionicons key='md-globe' name='md-globe' text='map' vertical/>,
    <Ionicons key='md-call' name='md-call' text='call' />,
  ]}
  barColor="#1fbcd2"
  indicatorColor="#fffe94"
  activeTextColor="white"
/>

I would like to change the two failing tests to match the new changes, I think this won't be a breaking change to the lib, just the shallow navigation inside of the component is messy right now. So, may I change those 2 failing tests and add 2-3 more tests for the new features?

iRoachie commented 5 years ago

Hey @araujobarret I recently updated the lib in 4.0.0 as a typescript rewrite and 4.1.0 that cleans up the logic and supports rtl. You would have tor resubmit this PR.