Skip to content

Commit ce6c598

Browse files
committed
Update README.md and Remove Unnecessary Configs
1 parent 559ddab commit ce6c598

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

.github/workflows/push.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
push:
44
branches: [main]
55
jobs:
6-
build:
6+
coverage:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v1
@@ -15,4 +15,3 @@ jobs:
1515
- uses: codecov/codecov-action@v1
1616
with:
1717
fail_ci_if_error: true
18-
verbose: true

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ name: Release CI
22
on:
33
release:
44
jobs:
5-
build:
5+
publish:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v1
99
- uses: actions/setup-node@v1
1010
with:
1111
node-version: 15.4.0
12-
- run: npm install
12+
- run: npm install --ignore-scripts
13+
- run: npm test
14+
- run: npm build
1315
- uses: JS-DevTools/npm-publish@v1
1416
with:
1517
token: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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

66
A 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

4040
import { createTheme } from 'react-native-themed-stylesheet'
4141

@@ -56,16 +56,15 @@ const { ThemeProvider, useStyle, useTheme } = createTheme(themes, 'auto') // Ini
5656
export { ThemeProvider, useStyle, useTheme }
5757
```
5858

59-
Using themes:
59+
Using the theme:
6060

6161
```tsx
6262
// Components.tsx
6363
import React from 'react'
6464
import { 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

135134
An 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

179178
An 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').

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type UseStyle<T, C> = <S extends ThemeObject>(
3131
) => StyleSheet.NamedStyles<S>
3232
type CreateTheme = <T, C>(
3333
themes: Themes<T, C | undefined>,
34-
mode?: ThemeMode
34+
initialMode?: ThemeMode
3535
) => {
3636
ThemeProvider: React.FC
3737
useTheme: UseTheme<T, C | undefined>

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
"types": "index.d.ts",
1313
"files": ["index.js", "index.d.ts"],
1414
"scripts": {
15-
"prepublish": "npm run build",
1615
"build": "tsc",
1716
"test": "jest",
18-
"test:types": "tsc --project . --noEmit",
1917
"test:coverage": "npm test -- --coverage=true --collectCoverage"
2018
},
2119
"keywords": ["react native", "theme", "theming", "stylesheet"],

0 commit comments

Comments
 (0)