React Native Flashcards

1
Q

React-Native Components

A

View
Text
StyleSheet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which Icon library does create-react-native-app give you access to?

A

https://icons.expo.fyi/

import { Ionicons } from ‘@expo/vector-icons’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

touchables

A
Button
TouchableHighlight
TouchableOpacity
TouchableNativeFeedback
TouchableWithoutFeedback
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Lists

A

ScrollView
FlatView
SectionList

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

ActivityIndicator

A

Is a loading spinner

props:

  • size (string)
  • color (‘string’)
  • hidesWhenStopped (bool)
  • size (String)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Button

A

A basic button component that should render nicely on any platform. Supports a minimal level of customization.

Props:

  • onPress (function)
  • title (String)
  • accessibilityLabel(String)
  • color(String)
  • disabled(bool)
  • hasTVPreferredFocus(bool)
  • nextFocusDown(Number)
  • nextFocusForward(number)
  • nextFocusLeft(number)
  • nextFocusRight(number)
  • nextFocusUp(number)
  • testId(String)
  • touchSoundDisabled(bool)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

FlatList

A

A performant interface for rendering basic, flat lists, supporting the handiest features:

  • Fully cross-platform.
  • Optional horizontal mode.
  • Configurable viewability callbacks.
  • Header support.
  • Footer support.
  • Separator support.
  • Pull to Refresh.
  • Scroll loading.
  • ScrollToIndex support.
  • Multiple column support.

item.id}
/>

Main Props:

  • data={DATA}
  • renderItem={renderItem}
  • keyExtractor={(item) => item.id}
  • extraData={selectedId}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The major difference between ScrollView and FlatList?

A

FlatList is more performant

ScrollView will load the entire data set, whereas FlatList will only load the data displayed in the view (recycles views)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Form Elements

A

Switch
TextInput
KeyboardAvoidingView

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Difference between onChange and onChangeText in the TextInput component

A

While both methods are invoked on value change, onChangeText passes the actual value (text) as the argument. On the other hand, onChange passes the entire event object as an argument. Both are perfectly valid props, but the logic of your event handler will need to be tailored to the prop chosen.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

difference between loading an image from an external server vs loading an image within the app.

A

In App:

from external source

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is AsyncStorage?

A

AsyncStorage is an unencrypted, asynchronous, persistent, key-value storage system that is global to the app. It should be used instead of LocalStorage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How is data stored with AsyncStorage?

A

AsyncStorage will use either RocksDB or SQLite based on what is available.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to add data to AsyncStorage?

A
function submitEntry({entry,key}){
    return AsyncStorage.mergeItem(CALENDAR_STORAGE_KEY, JSON.stringify({
        [key]:entry,
    }))
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to remove data with AsyncStorage?

A
export function removeEntry(key){
    return AsyncStorage.getItem(CALENDAR_STORAGE_KEY)
        .then((results)=>{
            const data = JSON.parse(results)
            data[key] = undefined
            delete data[key]
            AsyncStorage.setItem(CALENDAR_STORAGE_KEY, JSON.stringify(data))
        })

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How to style components in REACT Native?

A
const styles = {
  image: {
    borderRadius: 5,
    margin: 10,
    width: 48,
    height: 48
  }
};
function Avatar ({ src }) {
  return (

);
}

17
Q

How to style components in REACT Native?

A
const styles = StyleSheet.create({
  greenLarge: {
    color: 'green',
    fontWeight: 'bold',
    fontSize: 40
  },
  red: {
    color: 'red',
    padding: 30
  },
});
function Avatar ({ src }) {
  return (

);
}

18
Q

Adding more than one style to an element

A

This will be red, then greenLarge

19
Q

What is the defualt flex-direction in React Native Apps?

A

column

20
Q

difference between CSS flexbox and Native flexbox?

A
  1. Styled in Javascript (Camelcase instead of hyphens)
  2. Column is the default
  3. Flex in stead of flex-grow
  4. Every element is by default a flex container
21
Q

difference between CSS flexbox and Native flexbox?

A
  1. Styled in Javascript (Camelcase instead of hyphens)
  2. Column is the default
  3. Flex in stead of flex-grow
  4. Every element is by default a flex container
  5. Dimensions in Native are unitless
22
Q

How to render platform-specific elements?

A

Use the Platform API to check devices platform