Skip to content

Commit 4ada9df

Browse files
committed
chore: add expo-based playground
1 parent 6addc91 commit 4ada9df

12 files changed

+165
-0
lines changed

playground/.gitignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2+
3+
# dependencies
4+
node_modules/
5+
6+
# Expo
7+
.expo/
8+
dist/
9+
web-build/
10+
11+
# Native
12+
*.orig.*
13+
*.jks
14+
*.p8
15+
*.p12
16+
*.key
17+
*.mobileprovision
18+
19+
# Metro
20+
.metro-health-check*
21+
22+
# debug
23+
npm-debug.*
24+
yarn-debug.*
25+
yarn-error.*
26+
27+
# macOS
28+
.DS_Store
29+
*.pem
30+
31+
# local env files
32+
.env*.local
33+
34+
# typescript
35+
*.tsbuildinfo

playground/App.js

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* eslint-disable react-native/no-inline-styles */
2+
/**
3+
* Sample React Native App
4+
* https://github.com/facebook/react-native
5+
*
6+
* @format
7+
* @flow strict-local
8+
*/
9+
10+
import React from 'react';
11+
import {
12+
SafeAreaView,
13+
StatusBar,
14+
Text,
15+
useColorScheme,
16+
View,
17+
Image,
18+
StyleSheet,
19+
} from 'react-native';
20+
21+
const App = () => {
22+
const isDarkMode = useColorScheme() === 'dark';
23+
24+
return (
25+
<SafeAreaView style={{ flex: 1, backgroundColor: '#ddd' }}>
26+
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
27+
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
28+
<Image
29+
source={require('./assets/original_panda.png')}
30+
style={styles.img}
31+
/>
32+
<Text style={{ marginTop: 5 }}>
33+
Original transparent PNG&nbsp;
34+
<Text style={{ fontWeight: 'bold', color: 'red' }}>57KB</Text>
35+
</Text>
36+
<View style={{ height: 20 }} />
37+
<Image
38+
source={require('./assets/shrunk_panda.png')}
39+
style={styles.img}
40+
/>
41+
<Text style={{ marginTop: 5 }}>
42+
Shrunk transparent PNG&nbsp;
43+
<Text style={{ fontWeight: 'bold', color: 'red' }}>16KB</Text>
44+
</Text>
45+
</View>
46+
</SafeAreaView>
47+
);
48+
};
49+
50+
const styles = StyleSheet.create({
51+
img: {
52+
borderWidth: 5,
53+
borderColor: '#fff',
54+
width: 180,
55+
height: 180,
56+
}
57+
})
58+
59+
export default App;

playground/app.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"expo": {
3+
"name": "playground",
4+
"slug": "playground",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"splash": {
10+
"image": "./assets/splash.png",
11+
"resizeMode": "contain",
12+
"backgroundColor": "#ffffff"
13+
},
14+
"assetBundlePatterns": [
15+
"**/*"
16+
],
17+
"ios": {
18+
"supportsTablet": true
19+
},
20+
"android": {
21+
"adaptiveIcon": {
22+
"foregroundImage": "./assets/adaptive-icon.png",
23+
"backgroundColor": "#ffffff"
24+
}
25+
},
26+
"web": {
27+
"favicon": "./assets/favicon.png"
28+
}
29+
}
30+
}

playground/assets/adaptive-icon.png

17.1 KB
Loading

playground/assets/favicon.png

1.43 KB
Loading

playground/assets/icon.png

21.9 KB
Loading

playground/assets/original_panda.png

55.6 KB
Loading

playground/assets/shrunk_panda.png

15.5 KB
Loading

playground/assets/splash.png

46.2 KB
Loading

playground/babel.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function(api) {
2+
api.cache(true);
3+
return {
4+
presets: ['babel-preset-expo'],
5+
};
6+
};

playground/metro.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Learn more https://docs.expo.io/guides/customizing-metro
2+
const { getDefaultConfig } = require('expo/metro-config');
3+
4+
/** @type {import('expo/metro-config').MetroConfig} */
5+
const config = getDefaultConfig(__dirname);
6+
7+
// use plugin to compress assets
8+
config.transformer.assetPlugins.push('react-native-imagemin-asset-plugin')
9+
10+
module.exports = config;

playground/package.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "playground",
3+
"version": "1.0.0",
4+
"main": "node_modules/expo/AppEntry.js",
5+
"scripts": {
6+
"start": "expo start",
7+
"android": "expo start --android",
8+
"ios": "expo start --ios",
9+
"web": "expo start --web"
10+
},
11+
"dependencies": {
12+
"@expo/webpack-config": "^19.0.0",
13+
"expo": "~49.0.13",
14+
"expo-status-bar": "~1.6.0",
15+
"react": "18.2.0",
16+
"react-dom": "18.2.0",
17+
"react-native": "0.72.5",
18+
"react-native-imagemin-asset-plugin": "file:..",
19+
"react-native-web": "~0.19.6"
20+
},
21+
"devDependencies": {
22+
"@babel/core": "^7.20.0"
23+
},
24+
"private": true
25+
}

0 commit comments

Comments
 (0)