GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — space between cursor and text in TextInput will add letterSpacing · Issue #28755 · react/react-native

space between cursor and text in TextInput will add letterSpacing #28755

New issue
Copy link
New issue
Copy link
Closed
Closed
space between cursor and text in TextInput will add letterSpacing#28755
Copy link
Labels
Component: TextInputRelated to the TextInput component.Needs: Triage 🔍StaleThere has been a lack of activity on this issue and it may be closed soon.

Description

@L-x-C
L-x-C
opened on Apr 26, 2020
Issue body actions

Description

when add letterSpacing to a TextInput, the space between cursor and text will not be 0, but letterSpacing

eg:
letterSpacing: 200

In android

image
image

Do you see the space between cursor and text?

in IOS

image
image

That's what we expect

React Native version:

react: 16.9.0
react-native: 0.61.5

Activity

  1. L-x-C
    added
    Needs: Triage 🔍
    on Apr 26, 2020
  2. react-native-bot
    added
    Component: TextInputRelated to the TextInput component.
    on Apr 26, 2020
  3. fabOnReact commented on Apr 27, 2020

    @fabOnReact
    fabOnReact
    on Apr 27, 2020
    Contributor
    More actions

    maybe connected to how android sets those spans in ReactEditText.java and the usage of getSpanStart

      private void manageSpans(SpannableStringBuilder spannableStringBuilder) {
        Object[] spans = getText().getSpans(0, length(), Object.class);
        for (int spanIdx = 0; spanIdx < spans.length; spanIdx++) {
          // Remove all styling spans we might have previously set
          if (spans[spanIdx] instanceof ReactSpan) {
            getText().removeSpan(spans[spanIdx]);
          }
    
          if ((getText().getSpanFlags(spans[spanIdx]) & Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
              != Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) {
            continue;
          }
          Object span = spans[spanIdx];
          final int spanStart = getText().getSpanStart(spans[spanIdx]);
          final int spanEnd = getText().getSpanEnd(spans[spanIdx]);
          final int spanFlags = getText().getSpanFlags(spans[spanIdx]);
    
          // Make sure the span is removed from existing text, otherwise the spans we set will be
          // ignored or it will cover text that has changed.
          getText().removeSpan(spans[spanIdx]);
          if (sameTextForSpan(getText(), spannableStringBuilder, spanStart, spanEnd)) {
            spannableStringBuilder.setSpan(span, spanStart, spanEnd, spanFlags);
          }
        }
      }

    please provide reproducible example so i can debug this. thanks

  4. L-x-C commented on Apr 27, 2020

    @L-x-C
    L-x-C
    on Apr 27, 2020
    Author
    More actions

    maybe connected to how android sets those spans in ReactEditText.java and the usage of getSpanStart

      private void manageSpans(SpannableStringBuilder spannableStringBuilder) {
        Object[] spans = getText().getSpans(0, length(), Object.class);
        for (int spanIdx = 0; spanIdx < spans.length; spanIdx++) {
          // Remove all styling spans we might have previously set
          if (spans[spanIdx] instanceof ReactSpan) {
            getText().removeSpan(spans[spanIdx]);
          }
    
          if ((getText().getSpanFlags(spans[spanIdx]) & Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
              != Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) {
            continue;
          }
          Object span = spans[spanIdx];
          final int spanStart = getText().getSpanStart(spans[spanIdx]);
          final int spanEnd = getText().getSpanEnd(spans[spanIdx]);
          final int spanFlags = getText().getSpanFlags(spans[spanIdx]);
    
          // Make sure the span is removed from existing text, otherwise the spans we set will be
          // ignored or it will cover text that has changed.
          getText().removeSpan(spans[spanIdx]);
          if (sameTextForSpan(getText(), spannableStringBuilder, spanStart, spanEnd)) {
            spannableStringBuilder.setSpan(span, spanStart, spanEnd, spanFlags);
          }
        }
      }

    please provide reproducible example so i can debug this. thanks

    <TextInput style={{ letterSpacing: 100 }}></TextInput>

    Try this on Android and Ios, and you will see...

    Thanks a lot

  5. stale commented on Jul 26, 2020

    @stale
    staleBot
    on Jul 26, 2020
    More actions

    Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

  6. stale
    added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Jul 26, 2020
  7. stale commented on Aug 2, 2020

    @stale
    staleBot
    on Aug 2, 2020
    More actions

    Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

  8. stale
    closed this as completedon Aug 2, 2020
  9. react
    locked as resolved and limited conversation to collaborators on Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: TextInputRelated to the TextInput component.Needs: Triage 🔍StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.