react-native-elements icon indicating copy to clipboard operation
react-native-elements copied to clipboard

Add `ScrollViewProps` or `ScrollViewStyle` to Tab component props

Open vanenshi opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please Describe.

Add ScrollViewProps or ScrollViewStyle to Tab component props. specially style is really important, I wanted to add contentContainerStyle for the scrollView but it was not possible

Describe the solution you'd like

import React from "react";
import { Tab, Text, TabView } from "@rneui/themed";

export default () => {
  const [index, setIndex] = React.useState(0);

  return (
    <>
      <Tab
        value={index}
        onChange={(e) => setIndex(e)}
        scrollViewProps={{ // << Here our new props
          contentContainerStyle: {
            paddingHorizontal: 12,
          },
        }}
        indicatorStyle={{
          backgroundColor: "white",
          height: 3,
        }}
        variant="primary"
      >
        <Tab.Item
          title="Recent"
          titleStyle={{ fontSize: 12 }}
          icon={{ name: "timer", type: "ionicon", color: "white" }}
        />
        <Tab.Item
          title="favorite"
          titleStyle={{ fontSize: 12 }}
          icon={{ name: "heart", type: "ionicon", color: "white" }}
        />
        <Tab.Item
          title="cart"
          titleStyle={{ fontSize: 12 }}
          icon={{ name: "cart", type: "ionicon", color: "white" }}
        />
      </Tab>

      <TabView value={index} onChange={setIndex} animationType="spring">
        <TabView.Item style={{ backgroundColor: "red", width: "100%" }}>
          <Text h1>Recent</Text>
        </TabView.Item>
        <TabView.Item style={{ backgroundColor: "blue", width: "100%" }}>
          <Text h1>Favorite</Text>
        </TabView.Item>
        <TabView.Item style={{ backgroundColor: "green", width: "100%" }}>
          <Text h1>Cart</Text>
        </TabView.Item>
      </TabView>
    </>
  );
};

vanenshi avatar May 22 '24 20:05 vanenshi