Conversation with Merlin [email protected] · Fri Dec 08 2023

actully i have created a react app it works well on my old phone all scrolltrigger animations smooth scroll and other framer motion animation works correct with a 2% of lag it works well on my pc and laptop also no crashing but the problem is when i tried to use it on 120HZ display mobile after 10 seconds of scroll all svgs of my website crashing means svg crossing layouts it looks double and triple i am using svg preserve aspect none but i dont tjink it will create problem not all svgs are crashing only fews are crashing what to do

Rendering issues on a device with a 120Hz display that don't appear devices with lower refresh rates or on other platforms could be related a few different factors. Here's a plan to diagnose and potentially solve the problem:

  1. Performance Profile: Use the performance profiling tools available in browsers like Chrome or Firefox, or React DevTools, to see if are any performance bottlenecks in your application.

  2. Hardware Acceleration: High refresh-rate displays can sometimes bring issues to light that weren't apparent on lower refresh-rate screens, such as a lack of hardware acceleration. Check if enabling hardware acceleration for your SVGs improves the. You can apply a CSS rule like transform: translateZ0) to the element to hint at the browser to use GPU acceleration.

  3. **Optimize SVG It's possible that the SVGs themselves are not optimized and causing performance issues, which become more visible on high-refresh displays. Use a tool like SVGO to optimize SVG files.

  4. React and Libraries: Ensure that you're using the latest versions of React and any libraries you are using. Updates often contain performance improvements and bug fixes which may resolve the issues on newer devices.

  5. SVG Rendering: If are using a library like react-native-svg for handling SVGs, sure it is up-to-date and that there are no known issues with high-refresh rate displays.

  6. Preserve Aspect Ratio: While preserveAspectRatio="none" is the direct cause of the problem, rendering issues could occur if the aspect ratio of your SVGs changes as you scroll.

  7. Event Handling: Check how scroll events are being handled. It might be that continuous rerendering on scroll is causing problems. Debouncing scroll events or using requestAnimationFrame might ease the performance issues.

  8. ScrollTrigger and Framer Motion: If you're using third-party libraries like Framer Motion and GSAP's ScrollTrigger, check for compatibility issues with high refresh-rate displays and look up if there any recommended settings that can help you optimize for such displays.

  9. Test Across Devices: Test the app on various devices similar specs to see if the issue is isolated to one device consistent across all with a 120Hz display.

  10. Check SVG Attributes: Look for any specific attributes in your SVG that may contribute to the issue (like large viewboxes or excessive details) and simplify them if possible.

  11. CSS Overlap Bug: Check your CSS to ensure there are no issues causing overlapping or duplicating visuals. It could be a z-index issue or CSS layering problem.

  12. Web Technologies: Verify no outdated web technologies are used that might not be fully compatible with high refresh-rate screens. Consider the use of modern layout techniques like CSS Grid or Flexbox if not already implemented.

  13. Debugging Tools: Use the Chrome DevTools or Safari’s Web Inspector to inspect the problematic SVG elements they begin to "crash" and see if any properties are changing, or if any errors are thrown in the console.

If you're still experiencing issues after following these steps, consider seeking help from community forums or the libraries' maintainers directly, providing them with detailed information the issue and steps to reproduce.

I've created a library with custom buttons. Button folder contains 24 svg files. From project I pass a text, a function and icon, but when try to render the icon crash and show me next error: index.js:1 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. I dont know why dont render the images, please can someone help me? Here is my code: import React from "react"; import PropTypes from "prop-types"; import { ReactComponent as ArrowIcon } from './arrow_icon.svg'; import { ReactComponent as ArrowRight } from './arrow_right_icon.svg'; import { ReactComponent as ArrowIcon2 } from './arrow2_icon.svg'; import { ReactComponent as BellPlusIcon } from './bell_plus_icon.svg'; import { ReactComponent as ChartIcon } from './chart_icon.svg'; import { ReactComponent as ChartLineSolidIcon } from './chart_line_solid_icon.svg'; import { ReactComponent as CloseIcon } from './close_icon.svg'; import { ReactComponent as CogIcon } from './cog_icon.svg'; import { ReactComponent as DeleteIcon } from './delete_icon.svg'; import { ReactComponent as DownloadIcon } from './download_icon.svg'; import { ReactComponent as EarsIcon } from './ears_icon.svg'; import { ReactComponent as EditIcon } from './edit_icon.svg'; import { ReactComponent as ExportIcon } from './export_icon.svg'; import { ReactComponent as FilterIcon } from './filter_icon.svg'; import { ReactComponent as LocationIcon } from './location_icon.svg'; import { ReactComponent as LogoutIcon } from './logout_icon.svg'; import { ReactComponent as MapIcon } from './map_icon.svg'; import { ReactComponent as PlusIcon } from './plus_icon.svg'; import { ReactComponent as ServerIcon } from './server_icon.svg'; import { ReactComponent as TagIcon } from './tag_icon.svg'; import { ReactComponent as TiresiasIcon } from './tiresias_icon.svg'; import { ReactComponent as UsersCogIcon } from './users_cog_icon.svg'; import { ReactComponent as VGeneralIcon } from './vgeneral_icon.svg'; import 'bootstrap/dist/css/bootstrap.css'; import 'react-spinkit/css/three-bounce.css'; import './go-button.scss'; class Button extends React.PureComponent { handleClick = (e) => { e.stopPropagation(); this.props.clickButton(); } getIcon = (nameIcon) => { switch(nameIcon.toLowerCase()) { case 'arrow': return <ArrowIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'arrow_right': return <ArrowRight style={{ display: 'inline' }} className={"go-button__icon"} />; case 'arrow2': return <ArrowIcon2 style={{ display: 'inline' }} className={"go-button__icon"} />; case 'bell-plus': return <BellPlusIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'chart': return <ChartIcon style={{ display: 'inline' }} className={"go-button__icon"} /> case 'chart-line-solid': return <ChartLineSolidIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'close': return <CloseIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'cog': return <CogIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'delete': return <DeleteIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'download': return <DownloadIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'ears': return <EarsIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'edit': return <EditIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'export': return <ExportIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'filter': return <FilterIcon style={{ display: 'inline' }} className={"go-button__icon"} /> case 'location': return <LocationIcon style={{ display: 'inline' }} className={"go-button__icon"} />; case 'logout': return <LogoutIcon style={{ display: 'inl

stackoverflow.com

Bug Hello, When I run the application with react-native run-android everything goes well, but when I try to generate an apk for testing as soon as I open some screen with the SVG (that contains the fill property) it crashes. I ran it with the adb logcat and this is the error message Im getting: E/AndroidRuntime( 5567): java.lang.IllegalStateException: java.lang.NoSuchFieldException: fill E/AndroidRuntime( 5567): at com.horcrux.svg.t.a(Unknown Source) E/AndroidRuntime( 5567): at com.horcrux.svg.j.b(Unknown Source) E/AndroidRuntime( 5567): at com.horcrux.svg.j.a(Unknown Source) E/AndroidRuntime( 5567): at com.horcrux.svg.t.d(Unknown Source) E/AndroidRuntime( 5567): at com.horcrux.svg.x.a(Unknown Source) E/AndroidRuntime( 5567): at com.horcrux.svg.x.j(Unknown Source) E/AndroidRuntime( 5567): at com.horcrux.svg.x.onDraw(Unknown Source) Environment info React native info output: React Native Environment Info: System: OS: Linux 5.0 Ubuntu 19.04 (Disco Dingo) CPU: (4) x64 Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz Memory: 133.89 MB / 7.70 GB Shell: 5.5.1 - /usr/bin/zsh Binaries: Node: 10.15.2 - /usr/bin/node npm: 6.10.1 - /usr/local/bin/npm SDKs: Android SDK: API Levels: 23, 28, 29 Build Tools: 28.0.3, 29.0.0 System Images: android-21 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.10 => 0.59.10 npmGlobalPackages: react-native-cli: 2.0.1 Library version: 9.5.3 I initially installed the version 9.5.1, and upgraded to try to solve this problem but it didnt Steps To Reproduce Generate an apk with assembleRelease Open the app Describe what you expected to happen: Run without crashing Reproducible sample code This is the SVG making the app crash (if I remove the fill prop and build my apk it runs normally) <Svg fill="#f09e3e" height="64px" viewBox="-4 0 480 480.00003" width="64px"> <Path d="m184 288h16v16h-16zm0 0" /> <Path d="m136 288h16v16h-16zm0 0" /> <Path d="m88 288h16v16h-16zm0 0" /> <Path d="m232 288h16v16h-16zm0 0" /> <Path d="m224 160h16.574219l4.25 56.601562 15.953125-1.203124-4.152344-55.398438h174.75l-22.800781 304h-56.574219v16h64c4.195312.011719 7.683594-3.21875 8-7.398438l23.425781-312.601562h16.574219c4.417969 0 8-3.582031 8-8v-40c0-4.417969-3.582031-8-8-8h-96v-96c0-4.417969-3.582031-8-8-8h-32c-4.417969 0-8 3.582031-8 8v96h-96c-4.417969 0-8 3.582031-8 8v40c0 4.417969 3.582031 8 8 8zm112-144h16v88h-16zm-104 104h224v24h-224zm0 0" /> <Path d="m40 480h256c22.082031-.027344 39.972656-17.917969 40-40v-32c0-4.417969-3.582031-8-8-8h-.207031c10.941406-14.128906 10.941406-33.871094 0-48h.207031c4.417969 0 8-3.582031 8-8 .011719-31.625-12.503906-61.972656-34.808594-84.390625l-2.917968-44.136719-16 1.054688 1.910156 28.863281c-20.007813-13.929687-43.804688-21.394531-68.183594-21.390625h-96c-66.242188.074219-119.9257812 53.757812-120 120 0 4.417969 3.582031 8 8 8h.207031c-10.941406 14.128906-10.941406 33.871094 0 48h-.207031c-4.417969 0-8 3.582031-8 8v32c.0273438 22.082031 17.917969 39.972656 40 40zm280-40c0 13.253906-10.746094 24-24 24h-256c-13.253906 0-24-10.746094-24-24v-24h304zm-79.398438-40 63.796876-46.398438c10.875 4.042969 17.285156 15.296876 15.21875 26.714844-2.066407 11.414063-12.015626 19.707032-23.617188 19.683594zm-24.800781-1.742188-69.402343-46.257812h133zm-95.800781-158.257812h96c54.3125.0625 99.453125 41.855469 103.695312 96h-303.390624c4.242187-54.144531 49.386718-95.9375 103.695312-96zm-104 136c0-13.253906 10.746094-24 24-24h77.601562l72 48h-149.601562c-13.253906 0-24-10.746094-24-24zm0 0" /> <Path d="m208 256h16v16h-16zm0 0" /> <Path d="m160 256h16v16h-16zm0 0" /> <Path d="m112 256h16v16h-16zm0 0" /> <Path d="m280.019531 184.566406 15.960938-1.140625 1.144531 16-15.960938 1.140625zm0 0" /> </Svg>

lightrun.com

Bug After update from react-native-svg 12.1.0 to 13.0.0 I have a crash on android with the following stack trace java_vm_ext.cc:577] JNI DETECTED ERROR IN APPLICATION: JNI GetObjectRefType called with pending exception java.lang.RuntimeException: Exception in HostFunction: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String java_vm_ext.cc:577] java_vm_ext.cc:577] [native code] java_vm_ext.cc:577] /Users/mlecoq/issues/reactNativeSvg13/node_modules/react-native-reanimated/src/reanimated2/UpdateProps.ts (46:26):1:267 java_vm_ext.cc:577] forEach@[native code] java_vm_ext.cc:577] _f@/Users/mlecoq/issues/reactNativeSvg13/node_modules/react-native-reanimated/src/reanimated2/UpdateProps.ts (46:26):1:229 java_vm_ext.cc:577] [native code] java_vm_ext.cc:577] styleUpdater@/Users/mlecoq/issues/reactNativeSvg13/node_modules/react-native-reanimated/src/reanimated2/hook/useAnimatedStyle.ts (185:0):1:1810 Unexpected behavior Crash occurs since 13.0.0 Environment info Run react-native info in your terminal and copy the results here. Also, include the precise version number of this library that you are using in the project React native info output: System: OS: macOS 12.5.1 CPU: (10) arm64 Apple M1 Pro Memory: 105.06 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.13.1 - /var/folders/md/1qkynwbs1216d57grkbc682h0000gn/T/fnm_multishells/19554_1661241167202/bin/node Yarn: 1.22.15 - /var/folders/md/1qkynwbs1216d57grkbc682h0000gn/T/fnm_multishells/19554_1661241167202/bin/yarn npm: 8.1.2 - /var/folders/md/1qkynwbs1216d57grkbc682h0000gn/T/fnm_multishells/19554_1661241167202/bin/npm Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7935034 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.13 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.4 => 0.69.4 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found Library version: 13.0.0 Steps To Reproduce Issues without reproduction steps or code are likely to stall. git clone https://github.com/mlecoq/reactNativeSvg13 cd reactNativeSvg13 yarn yarn android The project crashes at startup (no crash with 12.1.0)

lightrun.com