SlideShare a Scribd company logo
React - Native
Compoments
• AppRegistry
• Component
• View, ScrollView
• Text
• TextInput
• Image
• FlatList/ SectionList
• Modal
• Platform,dimesions
AppRegistry
• This API only works in projects, which are developed with create react
native app.
• AppRegistry is the JS entry point to running all React Native apps
• App root component should be registered themselves with
AppRegistry.registryComponent
registerSection(appKey, component)
Component
• React Native provides a number of built-in components
• Basic Components - Basic UI
• User Interface – User control
• List Views – Flat and section list
• iOS-specific – NavigationiOS, DatePickerIOS
• Android-specific – DatePickerAndroid, BackHandler
• Others – Webview, CameraRoll, Animated
View
• View is basic component and used as container.
• View is designed to be nested inside other views and can have 0 to
many children of any type
ScrollView
• If combined height of child views is greater than parent view height
then we should use scroll view.
Text
• React component for displaying text.
• Text supports nesting, styling, and touch handling.
<Text style={{fontWeight: 'bold'}}>
I am bold
<Text style={{color: 'red’}} onPress={() => console.log(’hello’)} >
and red
</Text>
</Text>
TextInput
• A foundational component for inputting text into the app via a
keyboard.
<TextInput
style={{height: 40, borderColor: 'gray', borderWidth: 1}}
onChangeText={(text) => this.setState({text})}
onSubmitEditing={() => consol.log(‘hi’)}
value={this.state.text}
/>
Image
• Bundle image:
<Image source={require('./img/check.png')} />
• Network image
<Image source={{uri: 'https://facebook.github.io/react/logo-og.png'}}
style={{width: 400, height: 400}} />
• Dimension is necessary for network image.
FlatList/ SectionList
• Use pureComponent and keys to avoid memory issue
• Scroll view properties are applicable.
<FlatList data={[{key: 'a'}, {key: 'b'}]} renderItem={({item}) =>
<Text>{item.key}</Text>} key = {‘key’}/>
<SectionList renderItem={({item, index, section}) => <Text
key={index}>{item}</Text>} renderSectionHeader={({section: {title}}) => (
<Text style={{fontWeight: 'bold'}}>{title}</Text> )} sections={[ {title: 'Title1',
data: ['item1', 'item2']}, {title: 'Title2', data: ['item3', 'item4']}, {title: 'Title3',
data: ['item5', 'item6']}, ]} keyExtractor={(item, index) => item + index} />
Modal
• The Modal component is a simple way to present content above an
enclosing view.
<Modal animationType="slide" transparent={false}
visible={this.state.modalVisible} onRequestClose={() => { alert('Modal
has been closed.'); }}>
<child view>
</Modal>
Platform,dimesions
• We need to write some code according to platform
• const height = Platform.OS === 'ios' ? 200 : 100;
• const styles = StyleSheet.create({ container: { flex: 1, ...Platform.select({ ios:
{height : 200}, android: {height : 100}, }), }, });
• const height = Platform.select({ ios: () => 200 android: () => 100})();
• Dimesion is used to get screen height and width:
var {height, width} = Dimensions.get('window');

More Related Content

PPTX
Master pages ppt
PPTX
Html5 semantics
PPTX
Presentation on asp.net controls
PPTX
Master Pages In Asp.net
PPT
Master pages
PDF
Adobe Experience Manager Core Components
Master pages ppt
Html5 semantics
Presentation on asp.net controls
Master Pages In Asp.net
Master pages
Adobe Experience Manager Core Components

What's hot (12)

PPTX
Single page application 04
PPTX
Html5 structure & semantic
PDF
Active Admin
PDF
MAppMechanic CodeLabs - PolymerJS Custom Elements
PPT
RichControl in Asp.net
PDF
Asp dot net final (2)
PDF
YiiConf 2012 - Alexander Makarov - Yii2, what's new
PDF
Active Admin: Create Your Admin Interface the Easy Way
PPTX
PPT
PDF
AngularDay 2018 - Angular Elements
PPTX
ACTIVE SERVER PAGES BY SAIKIRAN PANJALA
Single page application 04
Html5 structure & semantic
Active Admin
MAppMechanic CodeLabs - PolymerJS Custom Elements
RichControl in Asp.net
Asp dot net final (2)
YiiConf 2012 - Alexander Makarov - Yii2, what's new
Active Admin: Create Your Admin Interface the Easy Way
AngularDay 2018 - Angular Elements
ACTIVE SERVER PAGES BY SAIKIRAN PANJALA
Ad

Similar to 3. react - native: component (20)

PPTX
Lecture 2 Styling and Layout in React Native.pptx
PPTX
Academy PRO: React native - building first scenes
PPTX
JS Fest 2018. Илья Иванов. Введение в React-Native
PPTX
Fullstack JS Workshop
PDF
React Native Workshop - React Alicante
PDF
2018 05-16 Evolving Technologies: React, Babel & Webpack
PPTX
20171108 PDN HOL React Basics
PDF
Getting Started with React
PPTX
React JS - A quick introduction tutorial
PDF
Getting Started with React-Nathan Smith
PDF
React && React Native workshop
PDF
Introduction to React Native Workshop
PPTX
React - Start learning today
PDF
07.React Navigation, Flat List.pdf
PPTX
React JS Workings Exercises Extra Classes
PPSX
React introduction
PPT
Lec9Handout.ppt
PDF
React native: building native iOS apps with javascript
PDF
React and React Native - Fifth Edition Mikhail Sakhniuk
PDF
React Native Components Building Blocks for Dynamic Apps.pdf
Lecture 2 Styling and Layout in React Native.pptx
Academy PRO: React native - building first scenes
JS Fest 2018. Илья Иванов. Введение в React-Native
Fullstack JS Workshop
React Native Workshop - React Alicante
2018 05-16 Evolving Technologies: React, Babel & Webpack
20171108 PDN HOL React Basics
Getting Started with React
React JS - A quick introduction tutorial
Getting Started with React-Nathan Smith
React && React Native workshop
Introduction to React Native Workshop
React - Start learning today
07.React Navigation, Flat List.pdf
React JS Workings Exercises Extra Classes
React introduction
Lec9Handout.ppt
React native: building native iOS apps with javascript
React and React Native - Fifth Edition Mikhail Sakhniuk
React Native Components Building Blocks for Dynamic Apps.pdf
Ad

Recently uploaded (9)

DOC
NIU毕业证学历认证,阿比林基督大学毕业证留学生学历
PDF
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
PDF
Best 4 Sites for Buy Verified Cash App Accounts – BTC Only.pdf
DOC
SIUE毕业证学历认证,阿祖萨太平洋大学毕业证学位证书复制
PDF
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
PPTX
Introduction to Packet Tracer Course Overview - Aug 21 (1).pptx
PDF
2025 Guide to Buy Verified Cash App Accounts You Can Trust.pdf
DOC
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
PPTX
ASMS Telecommunication company Profile
NIU毕业证学历认证,阿比林基督大学毕业证留学生学历
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
Best 4 Sites for Buy Verified Cash App Accounts – BTC Only.pdf
SIUE毕业证学历认证,阿祖萨太平洋大学毕业证学位证书复制
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
Introduction to Packet Tracer Course Overview - Aug 21 (1).pptx
2025 Guide to Buy Verified Cash App Accounts You Can Trust.pdf
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
ASMS Telecommunication company Profile

3. react - native: component

  • 2. • AppRegistry • Component • View, ScrollView • Text • TextInput • Image • FlatList/ SectionList • Modal • Platform,dimesions
  • 3. AppRegistry • This API only works in projects, which are developed with create react native app. • AppRegistry is the JS entry point to running all React Native apps • App root component should be registered themselves with AppRegistry.registryComponent registerSection(appKey, component)
  • 4. Component • React Native provides a number of built-in components • Basic Components - Basic UI • User Interface – User control • List Views – Flat and section list • iOS-specific – NavigationiOS, DatePickerIOS • Android-specific – DatePickerAndroid, BackHandler • Others – Webview, CameraRoll, Animated
  • 5. View • View is basic component and used as container. • View is designed to be nested inside other views and can have 0 to many children of any type ScrollView • If combined height of child views is greater than parent view height then we should use scroll view.
  • 6. Text • React component for displaying text. • Text supports nesting, styling, and touch handling. <Text style={{fontWeight: 'bold'}}> I am bold <Text style={{color: 'red’}} onPress={() => console.log(’hello’)} > and red </Text> </Text>
  • 7. TextInput • A foundational component for inputting text into the app via a keyboard. <TextInput style={{height: 40, borderColor: 'gray', borderWidth: 1}} onChangeText={(text) => this.setState({text})} onSubmitEditing={() => consol.log(‘hi’)} value={this.state.text} />
  • 8. Image • Bundle image: <Image source={require('./img/check.png')} /> • Network image <Image source={{uri: 'https://facebook.github.io/react/logo-og.png'}} style={{width: 400, height: 400}} /> • Dimension is necessary for network image.
  • 9. FlatList/ SectionList • Use pureComponent and keys to avoid memory issue • Scroll view properties are applicable. <FlatList data={[{key: 'a'}, {key: 'b'}]} renderItem={({item}) => <Text>{item.key}</Text>} key = {‘key’}/> <SectionList renderItem={({item, index, section}) => <Text key={index}>{item}</Text>} renderSectionHeader={({section: {title}}) => ( <Text style={{fontWeight: 'bold'}}>{title}</Text> )} sections={[ {title: 'Title1', data: ['item1', 'item2']}, {title: 'Title2', data: ['item3', 'item4']}, {title: 'Title3', data: ['item5', 'item6']}, ]} keyExtractor={(item, index) => item + index} />
  • 10. Modal • The Modal component is a simple way to present content above an enclosing view. <Modal animationType="slide" transparent={false} visible={this.state.modalVisible} onRequestClose={() => { alert('Modal has been closed.'); }}> <child view> </Modal>
  • 11. Platform,dimesions • We need to write some code according to platform • const height = Platform.OS === 'ios' ? 200 : 100; • const styles = StyleSheet.create({ container: { flex: 1, ...Platform.select({ ios: {height : 200}, android: {height : 100}, }), }, }); • const height = Platform.select({ ios: () => 200 android: () => 100})(); • Dimesion is used to get screen height and width: var {height, width} = Dimensions.get('window');