UNPKG

@td-design/react-native

Version:

react-native UI组件库

38 lines (37 loc) 1.32 kB
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import React from 'react'; import { StyleSheet, TextInput } from 'react-native'; import Animated, { useAnimatedProps } from 'react-native-reanimated'; const styles = StyleSheet.create({ baseStyle: { color: 'black' } }); Animated.addWhitelistedNativeProps({ text: true }); const AnimatedTextInput = Animated.createAnimatedComponent(TextInput); const ReText = props => { const { style, text, ...rest } = props; const animatedProps = useAnimatedProps(() => { return { text: text.value // Here we use any because the text prop is not available in the type // eslint-disable-next-line @typescript-eslint/no-explicit-any }; }); return /*#__PURE__*/React.createElement(AnimatedTextInput, _extends({ underlineColorAndroid: "transparent", editable: false, value: text.value, style: [styles.baseStyle, style || undefined] }, rest, { animatedProps })); }; export default ReText; //# sourceMappingURL=ReText.js.map