chandu0101 / sri

Build truly native cross platform (web,ios,android) apps using scalajs and react, react-native ,This project moved to new organization : https://github.com/scalajs-react-interface/sri#sri, new chat room : https://gitter.im/scalajs-react-interface/sri
Apache License 2.0
634 stars 35 forks source link

Make AppRegistry typesafe #19

Closed mkotsbak closed 8 years ago

mkotsbak commented 8 years ago

Replace js.Function, jsArray etc. with actual types.

The types are given here: https://github.com/facebook/react-native/blob/master/Libraries/ReactNative/AppRegistry.js or in the doc: https://facebook.github.io/react-native/docs/appregistry.html

chandu0101 commented 8 years ago

@mkotsbak can you send a PR ?

chandu0101 commented 8 years ago

by any chance if you know javascript send a PR here https://github.com/facebook/react-native/issues/4380 :D , it will make our life easier :)

chandu0101 commented 8 years ago

mkotsbak - I don't see the need for functional component in Scala. What do you gain over just using a function like this: https://github.com/mkotsbak/Javabin-SriReactNativeDemo/blob/master/mobile/src/main/scala/sri/templates/crossplatform/mobile/AlcoMeter.scala#L26-L30 I see maybe in JS you get types and default values, but that is not needed in Sri, as you have both types, default values and named parameters: See also https://news.ycombinator.com/item?id=10348391

well above issue is not about scala functions vs functional components , while registering if they allow functional components we can pass functions instead of React.createClass with render/React.Component with render boilerplates as mobile root.

coming to scala methods vs functional components from HN link you posted u missed main important point

in the future, shouldComponentUpdate (or built-in memoization strategy?), you can potentially later change it to be stateful without rewriting consuming code, etc

if you're just using methods then your component will go bigger and bigger and on state updates react has to diff whole tree ..

mkotsbak commented 8 years ago

Ah ok, yes, maybe it is able to optimize on stateless components that has not changed any input properties?

mkotsbak commented 8 years ago

But how is this different from pure JS React native? Doesn't they also need to run the AppRegistry function?

chandu0101 commented 8 years ago

But how is this different from pure JS React native? Doesn't they also need to run the AppRegistry function?

sorry didn't understand, can you elaborate ...

mkotsbak commented 8 years ago

Why did you close it? Is it fixed?

chandu0101 commented 8 years ago

Why did you close it? Is it fixed?

I don't know how other open source projects work but i don't entertain these kind of behaviours in my project.you don't have time to answer my first question/send a two lines of simplePR but you have time to argue on some other unrelated things!. Sorry to be the bad guy In future also i'll do the same thing if its repeated again ,if you don't like it then don't use this project.

chandu0101 commented 8 years ago

I still don't know if the comment #19 (comment) is related to this issue or just piggybacked on it

i already explained that here.