-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Android padStart is undefined, likely needs to be polyfilled #18375
Comments
Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest stable release? Thank you for your contributions. |
Oof, didn't even notice there was a new RN version. That being said, the Expo Snack test I included still fails, I assume that is running the latest version of RN. |
I went into same problem, instead of updating version. I use lodash padstart function and it works!! |
Hi, I'm using react-native version "0.54.2" and the error still occurs. |
I got the same error using react-native version 0.55.2. |
Same on 0.54.0 |
Any update? |
Still an issue with "0.55.4" |
Bump - same Problem Solution for now is:
|
Can reproduce with "0.56". For some reason only on the Android without attached debugger. |
Happening to me too, on iOS it works fine but android give the issue. This one helped: |
With Android 7.0 and latest version of react native this bug does not occurs anymore... For the older version is there some workaround? |
I started testing my app on Android again and thought I was going to have to go back and replace it all with lodash padStart() all over again. Work-Around PolyfillAdding this polyfill to my App.js made Android like myString.padStart() again.
|
React Native 0.59 shipped with modern JSC (JavaScriptCore engine) on Android, which supports |
When testing on Android 5.0+ (Google API 22+) I found that calls to padStart would result in "undefined is not a function". Polyfilling it manually resolved the issue in Android 5.0+. My polyfill fix was a verbatim copy/paste of the polyfill example on MDN's padStart . This error does not happen when debugging remotely. If my understanding is correct, this is due to differences in Chrome's JS engine vs React Natives implementation.
I found related issue #17442 where this error was occurring on iOS. I opened a separate issue because this was happening on Android.
Environment
#####Environment:
OS: macOS Sierra 10.12.6
Node: 9.5.0
Yarn: Not Found
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
#####Packages: (wanted => installed)
react: ^16.2.0 => 16.2.0
react-native: ^0.53.3 => 0.53.3
Expected Behavior
Calls to padStart should return a value according to MDN
Actual Behavior
Calls to padStart result in an error of "undefined is not a function"
Steps to Reproduce
Call padStart on a string.
Reproducible Demo
https://snack.expo.io/ByAN82Itz
The text was updated successfully, but these errors were encountered: