This repository accompanies the 16/09/2016 Wix Engineering workshop in Dnipro, Ukraine: React Native: The Game Changer. Together, we're going to build a very simple app that exposes us to the most basic components of a React Native developer's toolkit. We'll work through some of the steps together and leave some for you to try on your own.
Every step has an accompanying branch in this repo that contains all of the code for the tasks up to (and including) that step. If necessary, you can check out a step's branch to see a potential solution or to skip to a later step.
###Setup
Before beginning, please make sure you have your environment set up for React Native development. If you have any trouble, just ask for help.
The complete instructions can be found on React Native’s website: https://facebook.github.io/react-native/docs/getting-started.html#content. Notice that there are separate tabs for iOS and Android. You should set up both of them. The basic idea is as follows:
####Install
- Xcode (This takes a long time to download…)
- Android Studio (This also takes quite a while…)
brew install node
brew install watchman
npm install -g react-native-cli
####Test
react-native init TestProject
cd TestProject
react-native run-ios
react-native run-android
All works? Great! Now go ahead and clone this repo and navigate to the created directory.
- Initialize an empty React Native project called
MemeBuilder
- Run the project in both Android and iOS to verify it works
- Make a trivial change to the text in each of the views and see it update
- Notice that these two apps look almost the same? Let's share the code by
extracting it to its own component call
HomeScreen
. We'll put it in a directory calledsrc
. - Get comfortable with the parts of the project - make sure to understand what all the major parts do
- Get comfortable with basic debugging tools - you're going to need them.
- Replace the default text in the app with an image. The image should be centered both vertically and horizontally on the screen.
- While you're at it, simplify
HomeScreen
to be a stateless functional component.
- Add a message to the bottom of
HomeScreen
informing the user what platform they're using. Use thePlatform
module. - Change the background color of the app - use different colors for Android and iOS. Do this by importing a separate module with theming in it that can be configured differently for Android and iOS.
- Add a simple input box to
HomeScreen
. Don't worry about connecting it to anything, we'll do that later. Create separate components for iOS and Android and style them differently.
- There should be a
ListView
on the screen displaying a list of images. - When tapping an image, print the image data to the console. (Use either
TouchableOpacity
orTouchableHighlight
. Try them both to see what you like better.)
- Add simple navigation to the app. When tapping an image, push a screen with just that image centered in middle of the screen.
- Add two text inputs on top for the user to type text
- Superimpose the text on the images - color the text white on a background of 50% opaque black
- Organize your code into folders and clean it up if you think it could be better organized. Use stateless functional components where possible.
- Use flexbox to take up the full width of
HomeScreen
by wrapping the images into a grid instead of a simple list https://github.com/yelled3/react-native-grid-example - Add a back button to the MemeBuilder screen
- Add a slider to the
MemeBuilder
screen that controls the size of the image. It should grow and shrink as the user slides the slider. The image should always be a square.
- Change the image resize behavior - instead of responding as the user slides, it should only resize after the user stops sliding. It should animate using a "spring" bounce from the previous size to the new size.