Skip to content

Commit c9d96d5

Browse files
committed
Move to reanimated 3 (#2593)
* Move to reanimated 3 * Improve wording
1 parent f112453 commit c9d96d5

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

android/app/src/main/java/com/rnuilib/MainApplication.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import com.reactnativenavigation.NavigationApplication;
1111
import com.reactnativenavigation.react.NavigationReactNativeHost;
1212
import com.wix.reactnativeuilib.UiLibPackageList;
13-
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
1413

1514
import java.util.List;
1615

@@ -23,11 +22,6 @@ protected String getJSMainModuleName() {
2322
return "demo";
2423
}
2524

26-
@Override
27-
protected JSIModulePackage getJSIModulePackage() {
28-
return new ReanimatedJSIModulePackage();
29-
}
30-
3125
@Override
3226
public boolean getUseDeveloperSupport() {
3327
return BuildConfig.DEBUG;

demo/src/screens/incubatorScreens/IncubatorToastScreen.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, {Component} from 'react';
22
import {ScrollView, StyleSheet} from 'react-native';
33
import {Assets, Colors, View, Button, Text, Incubator} from 'react-native-ui-lib';
44
import {renderMultipleSegmentOptions, renderBooleanOption, renderRadioGroup} from '../ExampleScreenPresenter';
5+
import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
56

67
const {Toast} = Incubator;
78

@@ -18,7 +19,8 @@ const TOAST_MESSAGES = {
1819
offline: 'Check Your Internet Connection'
1920
};
2021

21-
export default class ToastsScreen extends Component {
22+
// TODO: "ReactImageView: Image source "null" doesn't exist" (Android + preset "none")
23+
class ToastsScreen extends Component {
2224
showToast = false; // keep this state in class instance for immediate response
2325
state = {
2426
visible: false,
@@ -179,6 +181,8 @@ export default class ToastsScreen extends Component {
179181
}
180182
}
181183

184+
export default gestureHandlerRootHOC(ToastsScreen);
185+
182186
const styles = StyleSheet.create({
183187
scrollView: {
184188
paddingBottom: 80

demo/src/screens/incubatorScreens/TouchableOpacityScreen.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import React, {Component} from 'react';
22
import {TouchableOpacity} from 'react-native';
33
import {View, Text, Colors, Incubator} from 'react-native-ui-lib';
44

5+
// TODO: Android - multiple clicks on the example that allows long press button (maybe dragging is also involved) -->
6+
// long press on it --> sometimes the counter just start ticking up
7+
// (happens on 2.17.0 as well but more rare, with gestureHandlerRootHOC)
58
class TouchableOpacityScreen extends Component {
69
state = {
710
counter: 0,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"react-native-haptic-feedback": "^1.11.0",
112112
"react-native-linear-gradient": "2.6.2",
113113
"react-native-navigation": "7.32.1",
114-
"react-native-reanimated": "2.14.0",
114+
"react-native-reanimated": "3.1.0",
115115
"react-native-shimmer-placeholder": "^2.0.6",
116116
"react-native-svg": "^13.7.0",
117117
"react-native-svg-transformer": "^0.14.3",

src/components/sortableList/SortableListItem.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const animationConfig = {
2929
duration: 350
3030
};
3131

32+
// Reanimated 3 - Solving the following error:
33+
// ReanimatedError: Trying to access property `$backgroundDefault` of an object which cannot be sent to the UI runtime., js engine: reanimated
34+
const LIST_ITEM_BACKGROUND = Colors.$backgroundDefault;
35+
3236
const SortableListItem = (props: Props) => {
3337
const {children, index} = props;
3438

@@ -159,7 +163,7 @@ const SortableListItem = (props: Props) => {
159163
: defaultItemShadow.value;
160164

161165
return {
162-
backgroundColor: Colors.$backgroundDefault, // required for elevation to work in Android
166+
backgroundColor: LIST_ITEM_BACKGROUND, // required for elevation to work in Android
163167
zIndex,
164168
transform: [{translateY: translateY.value}, {scale}],
165169
opacity,

0 commit comments

Comments
 (0)