Diving Into The Basics - ganeshkhutwad/react-native-app GitHub Wiki

How to work with React Native Components

Setting Up A New Project

Working with Core Components

  1. View
  2. Text
  3. TextInput

Getting Started with Styles

  • We can use inline styles. (not much good idea)
  • For layouting and positioning elements, React Native uses Flexbox.

React Native Flexbox Deep Dive

  • By default every view uses flexbox in React Native.
  • Flexbox uses to organize the elements.

Inline Styles and StyleSheet Objects

  • Inline styles are hard to understand and manage in the future.
  • StyleSheet is a class provided by react-native to
const styles = StyleSheet.create({
    screen: {}
});
  • can add validation and performance wise better in future
  • for wrong syntax throws an error.

Working with state and events

onClickText event. onPress event.

Better way to update the state setCourseGoals(currentGoals => [...currentGoals, enteredGoal]);

than setCourseGoals([...currentGoals, enteredGoal]);

Outputting a List of Items

same as react

Styling List Items

  • has less styling support, so always wrap it inside for styling purpose.

Making it Scrollable with ScrollView

- Just wrap content inside ScrollView component.

A Better List: FlatList

  1. ScrollView is a great when you have limited elements but if you have very long list then its not a good choice
  2. For such case, we should use component.
 (
          
            {itemData.item.value}
          
        )}
      >
  1. In React Native now also supports "id" instead of "key". Try "uid"

Working with Touchable Components (onPress doesn't work with such components)

and there so many component like it with different uses.

Adding a Modal Overlay

⚠️ **GitHub.com Fallback** ⚠️