akveo / kittenTricks

React Native starter kit with over 40 screens and modern Light and Dark theme for creating stunning cross-platform mobile applications.

Home Page:https://akveo.github.io/react-native-ui-kitten/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get UI Theme variables via hooks (instead of withStyles())

dandevs opened this issue · comments

Issue type

I'm submitting a ... (check one with "x")

  • bug report
  • feature request

Issue description

Request in title, I believe it'd be much simpler to use a hook over the current withStyles() method

Related code:

const Component = () => {
  const theme = useKittenTheme();
  const primary = theme["color-success-200"];

  // Or something like
  const styles = useKittenTheme(theme => ({
    layout: {
      backgroundColor: theme["color-success-200"]
    }
  });

  <Layout style={styles.layout}/>;
  return <Layout style={{backgroundColor: primary}>...</Layout>;
}

Other information:

**OS, device, application version **

UI Kitten 4.3.1

Sorry, wrong repo 🔢 👎 🥇