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

Unexpected XML comments removal and code prettification #631

Open
3 tasks done
demedos opened this issue Sep 23, 2024 · 7 comments
Open
3 tasks done

Unexpected XML comments removal and code prettification #631

demedos opened this issue Sep 23, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@demedos
Copy link

demedos commented Sep 23, 2024

Before submitting a new issue

  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

Hi, first of all, thanks for all the hard work on this package! 🙌

I'm currently upgrading from version 4 to version 6 and noticed a few issues that might be worth addressing:

  1. XML Comments Removal:
    After the upgrade, I saw that comments in my XML files are being removed. This feels like a breaking change as it modifies the code beyond the expected scope of this package. It can potentially cause issues, especially for builds that rely on tools like Plop or custom scripts, which use comments as anchors to auto-generate content in specific parts of the code.

  2. Code Prettification:
    The code is being automatically prettified, which generates unnecessary and often unwanted diffs. This is a bit unexpected since the package should ideally only modify the parts of the code it needs to.

  3. Question about Assets:
    One thing I'm still trying to understand is, when generating for iOS and Android, what’s the reason for generating the assets/bootsplash files? Maybe I’m missing something obvious here! 😅

Thanks again for your time and help! Would love to get some clarity or improvements around this. 😊

Library version

6.1.x

Environment info

System:
  OS: macOS 14.6.1
  CPU: (12) arm64 Apple M2 Pro
  Memory: 358.36 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.17.0
    path: /var/folders/03/y0ddfp013tng9zsw9_vbv15m0000gn/T/yarn--1727080227664-0.5818209195347468/node
  Yarn:
    version: 1.22.21
    path: /var/folders/03/y0ddfp013tng9zsw9_vbv15m0000gn/T/yarn--1727080227664-0.5818209195347468/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v20.17.0/bin/npm
  Watchman:
    version: 2024.08.19.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/<username>/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 3.2.1
    path: /Users/<username>/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.9
    wanted: 0.73.9
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to reproduce

Steps to reproduce:

  1. Before the upgrade (v4.5.2):

    • XML comments were retained in the files, preserving any annotations.
    • The package only modified the exact portions of the code it needed to, without affecting formatting.
    • No extra assets/bootsplash files were generated.
  2. After the upgrade (v6.1.x):

    • XML comments are now removed, which can break workflows relying on comments as anchors.
    • The code is being prettified automatically, causing unwanted diffs, in sections of code that weren’t modified by the package.
    • Extra assets/bootsplash files are generated for both iOS and Android.

Reproducible sample code

react-native generate-bootsplash image.jpg
@demedos demedos added the bug Something isn't working label Sep 23, 2024
@zoontek
Copy link
Owner

zoontek commented Sep 23, 2024

Because react-native-bootsplash now uses @expo/config-plugins instead of a custom RegExp based implementation.

The issue is in the expo package, you should open an issue on their repository instead.

For the 3., see #629

@gustavoabel

This comment has been minimized.

@zoontek

This comment has been minimized.

@gustavoabel

This comment has been minimized.

@zoontek

This comment has been minimized.

@gustavoabel

This comment has been minimized.

@johanbv
Copy link

johanbv commented Dec 12, 2024

An issue that I found related to this is that android:taskAffinity="" results in android:taskAffinity after running the CLI command.

Original entry on the Manifest file:

<activity
      android:name=".MainActivity"
      android:label="@string/app_name"
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
      android:launchMode="singleTask"
      android:windowSoftInputMode="adjustPan"
      android:screenOrientation="portrait"
      android:taskAffinity=""
      android:exported="true"
      android:theme="@style/BootTheme">

Result after command:

    <activity
      android:name=".MainActivity"
      android:label="@string/app_name"
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
      android:launchMode="singleTask"
      android:windowSoftInputMode="adjustPan"
      android:screenOrientation="portrait"
      android:taskAffinity
      android:exported="true"
      android:theme="@style/BootTheme">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants