javascript - Creating 'Div' and 'Span' Components in React Native -
i have seen in various forums claims using "view" in react native quasi equivalent of using 'div' in react.
while understand reasoning view component (who wants support of 'div' options?) seems component can handle of reasonable 'div' , 'span' attributes made porting react react native not such tedious chore.
does have such components have tested , can share? issues style support, mapping event , mapping children seem repetitive jumping react native.
something like
class div extends component { //or class span extends component static proptypes = { style : proptypes.obj onclick : proptypes.func // ... } render (){ return ( <view> { /* whatever needed pass through ... */ } </view> } }
i think missing point of react native. meant have components map native ui components of mobile platform. not meant takes html , somehow converts looks mobile app. why called "native" -- because uses ui platform. if feel using common html elements make mobile app, why don't stick frameworks cordova/ionic, etc?
react idiom allows build user interface no matter device. react native merely takes react "idiom" , knows how render on mobile screen. there's no such thing "porting react react native."
if wish experiment, yes can make custom div component , custom span component -- you. can pass props down component down view or text. think redundant. create own components , behind scenes use view , text , textinput, etc -- basic components of react native.
Comments
Post a Comment