Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Android): Add backward compatibility for prefabs #2088

Merged
merged 3 commits into from
Apr 2, 2024

Conversation

piaskowyk
Copy link
Member

@piaskowyk piaskowyk commented Apr 2, 2024

Description

This PR fixes backward compatibility with React Native versions older than 0.71. The issue was caused by using prefabs in the screen transition animation feature. I added a check that makes this feature available since React Native 0.71

Tested against RN versions:

  • 0.68
  • 0.69
  • 0.70
  • 0.71
  • 0.73

Fixes #2082

@tboba tboba changed the title Fix backward compatibility with prefab fix(Android): Add backward compatibility for prefabs Apr 2, 2024
Comment on lines +183 to +187
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.fragment:fragment:1.3.6'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'com.google.android.material:material:1.9.0'
implementation 'com.google.android.material:material:1.6.1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed, because of the error while building a project: Can't determine type for tag '<macro name="m3_comp_assist_chip_container_shape">?attr/shapeAppearanceCornerSmall</macro>. Since we're not using any features from Material 3, it's more important to patch this (at least for now 😛).

Copy link
Member

@tboba tboba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎉

@tboba tboba requested a review from kkafar April 2, 2024 11:57
@tboba tboba merged commit f769cba into main Apr 2, 2024
4 checks passed
@tboba tboba deleted the @piaskowyk/prefab-backward-compatibility branch April 2, 2024 12:49
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this pull request Apr 4, 2024
This is step one toward zulip#5847.

We hold back react-native-screens at 3.29.0. That's because 3.30
breaks compatibility with RN v0.68 in a certain way, and although
the 3.31 release candidate addresses one source of that
incompatibility --
  software-mansion/react-native-screens#2088
-- there seems to be another. In particular, after the app starts up
on Android, I get errors:

  Error: Requiring module
    "node_modules/react-native-screens/src/index.tsx", which threw an
    exception: Error: Exception in HostObject::get(propName:RNSModule):
    java.lang.UnsatisfiedLinkError:
    dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.zulipmobile.debug-cCKhUjMGcecB6tGNtf5jiQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.zulipmobile.debug-cCKhUjMGcecB6tGNtf5jiQ==/lib/arm64, /data/app/com.zulipmobile.debug-cCKhUjMGcecB6tGNtf5jiQ==/base.apk!/lib/arm64-v8a, /system/lib64]]]
    couldn't find "librnscreens.so"

    […]

and

  TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[16], "react-native-screens").screensEnabled')

  This error is located at:
      in CardStack (at StackView.tsx:462)
      in KeyboardManager (at StackView.tsx:458)
      in SafeAreaProviderCompat (at StackView.tsx:455)
      in RNGestureHandlerRootView (at GestureHandlerRootView.android.tsx:22)
      in GestureHandlerRootView (at StackView.tsx:454)
      in StackView (at createStackNavigator.tsx:87)
      in StackNavigator (at AppNavigator.js:140)
      in AppNavigator (at ZulipNavigationContainer.js:65)
      in EnsureSingleNavigator (at BaseNavigationContainer.tsx:411)
      in BaseNavigationContainer (at NavigationContainer.tsx:91)
      in ThemeProvider (at NavigationContainer.tsx:90)
      in NavigationContainer (at ZulipNavigationContainer.js:58)
      in ZulipAppContainer (at ZulipMobile.js:83)

      […]

which I don't really understand but I suspect might require us to
adopt React Native's "Fabric" system which we don't want to bother
with for this legacy app.
gnprice pushed a commit to chrisbobbe/zulip-mobile that referenced this pull request Apr 4, 2024
This is step one toward zulip#5847.

We hold back react-native-screens at 3.29.0. That's because 3.30
breaks compatibility with RN v0.68 in a certain way, and although
the 3.31 release candidate addresses one source of that
incompatibility --
  software-mansion/react-native-screens#2088
-- there seems to be another. In particular, after the app starts up
on Android, I get errors:

  Error: Requiring module
    "node_modules/react-native-screens/src/index.tsx", which threw an
    exception: Error: Exception in HostObject::get(propName:RNSModule):
    java.lang.UnsatisfiedLinkError:
    dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.zulipmobile.debug-cCKhUjMGcecB6tGNtf5jiQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.zulipmobile.debug-cCKhUjMGcecB6tGNtf5jiQ==/lib/arm64, /data/app/com.zulipmobile.debug-cCKhUjMGcecB6tGNtf5jiQ==/base.apk!/lib/arm64-v8a, /system/lib64]]]
    couldn't find "librnscreens.so"

    […]

and

  TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[16], "react-native-screens").screensEnabled')

  This error is located at:
      in CardStack (at StackView.tsx:462)
      in KeyboardManager (at StackView.tsx:458)
      in SafeAreaProviderCompat (at StackView.tsx:455)
      in RNGestureHandlerRootView (at GestureHandlerRootView.android.tsx:22)
      in GestureHandlerRootView (at StackView.tsx:454)
      in StackView (at createStackNavigator.tsx:87)
      in StackNavigator (at AppNavigator.js:140)
      in AppNavigator (at ZulipNavigationContainer.js:65)
      in EnsureSingleNavigator (at BaseNavigationContainer.tsx:411)
      in BaseNavigationContainer (at NavigationContainer.tsx:91)
      in ThemeProvider (at NavigationContainer.tsx:90)
      in NavigationContainer (at ZulipNavigationContainer.js:58)
      in ZulipAppContainer (at ZulipMobile.js:83)

      […]

which I don't really understand but I suspect might require us to
adopt React Native's "Fabric" system which we don't want to bother
with for this legacy app.
@WoLewicki
Copy link
Member

Do we still need this code if we only support RN >= 71? https://github.com/software-mansion/react-native-screens#supported-react-native-version. cc @piaskowyk maybe we can revert some of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android Build Error - Execution failed for task ':react-native-screens:configureCMakeRelWithDebInfo'
3 participants