Skip to content

Commit d3537c9

Browse files
committed
refactor: custom style types are changed to a cleaner way
1 parent 544a7cf commit d3537c9

File tree

6 files changed

+6564
-5189
lines changed

6 files changed

+6564
-5189
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
> Why do I have a folder named ".expo" in my project?
2+
3+
The ".expo" folder is created when an Expo project is started using "expo start" command.
4+
5+
> What do the files contain?
6+
7+
- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds.
8+
- "packager-info.json": contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator.
9+
- "settings.json": contains the server configuration that is used to serve the application manifest.
10+
11+
> Should I commit the ".expo" folder?
12+
13+
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.
14+
15+
Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"expoServerPort": 19000,
3+
"packagerPort": 19000
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"hostType": "lan",
3+
"lanType": "ip",
4+
"dev": true,
5+
"minify": false,
6+
"urlRandomness": null,
7+
"https": false,
8+
"scheme": null
9+
}

example-manual-state/App.tsx

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,29 @@ const App = () => {
88
const [checkboxState, setCheckboxState] = React.useState(false);
99

1010
return (
11-
<SafeAreaView
12-
style={{
13-
flex: 1,
14-
alignItems: 'center',
15-
justifyContent: 'center',
16-
}}>
11+
<SafeAreaView style={styles.container}>
1712
<View
18-
style={{
19-
height: 30,
20-
width: 150,
21-
alignItems: 'center',
22-
justifyContent: 'center',
23-
borderRadius: 12,
24-
backgroundColor: checkboxState ? '#34eb83' : '#eb4034',
25-
}}>
13+
style={[
14+
styles.stateContainer,
15+
{
16+
backgroundColor: checkboxState ? '#34eb83' : '#eb4034',
17+
},
18+
]}>
2619
<Text
27-
style={{
28-
color: '#fff',
29-
}}>{`Check Status: ${checkboxState.toString()}`}</Text>
20+
style={
21+
styles.stateTextStyle
22+
}>{`Check Status: ${checkboxState.toString()}`}</Text>
3023
</View>
3124
<BouncyCheckbox
3225
style={{marginTop: 16}}
3326
ref={(ref: any) => (bouncyCheckboxRef = ref)}
3427
isChecked={checkboxState}
3528
text="Synthetic Checkbox"
3629
disableBuiltInState
37-
onPress={(isChecked: boolean = false) =>
38-
setCheckboxState(!checkboxState)
39-
}
30+
onPress={() => setCheckboxState(!checkboxState)}
4031
/>
4132
<RNBounceable
42-
style={{
43-
marginTop: 16,
44-
height: 50,
45-
width: '90%',
46-
backgroundColor: '#ffc484',
47-
borderRadius: 12,
48-
alignItems: 'center',
49-
justifyContent: 'center',
50-
}}
33+
style={styles.syntheticButton}
5134
onPress={() => {
5235
console.log(bouncyCheckboxRef?.onPress());
5336
// bouncyCheckboxRef?.current.onPress();
@@ -59,6 +42,31 @@ const App = () => {
5942
);
6043
};
6144

62-
const styles = StyleSheet.create({});
45+
const styles = StyleSheet.create({
46+
container: {
47+
flex: 1,
48+
alignItems: 'center',
49+
justifyContent: 'center',
50+
},
51+
stateContainer: {
52+
height: 30,
53+
width: 150,
54+
alignItems: 'center',
55+
justifyContent: 'center',
56+
borderRadius: 12,
57+
},
58+
stateTextStyle: {
59+
color: '#fff',
60+
},
61+
syntheticButton: {
62+
height: 50,
63+
marginTop: 16,
64+
borderRadius: 12,
65+
width: '90%',
66+
alignItems: 'center',
67+
justifyContent: 'center',
68+
backgroundColor: '#ffc484',
69+
},
70+
});
6371

6472
export default App;

0 commit comments

Comments
 (0)