expo / snack

Expo Snack lets you run Expo in the browser.
https://snack.expo.dev
MIT License
366 stars 109 forks source link

[object Object] when rendering TextInput with Text inside #519

Open jcubic opened 10 months ago

jcubic commented 10 months ago

Summary

If you attempt to create a rich text editor as written in docs Snack renders [object Object]

What platform(s) does this occur on?

Web

SDK Version

version online

Reproducible demo or steps to reproduce from a blank project

https://snack.expo.dev/@jcubic777/textarea

Przechwycenie obrazu ekranu_2023-12-07_23-24-17

Another issue is if you change the wrapper element from Text to View the snack doesn't show any error. But the app should throw an error because TextInput can't accept components different than Text.

  return (
    <TextInput
      style={[styles.texarea, style]}
      multiline
      onChange={changeHandler}>
      <View>
        {value.split('\n').map((line, index) => {
          const style = line.match(/^#/) && styles.header;
          return <Text style={style} key={`${index}-${line}`}>{ line }</Text>;
        })}
      </View>
    </TextInput>
  );

This should throw an error the same as react native.