Skip to content

TextInput not displaying initial value in react-native-macos #60

@fpena

Description

@fpena

Description

TextInput components are not rendering their initial value prop in the macOS version of the app. By setting initialValue or value, the content shows up as empty. If the user starts typing, the display is correct.

Context

Some ideas were discussed in this thread to solve this issue. The most promising one was to revert a section of a patch to fix this behavior. That was not succesful.

Steps to reproduce

Create a TextInput component with an initial value:

import { TextInput } from "react-native"
import { useState } from "react"

export function StateScreen() {
  const [text, onChangeText] = useState("Reactotron")

  return (
    <TextInput
      value={text}
      onChangeText={onChangeText}
    />
  )
}

Run the app on macOS
Observe that the TextInput appears empty despite having an initial value

Expected behavior

The TextInput should display "Reactotron" on initial render.

Actual behavior

The TextInput appears empty. The state value updates correctly when typing (confirmed via logging), but the initial value is not visible until user interaction begins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions