Skip to content

Commit de0e75d

Browse files
committed
add react-strict-animated example app
This diff adds an example app showing off how to use the react-strict-animated library in an expo app. Currently when the app renders on the web there are some animation issues but the API calls are correct and I'll be addressing the composite animation issues in a later diff.
1 parent 7157a02 commit de0e75d

25 files changed

Lines changed: 1390 additions & 63 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.cache
2+
.expo
23
.next
34
build
45
coverage

apps/animated-example/app.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"expo": {
3+
"name": "animated-example",
4+
"slug": "animated-example",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"newArchEnabled": true,
10+
"splash": {
11+
"image": "./assets/splash.png",
12+
"resizeMode": "contain",
13+
"backgroundColor": "#1a1a2e"
14+
},
15+
"assetBundlePatterns": [
16+
"**/*"
17+
],
18+
"android": {
19+
"adaptiveIcon": {
20+
"foregroundImage": "./assets/adaptive-icon.png",
21+
"backgroundColor": "#ffffff"
22+
}
23+
},
24+
"ios": {
25+
"supportsTablet": true,
26+
"bundleIdentifier": "com.anonymous.animated-example"
27+
},
28+
"web": {
29+
"bundler": "metro",
30+
"favicon": "./assets/favicon.png"
31+
}
32+
}
33+
}
17.1 KB
Loading
1.43 KB
Loading
21.9 KB
Loading
46.2 KB
Loading
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
const reactStrictPreset = require('react-strict-dom/babel-preset');
9+
10+
function getPlatform(caller) {
11+
return caller && caller.platform;
12+
}
13+
14+
function getIsDev(caller) {
15+
if (caller?.isDev != null) return caller.isDev;
16+
// https://babeljs.io/docs/options#envname
17+
return (
18+
process.env.BABEL_ENV === 'development' ||
19+
process.env.NODE_ENV === 'development'
20+
);
21+
}
22+
23+
module.exports = function (api) {
24+
//api.cache(true);
25+
26+
const platform = api.caller(getPlatform);
27+
const dev = api.caller(getIsDev);
28+
29+
const plugins = [];
30+
const presets = [
31+
'babel-preset-expo',
32+
[reactStrictPreset, { debug: true, dev, platform }]
33+
];
34+
35+
return {
36+
plugins,
37+
presets
38+
};
39+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// Learn more https://docs.expo.dev/guides/monorepos
9+
const { getDefaultConfig } = require('expo/metro-config');
10+
11+
// Find the project and workspace directories
12+
const projectRoot = __dirname;
13+
14+
const config = getDefaultConfig(projectRoot);
15+
16+
module.exports = config;

apps/animated-example/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"private": true,
3+
"name": "animated-example",
4+
"version": "0.0.1",
5+
"main": "./src/app/index.js",
6+
"scripts": {
7+
"dev": "expo start --clear",
8+
"dev:android": "expo start --android --clear",
9+
"dev:ios": "expo start --ios --clear",
10+
"dev:web": "expo start --web --clear",
11+
"android": "expo run:android",
12+
"ios": "expo run:ios"
13+
},
14+
"dependencies": {
15+
"@expo/metro-runtime": "~5.0.4",
16+
"expo": "^53.0.11",
17+
"expo-build-properties": "~0.14.6",
18+
"expo-status-bar": "~2.2.3",
19+
"react": "~19.0.0",
20+
"react-dom": "~19.0.0",
21+
"react-native": "~0.79.5",
22+
"react-native-web": "~0.20.0",
23+
"react-strict-dom": "0.0.54",
24+
"react-strict-animated": "0.0.55",
25+
"react-native-safe-area-context": "5.4.0"
26+
},
27+
"devDependencies": {
28+
"@babel/core": "^7.27.3"
29+
}
30+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
module.exports = {
9+
plugins: [
10+
require('react-strict-dom/postcss-plugin')({
11+
include: [
12+
'src/**/*.{js,jsx,mjs,ts,tsx}',
13+
'../../node_modules/example-ui/**/*.jsx',
14+
'../../node_modules/react-strict-animated/**/*.js'
15+
]
16+
}),
17+
require('autoprefixer')
18+
]
19+
};

0 commit comments

Comments
 (0)