The previous PR introduced a fix for React Native 0.76 compatibility but inadvertently broke support for earlier React Native versions https://github.com/react-native-menu/menu/pull/941. This PR restructures the Android implementation to support multiple versions of React Native by providing separate Kotlin class implementations based on the React Native version in use.
Main changes:
Version-Specific Implementations: Added a new folder, android/src/reactNativeVersionPatch, to store version-specific implementations of classes, ensuring compatibility across different React Native versions.
Gradle Build Updates: Updated build.gradle to import the files from reactNativeVersionPatch, streamlining the integration of version-dependent classes.
MenuViewManager Refactor: Refactored MenuViewManager into an abstract class that now delegates to MenuViewManagerBase. This refactor enables importing the appropriate MenuViewManager based on the current React Native version.
Documentation Update: Revised CONTRIBUTING.md to outline the compatibility approach for version 0.76. The guide now suggests converting existing classes to abstract and implementing them for both 0.75 and the latest version. The naming convention used here (75 for the stable codebase supporting versions <0.76 and latest for versions >=0.76) can be adjusted as needed.
Overview
Summary
The previous PR introduced a fix for React Native 0.76 compatibility but inadvertently broke support for earlier React Native versions https://github.com/react-native-menu/menu/pull/941. This PR restructures the Android implementation to support multiple versions of React Native by providing separate Kotlin class implementations based on the React Native version in use.
Main changes:
android/src/reactNativeVersionPatch
, to store version-specific implementations of classes, ensuring compatibility across different React Native versions.build.gradle
to import the files fromreactNativeVersionPatch
, streamlining the integration of version-dependent classes.MenuViewManager
into an abstract class that now delegates toMenuViewManagerBase
. This refactor enables importing the appropriateMenuViewManager
based on the current React Native version.CONTRIBUTING.md
to outline the compatibility approach for version 0.76. The guide now suggests converting existing classes to abstract and implementing them for both 0.75 and the latest version. The naming convention used here (75 for the stable codebase supporting versions <0.76 and latest for versions >=0.76) can be adjusted as needed.view.hitSlopRect
with the setterview.setHitSlopRect
to prevent the "Val cannot be reassigned" error. https://github.com/react-native-menu/menu/pull/942