Skip to content

Commit 4aba92d

Browse files
authored
Merge pull request #166 from simpleweb/feature/update-screen-command
Feature: Update the screen command
2 parents 37a5968 + 068f6bd commit 4aba92d

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

.changeset/nice-drinks-jog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"romulus-cli": minor
3+
---
4+
5+
Update the screen command

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,11 @@ App/
127127
│ ├── Text/
128128
│ │ ├── index.tsx
129129
│ │ └── styles.ts
130-
│ └── Utilities/
131-
│ └── Environment/
132-
│ ├── index.tsx
133-
│ └── styles.ts
130+
│ ├── Utilities/
131+
│ │ └── Environment/
132+
│ │ ├── index.tsx
133+
│ │ └── styles.ts
134+
│ └── Router.tsx
134135
├── Config/
135136
│ ├── Locales/
136137
│ │ └── en.json
@@ -162,7 +163,6 @@ App/
162163
├── Theme/
163164
│ └── index.js
164165
├── index.tsx
165-
├── Router.ts
166166
└── Theme.ts
167167
```
168168

docs/commands.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,25 @@ You should then import this screen into `App/Screens/index.ts` so it can be
145145
easily added to the router.
146146

147147
```js
148+
import { Box } from "@mobily/stacks";
148149
import React from "react";
149-
import { NavigationStackScreenComponent } from "react-navigation-stack";
150-
import Layout from "Remulus/App/Components/Layout";
151-
import Text from "Remulus/App/Components/Text";
150+
import { StackNavigationProp } from "@react-navigation/stack";
151+
import Text from "MyApp/App/Components/Text";
152152

153-
const Home: NavigationStackScreenComponent = ({ navigation }) => {
153+
type HomeScreenNavigationProp = StackNavigationProp<
154+
RootStackParamList,
155+
"Home"
156+
>;
157+
158+
type Props = {
159+
navigation: HomeScreenNavigationProp;
160+
};
161+
162+
function Home({ navigation }: Props) {
154163
return (
155-
<Layout.Center>
164+
<Box flex="fluid" alignX="center" alignY="center">
156165
<Text>Home</Text>
157-
</Layout.Center>
166+
</Box>
158167
);
159168
};
160169

generators/screen/templates/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { Box } from "@mobily/stacks";
12
import React from "react";
23
import { StackNavigationProp } from "@react-navigation/stack";
3-
import Layout from "<%= name %>/App/Components/Layout";
44
import Text from "<%= name %>/App/Components/Text";
55

66
type <%= screen %>ScreenNavigationProp = StackNavigationProp<
@@ -12,11 +12,11 @@ type Props = {
1212
navigation: <%= screen %>ScreenNavigationProp;
1313
};
1414

15-
const <%= screen %>: React.FC<Props> = ({ navigation }) => {
15+
function <%= screen %>({ navigation }: Props) {
1616
return (
17-
<Layout.Center>
17+
<Box flex="fluid" alignX="center" alignY="center">
1818
<Text><%= screen %></Text>
19-
</Layout.Center>
19+
</Box>
2020
);
2121
}
2222

0 commit comments

Comments
 (0)