react-native/Libraries
Jens Panneel 75e49a0637 Feature/add decimal pad to android (#19714)
Summary:
For a current use-case we need the a keyboard with characters 0-9 and a decimal point (or comma depending on language settings)

This exists on iOS as UIKeyboardType "decimalPad" and this is what react-native maps to for both "numeric" and "decimal-pad". This also exists on Android as inputType "numberDecimal", but is currently not accessible through react-native.

This PR maps the value "decimal-pad" of the keyboardType property of TextInput to the Android inputType "numberDecimal", effectively making "decimal-pad" cross platform without breaking anything.

* https://facebook.github.io/react-native/docs/textinput.html#keyboardtype
* https://developer.apple.com/documentation/uikit/uikeyboardtype
* https://developer.android.com/reference/android/widget/TextView#attr_android:inputType

There is this bug in some Samsung keyboards where both the - sign and decimal sign disappear when the keyboardType is set to "number" and both the "signed" and "decimal" flags are set. (Like is the case when using the react-native keyboardType prop "numeric".) https://androidforums.com/threads/numeric-soft-keyboard-missing-minus-sign-in-android-8-0-samsung-a5.1272628/

For developers that need decimal numbers but not negative ones, using "decimal-pad" will provide a workaround. I reproduced this on a Samsung A5 only, but maybe other phones have this exact issue. https://github.com/facebook/react-native/issues/12988 https://github.com/facebook/react-native/issues/12977 https://github.com/facebook/react-native/issues/17473 https://github.com/facebook/react-native/issues/17474

* Added testcase consistent with existing keyboardType tests
* Also added testcase for the related, but missing number-pad

This PR follows the same approach as the recently merged PR introducing "number-pad" b638847a46

Documentation PR: https://github.com/facebook/react-native-website/pull/405

 [ANDROID] [ENHANCEMENT] [TextInput] - Added "decimal-pad" keyboard type
Closes https://github.com/facebook/react-native/pull/19714

Differential Revision: D8429185

Pulled By: mdvacca

fbshipit-source-id: 6b56da2088f2be427ebffa04c4e17c91ffb9f7d9
2018-06-14 14:01:51 -07:00
..
ART Bump Prettier to 1.13.4 on xplat 2018-06-06 05:32:06 -07:00
ActionSheetIOS deleted UI Action Sheet Delegate Methods 2018-05-30 10:40:39 -07:00
Alert Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
Animated Enable Flow for bezier 2018-06-10 15:16:15 -07:00
AppState Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
BatchedBridge Remove __fbUninstallRNGlobalErrorHandler 2018-05-21 11:12:46 -07:00
Blob iOS OSS: deployment target 8.0 => 9.0 2018-05-22 01:16:45 -07:00
BugReporting Fix some typos in dumpReactTree.js (#19636) 2018-06-09 20:27:42 -07:00
CameraRoll iOS: disable deprecation warning for Xcode 9.3.1+ for now 2018-05-22 01:16:45 -07:00
Color Bump Prettier to 1.13.4 on xplat 2018-06-06 05:32:06 -07:00
Components Feature/add decimal pad to android (#19714) 2018-06-14 14:01:51 -07:00
Core Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
EventEmitter Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
Experimental Flowtype SwipeableRow 2018-05-14 00:24:44 -07:00
Geolocation iOS OSS: deployment target 8.0 => 9.0 2018-05-22 01:16:45 -07:00
Image Don't pass additional args to requireNativeComponent in .android.js files 2018-06-10 15:38:32 -07:00
Inspector Flowtype ListView 2018-05-14 00:24:44 -07:00
Interaction RN: Remove ReactPerf References 2018-05-15 13:16:57 -07:00
JSInspector Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
LayoutAnimation Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Linking Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
LinkingIOS iOS OSS: deployment target 8.0 => 9.0 2018-05-22 01:16:45 -07:00
Lists Bump Prettier to 1.13.4 on xplat 2018-06-06 05:32:06 -07:00
Modal Switch to Platform.isTV to pass Android Flow 2018-06-10 13:45:57 -07:00
NativeAnimation iOS OSS: deployment target 8.0 => 9.0 2018-05-22 01:16:45 -07:00
Network iOS OSS: deployment target 8.0 => 9.0 2018-05-22 01:16:45 -07:00
Performance QuickPerformanceLogger.js: markerPoint + iOS/Android JS binding 2018-06-08 08:32:05 -07:00
PermissionsAndroid Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
PushNotificationIOS iOS OSS: deployment target 8.0 => 9.0 2018-05-22 01:16:45 -07:00
RCTTest RN: Remove Native Prop Validation 2018-06-01 12:54:14 -07:00
ReactNative RN: A wild YellowBox has appeared! 2018-06-11 18:31:18 -07:00
Renderer React sync for revisions de84d5c...c0fe8d6 2018-05-18 20:22:45 -07:00
Sample iOS OSS: deployment target 8.0 => 9.0 2018-05-22 01:16:45 -07:00
Settings iOS OSS: deployment target 8.0 => 9.0 2018-05-22 01:16:45 -07:00
Share Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
Storage Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
StyleSheet Support animated values for border dimensions 2018-06-13 17:34:47 -07:00
SurfaceBackedComponent Update license headers for MIT license 2018-02-16 18:31:53 -08:00
SurfaceHostingComponent Update license headers for MIT license 2018-02-16 18:31:53 -08:00
Text - Keyboard layout now updates when changing keyboardType while it has focus (#19027) 2018-06-13 22:47:47 -07:00
Types Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Utilities Switch to Platform.isTV to pass Android Flow 2018-06-10 13:45:57 -07:00
Vibration iOS OSS: deployment target 8.0 => 9.0 2018-05-22 01:16:45 -07:00
WebSocket Bump Prettier to 1.13.4 on xplat 2018-06-06 05:32:06 -07:00
Wrapper Update additional license headers 2018-03-08 12:10:14 -08:00
YellowBox YellowBox: Restore ES5 Compatibility 2018-06-14 09:02:18 -07:00
fishhook Merge fishhook.xcodeproj in RCTWebSocket 2017-08-09 07:48:09 -07:00
polyfills Implement console group APIs (#18555) 2018-06-12 11:18:37 -07:00
react-native Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
vendor Add MIT License Header 2018-06-09 18:16:21 -07:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
Promise.js Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
UTFSequence.js RN: A wild YellowBox has appeared! 2018-06-11 18:31:18 -07:00
promiseRejectionIsError.js Prettier React Native Libraries 2018-05-10 19:10:38 -07:00