import React, { FC } from 'react'; import { Platform, TextInput, TextInputProps, TouchableOpacity, } from 'react-native'; import { Styles } from '../Consts'; interface SystemTextInputProps extends TextInputProps { ref?: React.RefObject; } const SystemTextInput: FC = props => { const { editable, onPressIn, onPressOut, ref } = props; const needsAndroidWrapper = Platform.OS === 'android' && !editable && (onPressIn || onPressOut); const inputProps: TextInputProps = { ...props, ...(needsAndroidWrapper ? { onPressIn: undefined, onPressOut: undefined } : null), ...(editable === false ? { accessibilityState: undefined } : null), }; if (needsAndroidWrapper) { return ( ); } return ; }; export default SystemTextInput;