From 5e4578d8e8fbe60a17c5939b6baf78fd6b51cbe8 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Tue, 22 Jun 2021 11:03:26 +0900 Subject: [PATCH] trying reanimated 2 --- android/app/build.gradle | 2 +- .../main/java/com/subsonify/MainApplication.java | 10 ++++++++++ babel.config.js | 4 ++++ package-lock.json | 14 +++++++------- package.json | 2 +- src/components/common/TopTabBar.tsx | 4 ++-- src/components/library/AlbumsTab.tsx | 6 +++--- 7 files changed, 28 insertions(+), 14 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index dbf8d48..ac76c5f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -78,7 +78,7 @@ import com.android.build.OutputFile */ project.ext.react = [ - enableHermes: false, // clean and rebuild if changing + enableHermes: true, // clean and rebuild if changing ] apply from: "../../node_modules/react-native/react.gradle" diff --git a/android/app/src/main/java/com/subsonify/MainApplication.java b/android/app/src/main/java/com/subsonify/MainApplication.java index 281d8e1..2f22c97 100644 --- a/android/app/src/main/java/com/subsonify/MainApplication.java +++ b/android/app/src/main/java/com/subsonify/MainApplication.java @@ -12,6 +12,10 @@ import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; +// for reanimated +import com.facebook.react.bridge.JSIModulePackage; +import com.swmansion.reanimated.ReanimatedJSIModulePackage; + public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = @@ -34,6 +38,12 @@ public class MainApplication extends Application implements ReactApplication { protected String getJSMainModuleName() { return "index"; } + + // for reanimated + @Override + protected JSIModulePackage getJSIModulePackage() { + return new ReanimatedJSIModulePackage(); + } }; @Override diff --git a/babel.config.js b/babel.config.js index f842b77..d6be578 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,7 @@ module.exports = { presets: ['module:metro-react-native-babel-preset'], + plugins: [ + // reanimated has to be listed last in plugins + 'react-native-reanimated/plugin', + ], }; diff --git a/package-lock.json b/package-lock.json index 32bf1a5..7666b27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "react-native-gesture-handler": "^1.10.3", "react-native-get-random-values": "^1.7.0", "react-native-linear-gradient": "^2.5.6", - "react-native-reanimated": "^2.2.0", + "react-native-reanimated": "^2.0.0", "react-native-safe-area-context": "^3.2.0", "react-native-screens": "^3.4.0", "react-native-sqlite-storage": "^5.0.0", @@ -11539,9 +11539,9 @@ } }, "node_modules/react-native-reanimated": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.2.0.tgz", - "integrity": "sha512-lOJDd+5w1gY6DHGXG2jD1dsjzQmXQ2699HUc3IztvI2WP4zUT+UAA+zSG+5JiBS5DUnTL8YhhkmUQmr1KNGO5w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.0.0.tgz", + "integrity": "sha512-kIrdBoXSky7DQ62SOgosgimKM+Lt+SzAaM+ovVpCLBcwUK2aYRfLxa9ffgvKjeH9/n7dONlwEMjbKssGkuyq2Q==", "dependencies": { "@babel/plugin-transform-object-assign": "^7.10.4", "fbjs": "^3.0.0", @@ -23413,9 +23413,9 @@ "requires": {} }, "react-native-reanimated": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.2.0.tgz", - "integrity": "sha512-lOJDd+5w1gY6DHGXG2jD1dsjzQmXQ2699HUc3IztvI2WP4zUT+UAA+zSG+5JiBS5DUnTL8YhhkmUQmr1KNGO5w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-2.0.0.tgz", + "integrity": "sha512-kIrdBoXSky7DQ62SOgosgimKM+Lt+SzAaM+ovVpCLBcwUK2aYRfLxa9ffgvKjeH9/n7dONlwEMjbKssGkuyq2Q==", "requires": { "@babel/plugin-transform-object-assign": "^7.10.4", "fbjs": "^3.0.0", diff --git a/package.json b/package.json index 507cccb..4878d18 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "react-native-gesture-handler": "^1.10.3", "react-native-get-random-values": "^1.7.0", "react-native-linear-gradient": "^2.5.6", - "react-native-reanimated": "^2.2.0", + "react-native-reanimated": "^2.0.0", "react-native-safe-area-context": "^3.2.0", "react-native-screens": "^3.4.0", "react-native-sqlite-storage": "^5.0.0", diff --git a/src/components/common/TopTabBar.tsx b/src/components/common/TopTabBar.tsx index 5f0e105..dbb4172 100644 --- a/src/components/common/TopTabBar.tsx +++ b/src/components/common/TopTabBar.tsx @@ -9,8 +9,8 @@ const TopTabBar: React.FC = ({ state, descriptors }) => {state.routes.map((route, index) => { const { options } = descriptors[route.key]; diff --git a/src/components/library/AlbumsTab.tsx b/src/components/library/AlbumsTab.tsx index ffb9482..d8ba409 100644 --- a/src/components/library/AlbumsTab.tsx +++ b/src/components/library/AlbumsTab.tsx @@ -57,7 +57,7 @@ const AlbumItem: React.FC<{ id: string } > = ({ id }) => { // console.log(album.name); // }); - const size = 180; + const size = 125; return ( = ({ id }) => { marginVertical: 10, // marginLeft: 6, // width: size, - flex: 1/2, + flex: 1/3, }}> { keyExtractor={item => item} onRefresh={refresh} refreshing={refreshing} - numColumns={2} + numColumns={3} removeClippedSubviews={false} />