Skip to content

Commit 7fa68c9

Browse files
authored
Merge pull request #4 from mohit23x/context-setup
added statusbar height in context
2 parents c60eda4 + 3915a3c commit 7fa68c9

7 files changed

Lines changed: 18 additions & 14 deletions

File tree

example/components/Card.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@ export default function Card() {
1010
);
1111
}
1212

13-
const styles = StyleSheet.create((theme) => ({
13+
const styles = StyleSheet.create(theme => ({
1414
container: {
1515
height: 250,
1616
backgroundColor: theme.surface,
1717
margin: theme.spacing.m,
1818
justifyContent: "center",
1919
alignItems: "center",
2020
borderRadius: theme.borderRadius.m,
21+
marginTop: theme.constant.statusBarHeight
2122
},
2223
text: {
2324
color: theme.text,
2425
fontWeight: "700",
25-
fontSize: theme.fontSize.l,
26-
},
26+
fontSize: theme.fontSize.l
27+
}
2728
}));

example/components/Counter.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ export default function Counter() {
77
useTheme();
88

99
return (
10-
<Pressable style={styles.pressable} onPress={() => setCount((c) => c + 1)}>
10+
<Pressable style={styles.pressable} onPress={() => setCount(c => c + 1)}>
1111
<Text style={styles.text}>{`count: ${count}`}</Text>
1212
</Pressable>
1313
);
1414
}
1515

16-
const styles = StyleSheet.create((theme) => ({
16+
const styles = StyleSheet.create(theme => ({
1717
pressable: {
1818
width: theme.constant.width,
1919
alignItems: "center",
20+
backgroundColor: theme.buttonPrimary
2021
},
2122
text: {
2223
fontSize: theme.fontSize.xl,
2324
color: theme.text,
24-
padding: theme.spacing.l,
25-
},
25+
padding: theme.spacing.l
26+
}
2627
}));

example/components/Toggle.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { StyleSheet, lightTheme, darkTheme } from "../style";
44

55
export default function Toggle() {
66
const isLight = StyleSheet.theme.name === "light";
7+
78
const onPress = () => {
89
StyleSheet.build(isLight ? darkTheme : lightTheme);
910
};

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"react-native-gesture-handler": "~1.8.0",
1818
"react-native-reanimated": "~1.13.0",
1919
"react-native-screens": "~2.15.0",
20-
"react-native-sugar-style": "^0.0.6",
20+
"react-native-sugar-style": "^0.0.8",
2121
"react-native-unimodules": "~0.12.0",
2222
"react-native-web": "~0.13.12"
2323
},

example/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6800,10 +6800,10 @@ react-native-screens@~2.15.0:
68006800
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-2.15.2.tgz#a449700e895b462937211ec72ed6f09652758f06"
68016801
integrity sha512-CagNf2APXkVoRlF3Mugr264FbKbrBg9eXUkqhIPVeZB8EsdS8XPrnt99yj/pzmT+yJMBY0dGrjXT8+68WYh6YQ==
68026802

6803-
react-native-sugar-style@^0.0.6:
6804-
version "0.0.6"
6805-
resolved "https://registry.yarnpkg.com/react-native-sugar-style/-/react-native-sugar-style-0.0.6.tgz#faeec84a52cd033702d634bd3c778a6430434cf7"
6806-
integrity sha512-HDd8ZUVq2C35kB6RnyqMAWb9K/Y03vE133FZBYa0kZT0LyAICJBGjoehtBudREs7JrSm3//g7x0stHW1LBwsIA==
6803+
react-native-sugar-style@^0.0.8:
6804+
version "0.0.8"
6805+
resolved "https://registry.yarnpkg.com/react-native-sugar-style/-/react-native-sugar-style-0.0.8.tgz#a4558c99a350df052ef3007911ea7d45a54495a3"
6806+
integrity sha512-wgHJnG/wPFz12uVOFE3sT/G8s8x9s0UB4pv27moeSImZSuAv3seJzLf6L8vZDeLbpMZnAskvqBdg1Q9ijx6bUg==
68076807

68086808
react-native-unimodules@~0.12.0:
68096809
version "0.12.0"

lib/constant.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const constants = {
4343
isNavBarVisible,
4444
visibleHeight,
4545
isIPhoneX,
46-
os,
46+
os,
47+
statusBarHeight
4748
}
4849
} as const;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-sugar-style",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "React Native Stylesheet alternative with theme support",
55
"author": "mohit23x",
66
"license": "MIT",

0 commit comments

Comments
 (0)