反应本机TextInputMask默认字符

时间:2020-09-18 22:08:29

标签: javascript reactjs react-native textinput react-native-textinput

在我的React Native应用程序中,我有一个<TextInputMask>组件,用户可以在其中输入电话号码。目前,我的组件看起来像这样(为简单起见,删除了一些行):

<TextInputMask
  mask={"([000]) [000] [000]"}
/>

这样做的效果是,一旦用户点击TextInput框,就会出现一个(字符,然后在他们键入3个字符后出现闭合的),等等。

这是一个问题,原因是当我focus TextInput和开头的(出现时,它会自动使TextInput模糊。当我没有前导(时,这不会发生。

我想知道的事情

有没有一种方法可以使用户单击TextInput框时,直到输入第一个数字后,前导(才会出现;如果删除第一个数字,则前导(会消失?

或者,是否可以保留前导 Sub CreateBasicWordReport() Dim WdApp As Word.Application Dim wdDoc As Word.Document Dim SaveName As String Dim FileExt As String Dim LstObj1 As ListObject Dim MaxValue As Integer Dim FilterValue As Integer Dim Organisation As String Dim Rng As Range Dim WS As Worksheet Set LstObj1 = Worksheets("Sheet1").ListObjects("Table1") MaxValue = WorksheetFunction.Max(LstObj1.ListColumns(1).Range) FilterValue = MaxValue Set WdApp = CreateObject("Word.Application") Do Until FilterValue = 0 Application.DisplayAlerts = False Sheets.Add(After:=Sheets("Sheet1")).Name = "Static" Sheets("Sheet1").Select 'moved outside of loop ' Set WdApp = CreateObject("Word.Application") With WdApp .Visible = True .Activate 'create new document and assign to object variable Set wdDoc = .Documents.Add("C:\Users\david\Documents\Custom Office Templates\Template2.dotx") 'now mostly finished with WdApp as from here wdDoc is used End With ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, Criteria1:=FilterValue Range("F11").Select Range("A1", Range("A1").End(xlDown).End(xlToRight)).Copy ' .Selection.GoTo what:=-1, Name:="TableLocation" ' .Selection.Paste wdDoc.Bookmarks("TableLocation").Range.Paste For Each Row In Range("Table1[#All]").Rows If Row.EntireRow.Hidden = False Then If Rng Is Nothing Then Set Rng = Row Set Rng = Union(Row, Rng) End If Next Row Set WS = Sheets("Static") Rng.Copy Destination:=WS.Range("A1") ' Sheets("Static").Select ' Sheets("Static").Activate Organisation = WS.Range("D2").Value ' Sheets("Static").Select ' Range("D2").Copy WS.Range("D2").Copy ' .Selection.GoTo what:=-1, Name:="Organisation" ' .Selection.PasteAndFormat wdFormatPlainText wdDoc.Bookmarks("Organisation").Range.PasteAndFormat wdFormatPlainText Application.CutCopyMode = False ' Sheets("Static").Select ' Range("F2").Copy WS.Range("F2").Copy ' .Selection.GoTo what:=-1, Name:="MalePatients" ' .Selection.PasteAndFormat wdFormatPlainText wdDoc.Bookmarks("MalePatients").Range.PasteAndFormat wdFormatPlainText Application.CutCopyMode = False Chart2.ChartArea.Copy ' .Selection.GoTo what:=-1, Name:="ChartLocation" ' .Selection.Paste wdDoc.Bookmarks("ChartLocation").Range.Paste If WdApp.Version <= 11 Then FileExt = ".doc" Else FileExt = ".docx" End If SaveName = Environ("UserProfile") & "\Desktop\Report for " & _ Organisation & " " & _ Format(Now, "yyyy-mm-dd hh-mm-ss") & FileExt If WdApp.Version <= 12 Then ' .ActiveDocument.SaveAs SaveName wdDoc.SaveAs SaveName Else ' .ActiveDocument.SaveAs2 SaveName wdDoc.SaveAs2 SaveName End If SaveNamePDF = Environ("UserProfile") & "\Desktop\Report " & _ Organisation & " " & _ Format(Now, "yyyy-mm-dd hh-mm-ss") & ".pdf" wdDoc.ExportAsFixedFormat _ OutputFileName:=SaveNamePDF, _ ExportFormat:=wdExportFormatPDF _ wdDoc.Close FilterValue = FilterValue - 1 Sheets("Static").Delete Application.DisplayAlerts = True Loop WdApp.Quit Set WdApp = Nothing End Sub ,但可以防止TextInput在焦点对准后立即模糊?

0 个答案:

没有答案