By rendering the FlatList I always get the error "Objects are not valid as a React child (found: object with keys {dispatchConfig, _targetInst, _dispatchListeners, _dispatchInstances, nativeEvent, type, target, currentTarget, eventPhase, bubbles, cancelable, timeStamp, defaultPrevented, isTrusted, isDefaultPrevented, isPropagationStopped}). If you meant to render a collection of children, use an array instead.".
I find out that the rendered item in the Text component needs to be a primitive type but I think it's rendering a string which is a primitive type.
CodePudding user response:
Welcome to StackOverflow...in the future, please add code as a text snippet to make it easier to use.
The problem is that you are passing objects rather than strings into the courseGoals
array. This is because the onChange
handler of TextInput takes a whole event object.
Switch it to onChangeText
, which passes a string, and it should work.