Skip to content

feat: new template #369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
13b6ada
chore: init welcome package
jbroma May 31, 2025
e8b3b5f
feat: welcome screen
jbroma May 31, 2025
9646a8d
feat: import in android
jbroma May 31, 2025
7bdda0f
feat: ios
jbroma May 31, 2025
d3733a6
feat: use in template
jbroma May 31, 2025
3545824
chore: assets
jbroma May 31, 2025
d7798cb
fix: imports in welcome
jbroma May 31, 2025
d6c513b
fix: copy assets
jbroma May 31, 2025
fb665db
fix: include cjs entrypoint for welcome
jbroma May 31, 2025
14c15a2
chore: changeset
jbroma May 31, 2025
75523fd
refactor: cleanup template
jbroma May 31, 2025
724e47b
refactor: use functions
jbroma May 31, 2025
997439a
chore: update changeset
jbroma May 31, 2025
ad899ec
fix: use different shortcut for ios
jbroma May 31, 2025
ab6c4a2
refactor: view documentation
jbroma May 31, 2025
d9fd012
chore: update README.md
jbroma May 31, 2025
ce92a18
fix: lint in welcome
jbroma May 31, 2025
1fe7c1f
Merge remote-tracking branch 'origin/main' into feat/new-template
jbroma Jun 2, 2025
fbffc6a
chore: update lockfile
jbroma Jun 2, 2025
7f5566a
chore: use default condition
jbroma Jun 2, 2025
5fb49f4
fix: add path to root tsconfig
jbroma Jun 2, 2025
b785d6a
chore: add jsx preserve to root config
jbroma Jun 2, 2025
c5b0eb0
chore: pass with no tests
jbroma Jun 2, 2025
c8e1e43
chore: update changeset
jbroma Jun 2, 2025
5daa16d
Merge remote-tracking branch 'origin/main' into feat/new-template
jbroma Jun 2, 2025
600296c
refactor: welcome-screen package
jbroma Jun 2, 2025
b889e7a
chore: peer deps
jbroma Jun 2, 2025
a03d92c
fix: include cjs entrypoint
jbroma Jun 2, 2025
f89cb9d
fix: include welcome-screen as dep in template
jbroma Jun 2, 2025
1020cf2
Merge remote-tracking branch 'origin/main' into feat/new-template
jbroma Jun 3, 2025
0c1bc7c
change minor to patch
thymikee Jun 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/little-days-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rnef/welcome-screen': patch
---

feat: introduce new template for newly created RNEF projects
7 changes: 7 additions & 0 deletions packages/welcome-screen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @rnef/welcome-screen

A welcome screen component for React Native apps, used in the official template for newly created RNEF projects.

## Documentation

For detailed documentation about RNEF and its tools, visit [RNEF Documentation](https://rnef.dev)
3 changes: 3 additions & 0 deletions packages/welcome-screen/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import baseConfig from '../../eslint.config.js';

export default baseConfig;
30 changes: 30 additions & 0 deletions packages/welcome-screen/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@rnef/welcome-screen",
"version": "0.7.17",
"type": "module",
"main": "./dist/src/index.jsx",
"types": "./dist/src/index.d.ts",
"exports": {
"types": "./dist/src/index.d.ts",
"default": "./dist/src/index.jsx"
},
"files": [
"dist"
],
"scripts": {
"publish:npm": "npm publish --access public",
"publish:verdaccio": "npm publish --registry http://localhost:4873 --userconfig ../../.npmrc"
},
"peerDependencies": {
"react": "*",
"react-native": "*"
},
"devDependencies": {
"@types/react": "^19.0.0",
"react": "19.0.0",
"react-native": "0.79.1"
},
"publishConfig": {
"access": "public"
}
}
15 changes: 15 additions & 0 deletions packages/welcome-screen/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "welcome-screen",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/welcome-screen/src",
"projectType": "library",
"tags": [],
"targets": {
"build": {
"executor": "@nx/js:tsc",
"options": {
"assets": ["packages/welcome-screen/src/assets/*.png"]
}
}
}
}
Binary file added packages/welcome-screen/src/assets/book-open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/welcome-screen/src/assets/debug-check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/welcome-screen/src/assets/zap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
225 changes: 225 additions & 0 deletions packages/welcome-screen/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
import React from 'react';
import {
Animated,
Image,
Platform,
Pressable,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';
// @ts-expect-error deep import without declaration
import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser';

const ICONS = {
book: require('./assets/book-open.png'),
logo: require('./assets/building-skyscraper.png'),
debug: require('./assets/debug-check.png'),
zap: require('./assets/zap.png'),
} as const;

function Card({
dark,
icon,
title,
description,
}: {
dark: boolean;
description: string;
icon: keyof typeof ICONS;
title: string;
}) {
return (
<View style={styles.featureCard}>
<View style={styles.featureIconContainer}>
<Image
source={ICONS[icon]}
style={styles.featureIcon}
resizeMode="contain"
/>
</View>
<View style={styles.featureContent}>
<Text style={[styles.featureTitle, { color: dark ? '#fff' : '#000' }]}>
{title}
</Text>
<Text style={[styles.featureDescription]}>{description}</Text>
</View>
</View>
);
}

function WelcomeScreen() {
const isDarkMode = useColorScheme() === 'dark';
const bgColor = isDarkMode ? '#000' : '#fff';
const textColor = isDarkMode ? '#fff' : '#000';
const scaleValue = React.useRef(new Animated.Value(1)).current;
const animatedStyle = { transform: [{ scale: scaleValue }] };

const onPressIn = () => {
Animated.spring(scaleValue, {
toValue: 0.95,
useNativeDriver: true,
speed: 20,
bounciness: 5,
}).start();
};

const onPressOut = () => {
Animated.spring(scaleValue, {
toValue: 1,
useNativeDriver: true,
speed: 20,
bounciness: 5,
}).start();
};

const onPress = () => {
openURLInBrowser('https://rnef.dev');
};

return (
<View style={[styles.container, { backgroundColor: bgColor }]}>
<View style={styles.header}>
<View style={styles.logoContainer}>
<Image
source={ICONS['logo']}
style={styles.logo}
resizeMode="contain"
/>
</View>
<Text style={[styles.title, { color: textColor }]}>
Welcome to React Native Enterprise Framework!
</Text>
</View>

<View style={styles.content}>
<View style={styles.featureList}>
<Card
dark={isDarkMode}
icon="zap"
title="Start building"
description="Open App.tsx, edit and see your changes live here"
/>
<Card
dark={isDarkMode}
icon="debug"
title="Debug with DevTools"
description={`Press ${Platform.select({
ios: 'Cmd+D',
android: 'Ctrl+M',
})} to access Dev Menu to debug, reload and inspect your app`}
/>
<Card
dark={isDarkMode}
icon="book"
title="Learn more"
description="Visit our documentation and learn about Remote Cache, Brownfield, and more by Callstack"
/>
</View>
<View style={styles.footer}>
<Animated.View style={[styles.buttonContainer, animatedStyle]}>
<Pressable
onPressIn={onPressIn}
onPressOut={onPressOut}
onPress={onPress}
style={styles.button}
>
<Text style={styles.buttonText}>View Documentation</Text>
</Pressable>
</Animated.View>
</View>
</View>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 2,
},
header: {
flex: 1,
justifyContent: 'flex-end',
alignItems: 'center',
padding: 24,
},
logoContainer: {
width: 80,
height: 80,
marginBottom: 20,
justifyContent: 'center',
alignItems: 'center',
},
logo: {
width: 48,
height: 48,
},
title: {
fontSize: 36,
fontWeight: 'bold',
textAlign: 'center',
color: '#000',
},
content: {
flex: 1.2,
justifyContent: 'flex-start',
marginHorizontal: 16,
},
featureList: {
flex: 1,
flexShrink: 1,
},
footer: {
flex: 1,
justifyContent: 'flex-end',
},
buttonContainer: {
marginBottom: 60,
borderRadius: 12,
overflow: 'hidden',
},
button: {
backgroundColor: 'rgb(120,55,245)',
borderRadius: 12,
padding: 16,
alignItems: 'center',
},
buttonText: {
color: '#fff',
fontSize: 16,
fontWeight: '600',
},
featureCard: {
flexDirection: 'row',
alignItems: 'center',
padding: 12,
},
featureIconContainer: {
width: 40,
height: 40,
borderRadius: 12,
marginRight: 24,
justifyContent: 'center',
alignItems: 'center',
},
featureIcon: {
width: 30,
height: 30,
},
featureContent: {
flex: 1,
flexShrink: 1,
},
featureTitle: {
fontSize: 16,
fontWeight: '600',
marginBottom: 4,
},
featureDescription: {
fontSize: 14,
color: '#666',
},
});

export default WelcomeScreen;
22 changes: 22 additions & 0 deletions packages/welcome-screen/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/welcome-screen/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["vite.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
26 changes: 26 additions & 0 deletions packages/welcome-screen/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": [
"vitest/globals",
"vitest/importMeta",
"vite/client",
"node",
"vitest"
],
"module": "NodeNext"
},
"include": [
"vite.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}
28 changes: 28 additions & 0 deletions packages/welcome-screen/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { defineConfig } from 'vite';

export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/packages/welcome-screen',

plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],

// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },

test: {
watch: false,
globals: true,
environment: 'node',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
passWithNoTests: true,
reporters: ['default'],
coverage: {
reportsDirectory: '../../coverage/packages/welcome-screen',
provider: 'v8',
},
},
});
Loading