ExceptionsManager.js:126 RCTJSONStringify() encountered the following error: Floating point values must be finite. JSON does not support NaN or Infinity.
See original GitHub issueBug report
Summary
When I use react-native-viewpager
, debug mode show ExceptionsManager.js:126 RCTJSONStringify() encountered the following error: Floating point values must be finite. JSON does not support NaN or Infinity.
, Everything’s fine when I’m not using it.
Environment info
react-native info
output:
System:
OS: macOS Mojave 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 21.93 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 13.12.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6514223
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-git-upgrade: 0.2.7
Library version: 4.1.0
Steps to reproduce
import ViewPager from '@react-native-community/viewpager';
- open Debugging
- render ViewPager
Describe what you expected to happen:
When I use react-native-viewpager
, debug mode show ExceptionsManager.js:126 RCTJSONStringify() encountered the following error: Floating point values must be finite. JSON does not support NaN or Infinity.
Reproducible sample code
<ViewPager
style={{ flex: 1 }}
initialPage={0}
ref={this.viewPager}
showPageIndicator={false}
>
<View key="1"></View>
<View key="2"></View>
<View key="3"></View>
</ViewPager>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
ExceptionsManager.js:126 RCTJSONStringify() encountered ...
ExceptionsManager.js:126 RCTJSONStringify() encountered the following error: Floating point values must be finite. JSON does not support NaN or Infinity.
Read more >RCTJSONStringify() encountered the following error: Invalid ...
Animated.spring: RCTJSONStringify() encountered the following error: Invalid number value (NaN) in JSON write.
Read more >System.JSON.Writers.TJsonTextWriter.FloatFormatHandling
Symbol : Writes special floating point values as symbols in JSON, for example NaN, Infinity, -Infinity. Note that this will produce non-valid JSON....
Read more >Invalid number value (NaN) in JSON write - Google Groups
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid number value (NaN) in JSON write'.
Read more >allowSpecialFloatingPointValues - Kotlin
allow SpecialFloatingPointValues ... Removes JSON specification restriction on special floating-point values such as NaN and Infinity and enables their ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s the patch file in the meantime. You can use patch-package to patch after a yarn install.
Thank you guys @skychx and @gabrielbull for cooperation 😄
In case of any problem or proposition, feel free to create the new issue.