cmdominguez / react-native-custom-bottom-tabs

Libreria para usar un componente RN en la bottom tab de RNN
2 stars 0 forks source link

Custom tab bar item will be covered in Android. But works in iOS. #1

Open zhaiyjgithub opened 3 days ago

zhaiyjgithub commented 3 days ago

Hi,

Thanks for the package.

Today, I try to use it to custom my tab bar. It works in iOS, the tab bar item can be visible over the tabbar container.

Xnip2024-07-02_16-23-09

Xnip2024-07-02_16-25-06

But in the android, not worked. Could you give me some suggestions? Thanks a lot.

cmdominguez commented 3 days ago

@zhaiyjgithub wow didn't try this approach, you could try making a view that contains your tab bar taller and transparent and play with https://wix.github.io/react-native-navigation/api/options-bottomTabs#drawbehind

zhaiyjgithub commented 3 days ago

@cmdominguez Thanks for your response. Could you give me demo code about it.

I tried below but not working, the view(100px) only expand to the bottom: ` import React from 'react'; import {View, Text, TouchableOpacity} from 'react-native'; import {Navigation} from 'react-native-navigation';

const CustomTabs = () => {
  const changeTab = (idxTab: number) => {
    console.log(idxTab);
    Navigation.mergeOptions('tabbar', {
      bottomTabs: {
        currentTabIndex: idxTab,
      },
    });
  };
  return (
    <View
      style={{
        flexDirection: 'row',
        justifyContent: 'space-around',
        alignItems: 'center',
        height: 100,
        backgroundColor: 'transparent',
      }}>
      <TouchableOpacity onPress={() => changeTab(0)}>
        <Text style={{color: 'red', backgroundColor: '#ff00ff'}}>Tab 1</Text>
      </TouchableOpacity>

      <TouchableOpacity onPress={() => changeTab(0)}>
        <View
          style={{
            width: 50,
            height: 50,
            borderRadius: 25,
            backgroundColor: 'blue',
            flexDirection: 'column',
            justifyContent: 'center',
            alignItems: 'center',
            marginTop: -25,
          }}>
          <Text style={{color: 'red', backgroundColor: '#ff00ff'}}>Tab</Text>
        </View>
      </TouchableOpacity>

      <TouchableOpacity onPress={() => changeTab(1)}>
        <Text>Tab 3</Text>
      </TouchableOpacity>
    </View>
  );
};

export default CustomTabs;

`

image

Thanks a lot.

cmdominguez commented 3 days ago

@zhaiyjgithub Thanks to your issue I detected that I was missing something in the documentation (I already updated it). Basically you can add an xml overwriting the default height of RNN, I leave you the link on how to do it https://github.com/cmdominguez/react-native-custom-bottom-tabs#personalizaci%C3%B3n-de-la-altura-de-la-tab-bar

zhaiyjgithub commented 1 day ago

Thanks for your improvement. I will try it later. @cmdominguez