brentvatne / stargrave-0

preserving my stars for vanity. former home of react-native-modal
389 stars 65 forks source link

Is it possible to use this module to display and use Buttons and TextInput. #15

Closed gasperz closed 9 years ago

gasperz commented 9 years ago

For example for adding new items and similar. I was actually able to display buttons (TouchableHighlight), text inputs, text components. But have problem when I want to do something on button press. function is executed immediately when app starts and not when i press button. Any ideas? Thank you!

brentvatne commented 9 years ago

hey there @gasperz, could you paste some sample code here? It would help me to figure out how to solve your problem :smile:

gasperz commented 9 years ago

Actually I managed to solve this issue. I think that my problem was that I was missing .bind on my function call. So totally newbie problem. :). Anyhow. Link to my example.

Thanks

brentvatne commented 9 years ago

Ah yes @gasperz - it's necessary to do bind if you use the extends syntax for a React component :smile: glad you figured it out

gasperz commented 9 years ago

One more question. On Main component (that is used as initial route on NavigatorIOS) I have ListView. On modal component I am using button (TouchableHighlight) and onPress I would like to add new item and push that to ListView on Main component. If I understand right I would need to have props on Main component (that would represent items) and use that as ListView dataSource. But how can I push(add) props to Main component in this example. Or am I doing it completely wrong?

brentvatne commented 9 years ago

@gasperz - this seems like a pretty common pattern, should be no different than what you would do to add items to a todo list :smile: check out some examples for that type of thing, eg: http://jsfiddle.net/johnthethird/NXCyC/7/

gasperz commented 9 years ago

I eventually succeeded. For me it this example was very helpful. Thank you very much.

brentvatne commented 9 years ago

great! :smile: