learning_react_native.pdf

(16479 KB) Pobierz
2n
d
Ed
iti
on
React
Native
BUILDING NATIVE MOBILE APPS WITH JAVASCRIPT
Learning
Bonnie Eisenman
SECOND EDITION
Building Native Mobile Apps with JavaScript
Learning React Native
Bonnie Eisenman
Beijing
Boston Farnham Sebastopol
Tokyo
Learning React Native
by Bonnie Eisenman
Copyright © 2018 Bonnie Eisenman. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://oreilly.com/safari). For more information, contact our corporate/insti‐
tutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editor:
Meg Foley
Production Editor:
Nicholas Adams
Copyeditor:
Rachel Monaghan
Proofreader:
Gillian McGarvey
December 2015:
November 2017:
First Edition
Second Edition
Indexer:
Judith McConville
Interior Designer:
David Futato
Cover Designer:
Karen Montgomery
Illustrator:
Rebecca Demarest
Revision History for the Second Edition
2017-10-23:
First Release
See
http://oreilly.com/catalog/errata.csp?isbn=9781491989142
for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Learning React Native,
the cover image,
and related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
978-1-491-98914-2
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1.
What Is React Native?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Advantages of React Native
Developer Experience
Code Reuse and Knowledge Sharing
Risks and Drawbacks
Summary
How Does React Native Work?
Rendering Lifecycle
Creating Components in React Native
Working with Views
Using JSX
Styling Native Components
Host Platform APIs
Summary
2
2
3
4
4
2.
Working with React Native. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5
7
8
8
9
10
11
12
13
14
14
15
16
16
17
18
iii
3.
Building Your First Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Setting Up Your Environment
Developer Setup: Create React Native App
Creating Your First Application with create-react-native-app
Previewing Your App on iOS or Android
Developer Setup: The Traditional Approach
Creating Your First Application with react-native
Running Your App on iOS
Running Your App on Android
Zgłoś jeśli naruszono regulamin