@callstack/react-theme-provider
Advanced tools
Comparing version 3.0.5 to 3.0.6
{ | ||
"name": "@callstack/react-theme-provider", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "Theme provider for react and react-naitve applications", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -73,15 +73,5 @@ <p align="center"> | ||
You can also use the [hooks](https://reactjs.org/docs/hooks-intro.html) based API: | ||
Another usage for functional component: | ||
```js | ||
function App() { | ||
const theme = useTheme(); | ||
return <div style={{ color: theme.primaryColor }}>Hello</div>; | ||
} | ||
``` | ||
### Usage | ||
```js | ||
const App = ({ theme }) => ( | ||
@@ -96,2 +86,12 @@ <div style={{ color: theme.primaryColor }}> | ||
You can also use the [hooks](https://reactjs.org/docs/hooks-intro.html) based API: | ||
```js | ||
function App() { | ||
const theme = useTheme(); | ||
return <div style={{ color: theme.primaryColor }}>Hello</div>; | ||
} | ||
``` | ||
### Injected props | ||
@@ -199,15 +199,2 @@ | ||
## Applying a custom theme to a component | ||
If you want to change the theme for a certain component, you can directly pass the theme prop to the component. The theme passed as the prop is merged with the theme from the Provider. | ||
```js | ||
import * as React from 'react'; | ||
import MyButton from './MyButton'; | ||
export default function ButtonExample() { | ||
return <MyButton theme={{ roundness: 3 }}>Press me</MyButton>; | ||
} | ||
``` | ||
#### `useTheme` | ||
@@ -214,0 +201,0 @@ |
@@ -7,3 +7,3 @@ // Type definitions for @callstack/react-theme-provider 1.0.2 | ||
type $Without<T, K> = Pick<T, Exclude<keyof T, K>>; | ||
type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never; | ||
type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> }; | ||
@@ -10,0 +10,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32729
246