-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react-native): update react-native generators
- Loading branch information
1 parent
def2cfd
commit cafca98
Showing
9 changed files
with
115 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/react-native/src/generators/component/files/js/__fileName__.__ext__
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<%_ if (classComponent) { _%> | ||
import { Component } from 'react'; | ||
<%_ } else { _%> | ||
import React from 'react'; | ||
<%_ } _%> | ||
import { View, Text } from 'react-native'; | ||
|
||
<%_ if (classComponent) { _%> | ||
export class <%= className %> extends Component { | ||
render() { | ||
return ( | ||
<View> | ||
<Text>Welcome to <%= name %>!</Text> | ||
</View> | ||
); | ||
} | ||
} | ||
<%_ } else { _%> | ||
export function <%= className %>(props) { | ||
return ( | ||
<View> | ||
<Text>Welcome to <%= name %>!</Text> | ||
</View> | ||
); | ||
} | ||
<%_ } _%> | ||
|
||
export default <%= className %>; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/react-native/src/generators/component/files/ts/__fileName__.spec.__ext__
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react-native'; | ||
|
||
import <%= className %> from './<%= fileName %>'; | ||
|
||
describe('<%= className %>', () => { | ||
it('should render successfully', () => { | ||
const { root } = render(< <%= className %> />); | ||
expect(root).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters