You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **NOTE**: if you add `useTheme()` in the navigation screen (parent component), then you can avoid using it in child components\*
106
-
107
85
<br />
108
86
109
-
STEP 4: **anotherComponent.tsx**
110
-
111
-
To change the theme you can call build method and it will swap the theme
112
-
113
-
```javascript
114
-
importReactfrom"react";
115
-
import { View, Button } from"react-native";
116
-
import { StyleSheet, light, dark } from"./style";
117
-
118
-
constComponent= () => {
119
-
constonLight= () =>StyleSheet.build(light);
120
-
constonDark= () =>StyleSheet.build(dark);
121
-
122
-
return (
123
-
<View>
124
-
<Button onPress={onLight} title="light theme"/>
125
-
<Button onPress={onDark} title="dark theme"/>
126
-
</View>
127
-
);
128
-
};
129
-
```
130
-
131
-
### Demo
87
+
## Demo
132
88
133
89
Scan and run with expo go app, run the [example project](https://github.com/mohit23x/react-native-sugar-style/tree/main/example) for a more detailed example.
134
90
https://expo.io/@mohit23x/projects/react-native-sugar-style or try the [react native web version](https://sugar-style.netlify.app/)
[There](https://github.com/vitalets/react-native-extended-stylesheet)[are](https://github.com/wvteijlingen/react-native-themed-styles)[many](https://github.com/wvteijlingen/react-native-themed-styles)[awesome](https://github.com/Shopify/restyle)[solutions](https://github.com/callstack/react-theme-provider)[for](https://www.npmjs.com/package/simple-theme)[styling](https://github.com/nandorojo/dripsy) in React Native. Through this package i wanted to explore and experiment a way to achieve a development experience which is very similar to the existing react native pattern, with the ability to get dynamic theme value and can be used in functional and class based components.
98
+
[Constants](docs/Guide.md#Constants)
157
99
158
-
### Acknowledgement
100
+
[API](docs/Guide.md#API)
159
101
160
-
Special thanks to the Authors of the amazing open source libraries
0 commit comments