Skip to content

Commit d22872d

Browse files
maciejmakowski2003Maciej Makowski
andauthored
Chore/arch and version support (#251)
* refactor: refactored module installation on IOS * refactor: refactored module installation on Android * fix: fixed .clang-format * docs: added compatibility tables * feat: trying to add support for paper * docs: removed compatibility table for paper * chore: bumped up packages versions and refactoted monorepo setup * chore: refactored build.gradle * refactor: added assert for min rn version on android * feat: added paper-example and added eslintrc to project dir * refactor: removed paper-example, fixed eslintrc and bumped up expo modules versions * docs: added compatibility table for paper * fix: merge requested changes --------- Co-authored-by: Maciej Makowski <maciej.makowski2608@gmail.com>
1 parent 05fad42 commit d22872d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2848
-2028
lines changed

.eslintrc.js

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/** @type {import('eslint').ESLint.ConfigData} */
2+
module.exports = {
3+
root: true,
4+
overrides: [
5+
{
6+
files: ['*.ts', '*.tsx'],
7+
parser: '@typescript-eslint/parser',
8+
parserOptions: {
9+
project: true,
10+
tsconfigRootDir: __dirname,
11+
},
12+
plugins: ['tsdoc'],
13+
extends: [
14+
'plugin:@typescript-eslint/recommended-type-checked',
15+
'plugin:prettier/recommended',
16+
],
17+
rules: {
18+
'@typescript-eslint/no-unsafe-call': 'off',
19+
'@typescript-eslint/no-unsafe-member-access': 'off',
20+
'@typescript-eslint/no-unsafe-return': 'off',
21+
'@typescript-eslint/no-unsafe-assignment': 'off',
22+
'@typescript-eslint/no-unsafe-argument': 'off',
23+
'@typescript-eslint/no-explicit-any': 'warn',
24+
'@typescript-eslint/ban-ts-comment': [
25+
'error',
26+
{
27+
'ts-ignore': 'allow-with-description',
28+
'ts-expect-error': 'allow-with-description',
29+
},
30+
],
31+
'@typescript-eslint/no-unused-vars': [
32+
'error',
33+
{ argsIgnorePattern: '^_' },
34+
],
35+
'@typescript-eslint/no-var-requires': 'off',
36+
'@typescript-eslint/no-non-null-assertion': 'off',
37+
'@typescript-eslint/no-duplicate-type-constituents': 'error',
38+
'@typescript-eslint/no-shadow': 'error',
39+
'tsdoc/syntax': 'error',
40+
'prettier/prettier': [
41+
'error',
42+
{
43+
plugins: ['prettier-plugin-jsdoc'],
44+
bracketSameLine: true,
45+
printWidth: 80,
46+
singleQuote: true,
47+
trailingComma: 'es5',
48+
tabWidth: 2,
49+
arrowParens: 'always',
50+
},
51+
],
52+
},
53+
},
54+
{
55+
files: ['*.js', '*.jsx'],
56+
plugins: ['jsdoc'],
57+
extends: ['plugin:jsdoc/recommended'],
58+
rules: {
59+
'jsdoc/tag-lines': 'off',
60+
},
61+
},
62+
],
63+
parserOptions: {
64+
requireConfigFile: false,
65+
},
66+
extends: [
67+
'standard',
68+
'prettier',
69+
'plugin:import/typescript',
70+
'plugin:react-hooks/recommended',
71+
],
72+
plugins: ['react', 'react-native', 'import', 'jest', '@typescript-eslint'],
73+
env: {
74+
'react-native/react-native': true,
75+
'jest/globals': true,
76+
},
77+
settings: {
78+
'import/resolver': {
79+
'babel-module': {
80+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
81+
},
82+
},
83+
},
84+
rules: {
85+
'object-shorthand': 'error',
86+
'curly': ['error', 'all'],
87+
'no-case-declarations': 'error',
88+
'import/no-unresolved': 'error',
89+
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
90+
'react/jsx-uses-vars': 'error',
91+
'react/jsx-uses-react': 'error',
92+
'no-use-before-define': 'off',
93+
'eqeqeq': 'error',
94+
'no-unreachable': 'error',
95+
'jest/no-disabled-tests': 'warn',
96+
'jest/no-focused-tests': 'error',
97+
'jest/no-identical-title': 'error',
98+
'jest/prefer-to-have-length': 'warn',
99+
'jest/valid-expect': 'error',
100+
'react/react-in-jsx-scope': 'off',
101+
},
102+
};

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,5 @@ react-native-audio-api*.tgz
8686

8787
# Envs
8888
.env
89+
90+
compile_commands.json

apps/common-app/package.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,33 @@
1616
"react-dom": "*",
1717
"react-native": "*",
1818
"react-native-audio-api": "*",
19+
"react-native-dotenv": "*",
1920
"react-native-gesture-handler": "*",
2021
"react-native-reanimated": "*",
2122
"react-native-safe-area-context": "*",
2223
"react-native-screens": "*"
2324
},
2425
"devDependencies": {
2526
"@babel/core": "^7.25.2",
27+
"@babel/runtime": "^7.25.0",
2628
"@react-native-vector-icons/common": "^11.0.0",
2729
"@react-native-vector-icons/icomoon": "^0.0.1",
28-
"@react-navigation/native": "^6.1.18",
29-
"@react-navigation/native-stack": "^6.11.0",
30-
"@react-navigation/stack": "^6.4.1",
31-
"@shopify/react-native-skia": "^1.5.1",
32-
"expo": "^52.0.0",
33-
"expo-document-picker": "~13.0.1",
34-
"expo-file-system": "~18.0.4",
30+
"@react-navigation/native": "^7.0.0",
31+
"@react-navigation/native-stack": "^7.0.0",
32+
"@react-navigation/stack": "^7.0.0",
33+
"@shopify/react-native-skia": "^1.8.2",
34+
"expo": "^52.0.25",
35+
"expo-document-picker": "~13.0.2",
36+
"expo-file-system": "~18.0.7",
3537
"react": "18.3.1",
36-
"react-dom": "18.2.0",
37-
"react-native": "0.76.0",
38+
"react-native": "0.76.5",
3839
"react-native-audio-api": "workspace:*",
3940
"react-native-dotenv": "^3.4.11",
40-
"react-native-gesture-handler": "^2.20.2",
41-
"react-native-reanimated": "^3.16.1",
42-
"react-native-safe-area-context": "^4.12.0",
43-
"react-native-screens": "^3.35.0"
41+
"react-native-gesture-handler": "^2.21.2",
42+
"react-native-reanimated": "^3.16.6",
43+
"react-native-safe-area-context": "^4.13.1",
44+
"react-native-screens": "^4.4.0",
45+
"typescript": "~5.3.0"
4446
},
4547
"expo": {
4648
"autolinking": {

apps/common-app/src/examples/DrumMachine/DrumMachine.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import Kick from '../../utils/soundEngines/Kick';
1010
import Clap from '../../utils/soundEngines/Clap';
1111
import HiHat from '../../utils/soundEngines/HiHat';
1212

13-
import { InstrumentName, Pattern, type XYWHRect } from '../../types';
14-
import { size, initialBpm } from './constants';
13+
import { InstrumentName, Pattern } from '../../types';
14+
import type { XYWHRect } from '../../types';
15+
import { size, initialBpm, numBeats } from './constants';
1516
import NotesHighlight from './NotesHighlight';
1617
import PatternShape from './PatternShape';
1718
import useGestures from './useGestures';
1819
import PlayButton from './PlayButton';
1920
import usePlayer from '../../utils/usePlayer';
2021
import presets from './presets';
21-
import { numBeats } from './constants';
2222
import Grid from './Grid';
2323

2424
const defaultPreset = 'Empty';

apps/common-app/src/examples/TextToSpeech/TextToSpeech.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-misused-promises */
12
import React, { useState, FC } from 'react';
23
import { AudioBuffer, AudioContext } from 'react-native-audio-api';
34
import { ActivityIndicator, TextInput, StyleSheet } from 'react-native';
@@ -15,8 +16,8 @@ async function getOpenAIResponse(input: string, voice: string = 'alloy') {
1516
},
1617
body: JSON.stringify({
1718
model: 'tts-1-hd',
18-
voice: voice,
19-
input: input,
19+
voice,
20+
input,
2021
response_format: 'pcm',
2122
}),
2223
}).then((response) => response.arrayBuffer());

apps/fabric-example/android/app/build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ react {
1111
// The root of your project, i.e. where "package.json" lives. Default is '../..'
1212
// root = file("../../")
1313
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14-
// reactNativeDir = file("../../node_modules/react-native")
14+
reactNativeDir = file("../../../../node_modules/react-native")
1515
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16-
// codegenDir = file("../../node_modules/@react-native/codegen")
16+
codegenDir = file("../../../../node_modules/@react-native/codegen")
1717
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18-
// cliFile = file("../../node_modules/react-native/cli.js")
18+
cliFile = file("../../../../node_modules/react-native/cli.js")
1919

2020
/* Variants */
2121
// The list of variants to that are debuggable. For those we're going to
@@ -45,7 +45,7 @@ react {
4545

4646
/* Hermes Commands */
4747
// The hermes compiler command to run. By default it is 'hermesc'
48-
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
48+
hermesCommand = "../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
4949
//
5050
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5151
// hermesFlags = ["-O", "-output-source-map"]
@@ -110,7 +110,6 @@ android {
110110
dependencies {
111111
// The version of react-native is set by the React Native Gradle Plugin
112112
implementation("com.facebook.react:react-android")
113-
implementation project(':expo')
114113

115114
if (hermesEnabled.toBoolean()) {
116115
implementation("com.facebook.react:hermes-android")

apps/fabric-example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22

33
<uses-permission android:name="android.permission.INTERNET" />
4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
45
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
56

67
<application
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
1+
pluginManagement { includeBuild('../../../node_modules/@react-native/gradle-plugin') }
22
plugins { id("com.facebook.react.settings") }
33
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
44
rootProject.name = 'FabricExample'
55
include ':app'
6-
includeBuild('../node_modules/@react-native/gradle-plugin')
6+
includeBuild('../../../node_modules/@react-native/gradle-plugin')
77

88
apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
99
useExpoModules()

apps/fabric-example/ios/FabricExample.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@
666666
"$(inherited)",
667667
" ",
668668
);
669-
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
669+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
670670
SDKROOT = iphoneos;
671671
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
672672
USE_HERMES = true;
@@ -738,7 +738,7 @@
738738
"$(inherited)",
739739
" ",
740740
);
741-
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
741+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
742742
SDKROOT = iphoneos;
743743
USE_HERMES = true;
744744
VALIDATE_PRODUCT = YES;

apps/fabric-example/ios/Podfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
22

3+
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
34
# Resolve react_native_pods.rb with node to allow for hoisting
45
require Pod::Executable.execute_command('node', ['-p',
56
'require.resolve(
@@ -25,7 +26,7 @@ target 'FabricExample' do
2526
Pod::UI.warn e
2627
end
2728
end
28-
29+
2930
config = use_native_modules!
3031

3132
use_react_native!(

0 commit comments

Comments
 (0)