Skip to content

Commit 1dd7c7c

Browse files
committed
Ready to publish
1 parent 4032510 commit 1dd7c7c

File tree

10 files changed

+79
-17
lines changed

10 files changed

+79
-17
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010

1111
<p align="center">
1212
<img alt="React Native Checkbox Card"
13-
src="assets/Screenshots/typescript.jpg" />
13+
src="assets/Screenshots/RN-Checkbox-Card.gif" />
14+
<img alt="React Native Checkbox Card"
15+
src="assets/Screenshots/RN-Checkbox-Card-2.gif" />
16+
<img alt="React Native Checkbox Card"
17+
src="assets/Screenshots/RN-Checkbox-Card-Light.gif" />
1418
</p>
1519

1620
# Installation
21.7 MB
Loading
20 MB
Loading
22.7 MB
Loading

assets/Screenshots/typescript.jpg

-28.5 KB
Binary file not shown.

assets/logo.png

417 Bytes
Loading

example/App.tsx

Lines changed: 68 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,95 @@
11
import React from "react";
2-
import { FlatList, StatusBar, SafeAreaView } from "react-native";
3-
4-
import RNCheckboxCard from "./build/dist/RNCheckboxCard";
2+
import { View, Text, FlatList, StatusBar, SafeAreaView } from "react-native";
3+
import RNCheckboxCard from "react-native-checkbox-card";
54

65
const staticData = [
76
{
87
id: 1,
98
text: "Banana",
9+
quantity: "(2)",
10+
},
11+
{
12+
id: 2,
13+
text: "Apple",
14+
quantity: "(3)",
15+
},
16+
{
17+
id: 3,
18+
text: "Red wine",
19+
quantity: "x1",
20+
},
21+
{
22+
id: 4,
23+
text: "Egg",
24+
quantity: "x12",
25+
},
26+
{
27+
id: 5,
28+
text: "Flour",
29+
quantity: "1 pack",
30+
},
31+
32+
{
33+
id: 6,
34+
text: "Butter",
35+
quantity: "1 whole",
36+
},
37+
{
38+
id: 7,
39+
text: "Brown rise",
40+
quantity: "2 kg",
41+
},
42+
{
43+
id: 8,
44+
text: "Tomato sauce",
45+
quantity: "x2",
1046
},
1147
];
1248

1349
const App = () => {
1450
const renderItem = (data: any) => {
15-
const { text, id } = data.item;
51+
const { text, quantity, id } = data.item;
1652

1753
return (
18-
<RNCheckboxCard
19-
darkMode
20-
text={text}
21-
onPress={(checked: boolean) => console.log("Checked: ", checked)}
22-
/>
54+
<View style={{ marginTop: 16 }}>
55+
<RNCheckboxCard
56+
// darkMode
57+
text={text}
58+
// quantity={quantity}
59+
// enableQuantityText
60+
onPress={(checked: boolean) => console.log("Checked: ", checked)}
61+
/>
62+
</View>
2363
);
2464
};
2565

66+
const renderHeader = () => (
67+
<View style={{ marginLeft: 24 }}>
68+
<Text style={{ fontSize: 32, color: "#1b1b1b", fontWeight: "600" }}>
69+
Shopping List
70+
</Text>
71+
<Text style={{ color: "#818181", fontSize: 16 }}>
72+
Your daily shopping list
73+
</Text>
74+
</View>
75+
);
76+
2677
return (
2778
<>
28-
<StatusBar barStyle="light-content" />
79+
<StatusBar barStyle="dark-content" />
2980
<SafeAreaView
3081
style={{
3182
flex: 1,
32-
alignItems: "center",
3383
justifyContent: "center",
34-
backgroundColor: "#19191a",
84+
backgroundColor: "#edf0f1",
3585
}}
3686
>
37-
<FlatList data={staticData} renderItem={renderItem} />
87+
{renderHeader()}
88+
<FlatList
89+
data={staticData}
90+
style={{ marginTop: 24 }}
91+
renderItem={renderItem}
92+
/>
3893
</SafeAreaView>
3994
</>
4095
);

lib/RNCheckboxCard.style.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const { width: ScreenWidth } = Dimensions.get("window");
1010
interface Style {
1111
container: ViewStyle;
1212
rightIconContainer: ViewStyle;
13+
textContainer: TextStyle;
1314
sortIconImageStyle: ImageStyle;
1415
quantityTextStyle: TextStyle;
1516
checkIconImageStyle: ImageStyle;
@@ -36,7 +37,6 @@ export const _textStyle = (
3637
checkedTextColor: string,
3738
uncheckedTextColor: string,
3839
): TextStyle => ({
39-
width: "80%",
4040
fontSize: 16,
4141
marginLeft: 16,
4242
fontWeight: "600",
@@ -74,6 +74,9 @@ export default StyleSheet.create<Style>({
7474
width: 10,
7575
height: 30,
7676
},
77+
textContainer: {
78+
width: "80%",
79+
},
7780
quantityTextStyle: {
7881
color: "#ccc",
7982
marginLeft: 16,

lib/RNCheckboxCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export default class RNCheckboxCard extends React.Component<
126126
enableQuantityText = false,
127127
} = this.props;
128128
return (
129-
<View>
129+
<View style={styles.textContainer}>
130130
<Text
131131
numberOfLines={2}
132132
style={[

lib/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type ThemeColorsType = {
99
export const ThemeColors: ThemeColorsType = {
1010
light: {
1111
borderColor: "#797979",
12-
backgroundColor: "#e5e5e5",
12+
backgroundColor: "#fff",
1313
checkedTextColor: "#8b8ca5",
1414
uncheckedTextColor: "#2b2b2c",
1515
},

0 commit comments

Comments
 (0)