Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ScrollViewProps or ScrollViewStyle to Tab component props #3908

Open
vanenshi opened this issue May 22, 2024 · 0 comments
Open

Add ScrollViewProps or ScrollViewStyle to Tab component props #3908

vanenshi opened this issue May 22, 2024 · 0 comments

Comments

@vanenshi
Copy link

vanenshi commented May 22, 2024

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 vanenshi changed the title Add ScrollViewProps and ScrollViewStyle to Tab component props Add ScrollViewProps or ScrollViewStyle to Tab component props May 22, 2024
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

No branches or pull requests

1 participant