Skip to content

Commit c24cd12

Browse files
committed
Pixel Shape RN: code
1 parent fcd1051 commit c24cd12

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

App.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import WebglCubeMapsScreen from './app/components/WebglCubeMaps';
2222
import PixiScreen from './app/components/Pixi';
2323
import DragNDropScreen from './src/dragNdrop';
2424
import NonDeclarativeScreen from './src/nonDeclarative';
25+
import PixelShapeRNScreen from './app/components/PixelShapeRNScreen';
2526

2627
if (Platform.OS !== 'web') {
2728
require('react-native').LogBox.ignoreLogs([
@@ -77,6 +78,10 @@ function HomeScreen({navigation}) {
7778
title="babylonjs Non-Declarative"
7879
onPress={() => navigation.navigate('NonDeclarative')}
7980
/>
81+
<Button
82+
title="Pixel Shape RN"
83+
onPress={() => navigation.navigate('PixelShapeRN')}
84+
/>
8085
</View>
8186
);
8287
}
@@ -153,6 +158,11 @@ function App(): JSX.Element {
153158
component={NonDeclarativeScreen}
154159
options={{title: 'Non-Declarative'}}
155160
/>
161+
<Stack.Screen
162+
name="PixelShapeRN"
163+
component={PixelShapeRNScreen}
164+
options={{title: 'Pixel Shape RN'}}
165+
/>
156166
</Stack.Navigator>
157167
</NavigationContainer>
158168
);

android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<uses-permission android:name="android.permission.INTERNET" />
44
<uses-permission android:name="android.permission.RECORD_AUDIO" />
5+
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
56

67
<application
78
android:name=".MainApplication"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React, {Component} from 'react';
2+
import {Platform, StyleSheet, View} from 'react-native';
3+
import ManageExternalStorage from 'react-native-external-storage-permission';
4+
if (Platform.OS !== 'web') {
5+
var {PERMISSIONS, request} = require('react-native-permissions').default;
6+
}
7+
import PixelShapeRN from 'pixelshapern/src/index';
8+
import {PixelShapeContext} from 'pixelshapern/src/context';
9+
10+
export default class PixelShapeRNScreen extends Component {
11+
componentDidMount() {
12+
if (Platform.OS === 'android') {
13+
ManageExternalStorage.checkAndGrantPermission().then(granted => {
14+
if (!granted) {
15+
console.warn('NoStoragePermissionCanNotSaveOrLoadGifFile');
16+
}
17+
});
18+
}
19+
20+
if (Platform.OS === 'ios') {
21+
request(
22+
Platform.select({
23+
ios: PERMISSIONS.IOS.PHOTO_LIBRARY,
24+
}),
25+
).then(response => {
26+
if (response !== 'granted') {
27+
console.warn('NoStoragePermissionCanNotSaveOrLoadGifFile');
28+
}
29+
});
30+
}
31+
}
32+
33+
render() {
34+
return (
35+
<View style={styles.container}>
36+
<PixelShapeContext.Provider value={{}}>
37+
<PixelShapeRN />
38+
</PixelShapeContext.Provider>
39+
</View>
40+
);
41+
}
42+
}
43+
44+
const styles = StyleSheet.create({
45+
container: {
46+
flex: 1,
47+
justifyContent: 'center',
48+
alignItems: 'center',
49+
backgroundColor: '#F5FCFF',
50+
},
51+
});

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@babylonjs/loaders": "5.1.0",
3131
"@flyskywhy/react-native-gcanvas": "6.0.15",
3232
"@githubprimer/octicons-react": "^8.5.0",
33+
"@react-native-community/slider": "4.2.0",
3334
"@react-navigation/native": "^6.0.10",
3435
"@react-navigation/native-stack": "6.6.2",
3536
"@testing-library/jest-dom": "^4.2.4",
@@ -42,20 +43,25 @@
4243
"intl": "1.2.5",
4344
"m4.js": "^1.0.0",
4445
"modal-enhanced-react-native-web": "^0.2.0",
46+
"pixelshapern": "2.0.14",
4547
"pixi.js": "7.1.1",
4648
"pixi.js-legacy": "7.1.1",
4749
"react": "18.2.0",
4850
"react-babylonjs": "3.1.2",
4951
"react-dom": "18.2.0",
5052
"react-native": "0.71.6",
5153
"react-native-babylonjs": "1.1.2",
54+
"react-native-blob-util": "0.19.11",
55+
"react-native-external-storage-permission": "1.0.0",
56+
"react-native-fast-image": "8.5.11",
5257
"react-native-font-picker": "1.0.0",
5358
"react-native-fs": "^2.18.0",
5459
"react-native-get-asset": "1.0.0",
5560
"react-native-live-audio-fft": "1.3.0",
5661
"react-native-permissions": "3.10.1",
5762
"react-native-safe-area-context": "3.4.1",
5863
"react-native-screens": "3.20.0",
64+
"react-native-system-file-browser": "1.1.0",
5965
"react-native-web": "^0.17.5",
6066
"react-prism": "^4.3.2",
6167
"react-reconciler": "^0.25.1",

0 commit comments

Comments
 (0)