More Related Content
Similar to React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
Similar to React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi(20)
More from Yukiya Nakagawa
More from Yukiya Nakagawa(20)
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
- 23. import React from 'react';
import ReactDOM from 'react-dom';
const styles = {
container: {display: 'flex', flexDirection: ‘row', …}
};
class App extends React.Component {
render() {
const myName = /* props or state */;
return (
<div style={styles.container}>
<Header />
<LeftPane />
<RightPane
name={myName} />
</div>
);
}
}
ReactDOM.render(
<App />,
document.getElementById('app')
);
- 39. • Fragment
•
• Advocating Against Android Fragments
• https://medium.com/square-corner-blog/advocating-against-
android-fragments-81fd0b462c97
• ( ) http://ninjinkun.hatenablog.com/entry/
2014/10/16/234611
- 47. import React from 'react';
import ReactDOM from 'react-dom';
const styles = {
container: {display: 'flex', flexDirection: ‘row', …}
};
class App extends React.Component {
render() {
const myName = /* props or state */;
return (
<div style={styles.container}>
<Header />
<LeftPane />
<RightPane
name={myName} />
</div>
);
}
}
ReactDOM.render(
<App />,
document.getElementById('app')
);
import ReactDOM from 'react-dom';
div
div
ReactDOM.render(
<App />,
document.getElementById('app')
);
- 48. import React from "react";
import { View, AppRegistry } from "react-native";
const styles = {
container: {display: 'flex', flexDirection: ‘row', …}
};
class App extends React.Component {
render() {
const myName = /* props or state */;
return (
<View style={styles.container}>
<Header />
<LeftPane />
<RightPane
name={myName} />
</View>
);
}
}
AppRegistry.registerComponent(
"App",
() => App
);
- 56. ReactRootView RootView
(ReactActivityDelegate.java)
protected ReactRootView createRootView() {
return new ReactRootView(getContext());
}
//
protected void onCreate(Bundle savedInstanceState) {
//
if (mMainComponentName != null && !needsOverlayPermission) {
loadApp(mMainComponentName);
}
//
}
protected void loadApp(String appKey) {
if (mReactRootView != null) {
throw new IllegalStateException("Cannot loadApp while app is already running.");
}
mReactRootView = createRootView();
mReactRootView.startReactApplication(
getReactNativeHost().getReactInstanceManager(),
appKey,
getLaunchOptions());
getPlainActivity().setContentView(mReactRootView);
}
https://github.com/facebook/react-native/blob/d21aa9248056b08449f4a0f57e824b3c52b0614b/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java#L67-L115
- 79. const styles = StyleSheet.create({
container: {
paddingTop: metrics.x4,
paddingBottom: metrics.x2
},
logo: {
height: 180,
alignSelf: "center"
},
loginBox: {
marginTop: metrics.x4,
marginHorizontal: metrics.x4
}
});
- 81. CSS
• CSS
• CSS
• Bootstrap Material Design Lite
• CSS React
• OnsenUI material-ui
- 85. Material Design
const metrics = {
x0_25: 2,
x0_5: 4,
x0_75: 6,
x1: 8,
x1_5: 12,
x2: 16,
x2_5: 20,
x3: 24,
x4: 32,
x5: 40,
x6: 48,
x7: 56,
x8: 64,
x9: 72
};
export default metrics;
metrics.android.js
const metrics = {
x0_25: 2,
x0_5: 4,
x0_75: 6,
x1: 8,
x1_5: 11,
x2: 15,
x2_5: 20,
x3: 22,
x4: 32,
x5: 40,
x6: 44,
x7: 56,
x8: 64,
x9: 72
};
export default metrics;
metrics.ios.js
- 86. • <Image>
•
• Android Picasso PhotoView
• iOS UIScrollView
JS
http://square.github.io/picasso/
https://github.com/chrisbanes/PhotoView
- 92. • VSCode JS
• Android/iOS
Android iOS
• JS R Live
Reload
• Android Studio Xcode
- 98. CI
•
• Android Java, Android SDK
• iOS OS X, Xcode, iOS SDK
• Fastlane CocoaPods Ruby
• mac mini