forked from software-mansion/react-native-reanimated
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify example apps (software-mansion#4288)
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary Note: This is a huge PR, please review the commits one-by-one. ### Changes - Create app package that holds the common code for all example apps + add CI checks - Move all examples from Example, FabricExample and WebExample to app directory - Use `App.tsx` from app directory in Example, FabricExample and WebExample apps - Use `export default function` wherever possible - Use `NativeStackNavigationProp` type instead of `StackNavigationProp` in SET examples and remove dependency - Remove test, test-suite and e2e directories and Detox configuration - Regenerate Example app using `npx react-native@next ReanimatedExample --version 0.71.3 --skip-install` - Use autolinking instead of manual linking in Example app (Android & iOS) like in FabricExample - Use original TypeScript and ESLint configuration in Example and FabricExample apps - Move `react-native-reanimated-tests.tsx` from FabricExample to `__typetests__` (as in react-native repo) ### TODO - [ ] Check apps in release mode ### Next steps - [ ] Make example list hierarchical - [ ] WebExample takes too long to bundle - [ ] Don't return to home screen after fast refresh on web ## Test plan Check if Example, FabricExample and WebExample work properly.
- Loading branch information
Showing
235 changed files
with
3,740 additions
and
9,781 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Validate app | ||
on: | ||
pull_request: | ||
paths: | ||
- '.github/workflows/validate-app.yml' | ||
- 'app/**' | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: app-${{ github.ref }} | ||
cancel-in-progress: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Use Node.js 16 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: 'yarn' | ||
- name: Install node dependencies | ||
run: yarn | ||
- name: Install app dependencies | ||
working-directory: app | ||
run: yarn | ||
- name: Check types | ||
working-directory: app | ||
run: yarn type:check | ||
- name: Lint with ESLint | ||
working-directory: app | ||
run: yarn lint:eslint | ||
- name: Lint with Prettier | ||
working-directory: app | ||
run: yarn lint:prettier |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native', | ||
extends: '@react-native-community', | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
arrowParens: 'avoid', | ||
bracketSameLine: true, | ||
bracketSpacing: false, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
}; |
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,3 @@ | ||
import App from '../app'; | ||
|
||
export default App; |
This file was deleted.
Oops, something went wrong.
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
35 changes: 0 additions & 35 deletions
35
Example/android/app/src/androidTest/java/com/swmansion/reanimated/example/DetoxTest.java
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
rootProject.name = 'ReanimatedExample' | ||
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) | ||
|
||
include ':react-native-reanimated' | ||
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../../android') | ||
|
||
include ':app' | ||
includeBuild('../node_modules/react-native-gradle-plugin') |
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 |
---|---|---|
@@ -1,11 +1,4 @@ | ||
{ | ||
"name": "ReanimatedExample", | ||
"displayName": "ReanimatedExample", | ||
"expo": { | ||
"name": "ReanimatedExample", | ||
"privacy": "unlisted", | ||
"sdkVersion": "34.0.0", | ||
"version": "1.0.0", | ||
"platforms": ["ios", "android", "web"] | ||
} | ||
} | ||
"displayName": "ReanimatedExample" | ||
} |
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 |
---|---|---|
@@ -1,44 +1,4 @@ | ||
module.exports = (api) => { | ||
const isWeb = api.caller(isTargetWeb); | ||
|
||
return { | ||
presets: [ | ||
'@babel/preset-typescript', | ||
'module:metro-react-native-babel-preset', | ||
], | ||
plugins: [ | ||
'@babel/plugin-proposal-export-namespace-from', | ||
'@babel/plugin-proposal-optional-chaining', | ||
'@babel/plugin-transform-modules-commonjs', | ||
'../plugin', | ||
isWeb | ||
? [ | ||
'module-resolver', | ||
{ | ||
alias: { | ||
'react-native-reanimated': './Animated/', | ||
}, | ||
}, | ||
] | ||
: [ | ||
'module-resolver', | ||
{ | ||
alias: { | ||
'react-native-reanimated': '../src/index', | ||
react: './node_modules/react', | ||
'react-native': './node_modules/react-native', | ||
'@babel': './node_modules/@babel', | ||
'hoist-non-react-statics': | ||
'./node_modules/hoist-non-react-statics', | ||
invariant: './node_modules/invariant', | ||
'prop-types': './node_modules/prop-types', | ||
}, | ||
}, | ||
], | ||
].filter(Boolean), | ||
}; | ||
module.exports = { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
plugins: ['../plugin'], | ||
}; | ||
|
||
function isTargetWeb(caller) { | ||
return caller && caller.name === 'babel-loader'; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
import { AppRegistry, Platform } from 'react-native'; | ||
import { name as appName } from './app.json'; | ||
import App from './src/App'; | ||
/** | ||
* @format | ||
*/ | ||
|
||
AppRegistry.registerComponent(appName, () => App); | ||
import {AppRegistry} from 'react-native'; | ||
import App from './App'; | ||
import {name as appName} from './app.json'; | ||
|
||
// TODO(Bacon): When `expo` has removed Updates, replace this with using the `expo` entry for better error handling | ||
if (Platform.OS === 'web') { | ||
const rootTag = document.getElementById('root'); | ||
AppRegistry.runApplication(appName, { rootTag }); | ||
} | ||
AppRegistry.registerComponent(appName, () => App); |
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
Oops, something went wrong.