@compsych-ui-components/react-native 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitkeep ADDED
File without changes
package/.swcrc ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "jsc": {
3
+ "target": "es2022",
4
+ "parser": {
5
+ "syntax": "typescript",
6
+ "tsx": true,
7
+ "decorators": false,
8
+ "dynamicImport": true
9
+ },
10
+ "transform": {
11
+ "react": {
12
+ "runtime": "automatic"
13
+ }
14
+ }
15
+ },
16
+ "module": {
17
+ "type": "nodenext"
18
+ },
19
+ "sourceMaps": true,
20
+ "exclude": [".*\\.spec\\.tsx?$"]
21
+ }
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@compsych-ui-components/react-native",
3
+ "version": "3.2.4",
4
+ "description": "React Native UI components for compsych",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./src/index.d.ts",
10
+ "default": "./src/index.js"
11
+ }
12
+ },
13
+ "publishConfig": {
14
+ "access": "public",
15
+ "registry": "https://registry.npmjs.org/"
16
+ },
17
+ "peerDependencies": {
18
+ "@compsych-ui-components/shared": "*",
19
+ "react": ">=18.0.0",
20
+ "react-native": ">=0.73.0"
21
+ }
22
+ }
package/project.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "react-native",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/react-native/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "build": {
8
+ "executor": "@nx/js:swc",
9
+ "outputs": ["{options.outputPath}"],
10
+ "options": {
11
+ "outputPath": "dist/packages/react-native",
12
+ "main": "packages/react-native/src/index.ts",
13
+ "tsConfig": "packages/react-native/tsconfig.lib.json"
14
+ },
15
+ "dependsOn": ["^build"]
16
+ }
17
+ },
18
+ "implicitDependencies": ["shared"]
19
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { Button } from './lib/button';
2
+ export type { ButtonProps } from './lib/button';
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import { Pressable, StyleSheet, Text } from 'react-native';
3
+ import { showAlert } from '@compsych/shared';
4
+
5
+ export interface ButtonProps {
6
+ label?: string;
7
+ alertMessage?: string;
8
+ onPress?: () => void;
9
+ }
10
+
11
+ export function Button({
12
+ label = 'Click me',
13
+ alertMessage = 'Hello from @compsych/react-native!',
14
+ onPress,
15
+ }: ButtonProps) {
16
+ const handlePress = () => {
17
+ if (onPress) {
18
+ onPress();
19
+ } else {
20
+ showAlert(alertMessage);
21
+ }
22
+ };
23
+
24
+ return (
25
+ <Pressable
26
+ style={({ pressed }) => [styles.button, pressed && styles.pressed]}
27
+ onPress={handlePress}
28
+ accessibilityRole="button"
29
+ >
30
+ <Text style={styles.label}>{label}</Text>
31
+ </Pressable>
32
+ );
33
+ }
34
+
35
+ const styles = StyleSheet.create({
36
+ button: {
37
+ paddingVertical: 8,
38
+ paddingHorizontal: 16,
39
+ backgroundColor: '#1976d2',
40
+ borderRadius: 4,
41
+ alignItems: 'center',
42
+ },
43
+ pressed: {
44
+ backgroundColor: '#1565c0',
45
+ },
46
+ label: {
47
+ color: '#ffffff',
48
+ fontSize: 14,
49
+ },
50
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "declarationDir": "../../dist/out-tsc",
6
+ "jsx": "react-native",
7
+ "moduleResolution": "node"
8
+ },
9
+ "include": ["src/**/*.ts", "src/**/*.tsx"]
10
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "types": []
6
+ },
7
+ "exclude": ["**/*.spec.ts", "**/*.spec.tsx"]
8
+ }