diff --git a/docs/getting-started.html b/docs/getting-started.html index 29c4fb181ba..335aa3748f1 100644 --- a/docs/getting-started.html +++ b/docs/getting-started.html @@ -1,4 +1,4 @@ -
brew install node. New to node or npm?brew install watchman. We recommend installing watchman, otherwise you might hit a node file watching bug.brew install flow. If you want to use flow.npm install -g react-native-clireact-native init AwesomeProjectIn the newly created folder AwesomeProject/
AwesomeProject.xcodeproj and hit run in Xcodeindex.ios.js in your text editor of choice and edit some linesCongratulations! You've just successfully run and modified your first React Native app.
brew install node. New to node or npm?brew install watchman. We recommend installing watchman, otherwise you might hit a node file watching bug.brew install flow. If you want to use flow.npm install -g react-native-clireact-native init AwesomeProjectIn the newly created folder AwesomeProject/
AwesomeProject.xcodeproj and hit run in Xcodeindex.ios.js in your text editor of choice and edit some linesCongratulations! You've just successfully run and modified your first React Native app.
LinkingIOS gives you an interface to interact with both incoming and
-outgoing app links.
If your app was launched from an external URL registered with your app, you can -access and handle it from any component you want with the following:
If you also want to listen to incoming app links during your app's
-execution you'll need to add the following lines to you *AppDelegate.m:
And in your React component, you'll then be able to listen to the events from
-LinkingIOS as follows
To trigger an app link (browser, email, or custom schemes) you can call:
If you want to check if a URL can be opened by an installed app on the system you can call
Add a handler to LinkingIOS changes by listening to the url event type
-and providing the handler
Remove a handler by passing the url event type and the handler
Try to open the given url with any of the installed apps.
-If multiple applications can open url, the one that opens
-is undefined.
Determine whether an installed app can handle a given url.
-The callback function will be called with bool supported as the only argument
If the app launch was triggered by an app link, it will pop the link URL,
-otherwise it will return null
All rights reserved.
This source code is licensed under the BSD-style license found in the +LICENSE file in the root directory of this source tree. An additional grant +of patent rights can be found in the PATENTS file in the same directory.
@flow
Use ReactNavigator to transition between different scenes in your app. To
+
Use Navigator to transition between different scenes in your app. To
accomplish this, provide route objects to the navigator to identify each
scene, and also a renderScene function that the navigator can use to
render the scene for a given route.
To change the animation or gesture properties of the scene, provide a
configureScene prop to get the config object for a given route. See
-ReactNavigator.SceneConfigs for default animations and more info on
-scene config options.
Navigator.SceneConfigs for default animations and more info on
+scene config options.ReactNavigator can be told to navigate in two ways. If you have a ref to
+ />
Navigator can be told to navigate in two ways. If you have a ref to
the element, you can invoke several methods on it to trigger navigation:
jumpBack() - Jump backward without unmounting the current scenejumpForward() - Jump forward to the next scene in the route stackjumpTo(route) - Transition to an existing scene without unmountingpush(route) - Navigate forward to a new scene, squashing any scenes
that you could jumpForward topop() - Transition back and unmount the current scenereplace(route) - Replace the current scene with a new routereplaceAtIndex(route, index) - Replace a scene as specified by an indexreplacePrevious(route) - Replace the previous sceneimmediatelyResetRouteStack(routeStack) - Reset every scene with an
array of routespopToRoute(route) - Pop to a particular scene, as specified by it's
@@ -35,11 +35,11 @@ few utilities:parentNavigator - a refrence to the paren
navigatoronDidFocus - used to pass a navigation focus event up to the parent
navigatorOptional function that allows configuration about scene animations and gestures. Will be invoked with the route and should return a scene -configuration object
Provide a single "route" to start on. A route is an arbitrary object +configuration object
Provide a single "route" to start on. A route is an arbitrary object that the navigator will use to identify each scene before rendering. Either initialRoute or initialRouteStack is required.
Provide a set of routes to initially mount the scenes for. Required if no initialRoute is provided
Optionally provide a navigation bar that persists across scene -transitions
Optionally provide the navigator object from a parent ReactNavigator
Will be called with the new route of each scene after the transition is +transitions
Optionally provide the navigator object from a parent Navigator
Will be called with the new route of each scene after the transition is complete or after the initial mounting. This overrides the onDidFocus handler that would be found in this.props.navigator
Will be called with (ref, indexInStack) when the scene ref changes
Will emit the target route upon mounting and before each nav transition,
overriding the handler in this.props.navigator. This overrides the onDidFocus
diff --git a/docs/tutorial.html b/docs/tutorial.html
index 714ed0aef01..81acca9be8a 100644
--- a/docs/tutorial.html
+++ b/docs/tutorial.html
@@ -70,17 +70,17 @@
Fetching data from Rotten Tomatoes's API isn't really relevant to learning React Native so feel free to breeze through this section.
Add the following constants to the top of the file (typically below the requires) to create the REQUEST_URL used to request data with.
Add some initial state to our application so that we can check this.state.movies === null to determine whether the movies data has been loaded or not. We can set this data when the response comes back with this.setState({movies: moviesData}). Add this code just above the render function inside our React class.
Fetching data from Rotten Tomatoes's API isn't really relevant to learning React Native so feel free to breeze through this section.
Add the following constants to the top of the file (typically below the requires) to create the REQUEST_URL used to request data with.
Add some initial state to our application so that we can check this.state.movies === null to determine whether the movies data has been loaded or not. We can set this data when the response comes back with this.setState({movies: moviesData}). Add this code just above the render function inside our React class.
We want to send off the request after the component has finished loading. componentDidMount is a function of React components that React will call exactly once, just after the component has been loaded.
Now add fetchData function used above to our main component. This method will be respondible for handling data fetching. All you need to do is call this.setState({movies: data}) after resolving the promise chain because the way React works is that setState actually triggers a re-render and then the render function will notice that this.state.movies is no longer null. Note that we call done() at the end of the promise chain - always make sure to call done() or any errors thrown will get swallowed.
Now add fetchData function used above to our main component. This method will be responsible for handling data fetching. All you need to do is call this.setState({movies: data}) after resolving the promise chain because the way React works is that setState actually triggers a re-render and then the render function will notice that this.state.movies is no longer null. Note that we call done() at the end of the promise chain - always make sure to call done() or any errors thrown will get swallowed.
Now modify the render funtion so that once we have our data it renders a ListView of movies instead of a single movie.
Now modify the render function so that once we have our data it renders a ListView of movies instead of a single movie.
The DataSource is an interfacte that ListView is using to determine which rows have changed over the course of updates.
You'll notice we used dataSource from this.state. The next step is to add an empty dataSource to the object returned by getInitialState. Also, now that we're storing the data in dataSource, we should not longer use this.state.movies to avoid storing data twice. We can use boolean property of the state (this.state.loaded) to tell whether data fetching has finished.
The DataSource is an interface that ListView is using to determine which rows have changed over the course of updates.
You'll notice we used dataSource from this.state. The next step is to add an empty dataSource to the object returned by getInitialState. Also, now that we're storing the data in dataSource, we should no longer use this.state.movies to avoid storing data twice. We can use boolean property of the state (this.state.loaded) to tell whether data fetching has finished.