1- ![ ] ( https://github.com/andreppedroza/react-native-themed-stylesheet/workflows/Release%20CI/badge.svg )
21[ ![ codecov] ( https://codecov.io/gh/andreppedroza/react-native-themed-stylesheet/branch/main/graph/badge.svg )] ( https://codecov.io/gh/andreppedroza/react-native-themed-stylesheet )
2+ ![ ] ( https://github.com/andreppedroza/react-native-themed-stylesheet/workflows/Release%20CI/badge.svg )
33
44# react-native-themed-stylesheet
55
66A package that allows you to create React Native StyleSheets with support for Dark/Light/Auto Themes.
77
8- - Depends on react-native-appearance to choose the theme based on OS preference (Android 10/iOS 13)
8+ - Depends on react-native-appearance to choose the theme based on OS preference(Android 10/iOS 13)
99- Simple API
1010- Fully typed
1111- Builds on top of StyleSheets and Hooks
@@ -32,10 +32,10 @@ npm install --save react-native-appearance react-native-themed-stylesheet
3232
3333## Usage
3434
35- Defining Themes :
35+ Creating the theme :
3636
3737``` ts
38- // themes .ts
38+ // theme .ts
3939
4040import { createTheme } from ' react-native-themed-stylesheet'
4141
@@ -56,16 +56,15 @@ const { ThemeProvider, useStyle, useTheme } = createTheme(themes, 'auto') // Ini
5656export { ThemeProvider , useStyle , useTheme }
5757```
5858
59- Using themes :
59+ Using the theme :
6060
6161``` tsx
6262// Components.tsx
6363import React from ' react'
6464import { View , Text , Button } from ' react-native'
65- import { ThemeProvider , useStyle , useTheme } from ' ./themes'
66- import { styleSheetFactory } from ' ./themes'
65+ import { ThemeProvider , useStyle , useTheme } from ' ./theme'
6766
68- const ComponentWithUseStyle = () => {
67+ const ComponentWithUseStyle: React . FC = () => {
6968 const styles = useStyle (theme => {
7069 text : {
7170 color : theme .textColor ,
@@ -80,7 +79,7 @@ const ComponentWithUseStyle = () => {
8079 )
8180}
8281
83- const ComponentWithUseTheme = () => {
82+ const ComponentWithUseTheme: React . FC = () => {
8483 const { theme, mode, setThemes, setMode } = useTheme ()
8584 console .log (' Current Mode:' , mode )
8685
@@ -134,9 +133,9 @@ ThemeObject
134133
135134An object containing the following properties:
136135
137- - ThemeProvider: Theme Provider
138- - useStyle: Hook to create Named StyleSheets
139- - useTheme: Hook to get access to ThemeContext
136+ - ` ThemeProvider ` : Theme Provider.
137+ - ` useStyle ` : Hook to create Named StyleSheets.
138+ - ` useTheme ` : Hook to get access to ThemeContext.
140139
141140---
142141
@@ -148,11 +147,11 @@ A react component to provide ThemeContext.
148147
149148### Function: ` useStyle(createStyle) `
150149
151- Use this function to create themed stylesheets.
150+ Hook to create themed stylesheets.
152151
153152** Parameters**
154153
155- - ` createStyle ` : A function that receive the current theme and return an object of type ` T ` .
154+ - ` createStyle ` : A function that receives the current theme and returns an object of type ` T ` .
156155
157156** Returns**
158157
@@ -166,7 +165,7 @@ StyleSheet.NamedStyles<T>
166165
167166### Function: ` useTheme() `
168167
169- Use this function to get theme context.
168+ Hook to get access to theme context.
170169
171170** Returns**
172171
@@ -178,7 +177,7 @@ Use this function to get theme context.
178177
179178An object containing the following properties:
180179
181- - ` theme ` : The current theme
180+ - ` theme ` : The current theme.
182181- ` mode ` : The current mode.
183- - ` setThemes ` : Function to set the themes(The same type of createTheme themes param).
182+ - ` setThemes ` : Function to set the themes(The same type of ` createTheme ` ` themes ` param).
184183- ` setMode ` : Function to set the mode('light', 'dark' or 'auto').
0 commit comments