Files
biiproject-kit-v1/mobile/scripts/apply-patches.sh
T

28 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# apply-patches.sh - Manual patch script for react-native-reanimated RN 0.81 compatibility
set -e
REANIMATED_DIR="node_modules/react-native-reanimated"
echo "Applying patches for react-native-reanimated..."
# --- Patch 1: ReanimatedPackage.java ---
REANIMATED_PKG="$REANIMATED_DIR/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java"
if grep -q "Systrace\.TRACE_TAG_REACT_JAVA_BRIDGE" "$REANIMATED_PKG" 2>/dev/null; then
sed -i 's/Systrace\.beginSection(Systrace\.TRACE_TAG_REACT_JAVA_BRIDGE,/Systrace.beginSection(0,/g' "$REANIMATED_PKG"
sed -i 's/Systrace\.endSection(Systrace\.TRACE_TAG_REACT_JAVA_BRIDGE)/Systrace.endSection(0)/g' "$REANIMATED_PKG"
echo "✅ Patched ReanimatedPackage.java (TRACE_TAG_REACT_JAVA_BRIDGE)"
fi
# --- Patch 2: BorderRadiiDrawableUtils.java ---
BORDER_UTIL="$REANIMATED_DIR/android/src/reactNativeVersionPatch/BorderRadiiDrawableUtils/latest/com/swmansion/reanimated/BorderRadiiDrawableUtils.java"
if grep -q "resolve(bounds.width(), bounds.height()).toPixelFromDIP().getHorizontal()" "$BORDER_UTIL" 2>/dev/null; then
sed -i 's/return length\.resolve(bounds\.width(), bounds\.height())\.toPixelFromDIP()\.getHorizontal();/return length.resolve((float) bounds.width());/g' "$BORDER_UTIL"
echo "✅ Patched BorderRadiiDrawableUtils.java (LengthPercentage.resolve)"
fi
# Note: TSX patches are handled separately or via more precise tools to avoid corruption.
echo "All native patches applied successfully!"