-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


react-native

, 10 2017 . 17:07 +
, -. Verb. Verb , , , , , .
, . , react-native.

-, 10 -, . ? Objective-C Swift iOS Java Android? , . .

React, react-native. . , react-native , , - - , - :
PhoneGap (WebView JavaScript, CSS, HTML), Xamarin (C#) NativeScript (JavaScript, TypeScript, Angular).
PhoneGap ( -), C# , Angular , RN.
NativeScript, RN JS, ( ) .

, , 0.7.1 ( 0.46), 21 2015. Android . 2015 (0.11). . , iOS Android - react-native.

, , Android- - Java. , RN ( ). iOS- Verb react-native.

react-native?


, react-native react iOS Android. React , : JSX, , state, props, , CSS-in-JS.

-, :
  • HTML, JSX (, , )
  • CSS. CSS-in-JS, layout flexbox ( , , flex-direction - column, row).
  • DOM API. window, document . API GeoLocation API (navigator.geolocation) XHR

:

render() {
    return (
        
            
                icons/close.png') } resizeMode="cover"/>
            
            
                { myText.join(', ') }
            
            }
            />
                {this.props.children}
            
        
    );
}

, HTML.
, ( , ), , -


CSS :

const styles = StyleSheet.create({
    default: {
        fontSize: PixelRatio.getPixelSizeForLayoutSize(7),
        color: 'rgba(0, 0, 0, 0.60)'
    },
    
    suggestUser: {
        height: PixelRatio.getPixelSizeForLayoutSize(100),
    
        backgroundColor: '#FFF',
        shadowColor: '#000',
        shadowOffset: {
            height: -5
        },
        shadowRadius: 5,
        shadowOpacity: 0.5
    }
};


StyleSheet , native, .
PixelRatio .

RN


Tadeu Zagallo RN, .

iOS :
shadow queue layout
main thread
JavaScript thread JS

: JS ( React), . , JSON . RN . JS.

image

. , . :
  • JS<->native ,
  • JS . , 60fps .
  • (, ) JS , .

, : , , JS. , native, native.

Write once, run everywhere?


- ). : learn once, write everywhere.
? , . , . . . . , . RN, component.ios.js component.android.js, if .

iOS Verb


react-native + redux. Redux , , , , . RN pure - , state .

:
  • React-native-deprecated-custom-components Navigator, .. react-navigation -
  • React-native-device-info UUID,
  • React-native-fbsdk FBSDK
  • React-native-imagepicker ActionSheetIOS, CameraRoll ImagePickerIOS
  • React-native-l20n l20n
  • React-native-linear-gradient
  • React-native-pagecontrol UIPageControl
  • React-native-photo-view ,
  • React-native-svg svg
  • React-native-vkontakte-login VKSDK


:
  • react-native-fabric Fabric Crashlytics
  • React-native-google-analytics-bridge GA
  • React-native-sentry Sentry
  • React-native-bugsnag BugSnag

stacktrace JS. Fabic , Sentry , BugSnag. Sentry, .

. react-native .

. , RN JS<->native, . , best practice react redux . React.PureComponent shouldCompomentUpdate, connect-, , .


. , RN 2 , . 1-2 , . , , . , .

react- ( ) . , react, react-native.

boilerplate rn + redux . react+redux, rn+redux : , Navigator, actions reducer . boilerplate .

JS. native, native- . , .

. RN , . PR. , native-, Java Objective-C . PR . , .


react-native , . . , early adopters (, ). RN , Facebook . Facebook react-native, Android iOS.

, iOS-, Twitter Instagram, . , android , , , , iOS-.

! doochik@ya.ru.


Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/335354/

:  

: [1] []
 

:
: 

: ( )

:

  URL