iOS dark mode: multiline input text is not visible
Describe the bug
I'm building a chat application. Below is sub that generates main window.
On iPhone 7, SE, 15 in dark mode (physical devices) entered text is not visible: background is black and text color is black.
def create_conversation_ui(self):
self.chat = toga.WebView(
url=None,
style=Pack(flex=1),
)
# Buttons
self.text_input = toga.MultilineTextInput(
style=Pack(flex=1, padding=5),
placeholder='Type your',
value = ''
)
self.send_button = toga.Button(
"Send",
on_press=self.handle_send_button,
style=Pack(padding_top=5, padding_right=5),
)
share_feedback_button = toga.Button(
"Share feedback",
on_press=self.handle_share_feedback_button,
style=Pack(padding_top=5, padding_right=5),
)
new_chat_button = toga.Button(
"New chat",
on_press=self.handle_new_chat_button,
style=Pack(padding_top=5, padding_right=5),
)
buttons_box = toga.Box(
children=[self.send_button,
share_feedback_button,
new_chat_button,
toga.Label('id: ' + device_id, style=Pack(color=GRAY))],
style=Pack(direction=COLUMN),
)
input_box = toga.Box(
children=[self.text_input, buttons_box],
style=Pack(direction=ROW),
)
# Outermost box
outer_box = toga.Box(
children=[self.chat, input_box],
style=Pack(direction=COLUMN),
)
return outer_box
Steps to reproduce
- Build interface and run on iPhone 7, SE, 15 in dark mode
- Go to 'Type your' multiline input text
- Type some text
- Text is not visible - issue
Expected behavior
Text is displayed in light color - white
Screenshots
Environment
- Operating System: iOS 17.5.1
- Python version: 3.12
- Software versions:
- Briefcase: 0.3.19
- Toga: 0.4.5
Logs
No response
Additional context
No response
Thanks for the report. I've moved this to the Toga repository, because integration with dark mode isn't something that Briefcase controls - it's a Toga issue.
Unfortunately, I can't reproduce what you're describing. This might be because I can't work out what your example code is trying to do - it doesn't have a main window, and it references a "device ID", so it can't be used as is; and it contains a number of details that don't appear to have anything to do with a MultilineTextInput, so it's not clear if the issue is the interaction between widgets, or if it's with a single widget. It's also not clear how I'm meant to be interpreting the screenshots, because they seem to be substantially redacted, hiding all the useful details, in favour of large overlays of text repeating what the report is telling me.
If I create an app that only has a MultilineTextInput, it renders white text on black background when in dark mode. Toga isn't doing anything to alter the default colors, so I'm not sure how you'd be getting different behavior.
If you're able to provide a minimal reproduction case (i.e., a full app that only contains the code needed to reproduce the issue, I can take another look.
Cannot reproduce with just a single TextInput... will post code tomorrow.
Closing on the basis that it can't be reproduced; @johnzhou721 Feel free to post the code for posterity.
In beeware-tutorial/helloworld/src/helloworld/app.py, rest of files unchanged from BeeWare Tutorial (accepting all defaults on the step for cookiecutter):
import toga
def button_handler(widget):
print("hello")
def build(app):
box = toga.Box()
inputbox = toga.TextInput(placeholder='Enter some text...')
box.add(inputbox)
return box
def main():
return toga.App("First App", "org.beeware.toga.examples.tutorial.johnzhou721", startup=build)
if __name__ == "__main__":
main().main_loop()
Hi! Should this be closed? The multiline input works per se but we're not sure about reporter's settings.