React-Native Components
View
Text
StyleSheet
Which Icon library does create-react-native-app give you access to?
https://icons.expo.fyi/
import { Ionicons } from ‘@expo/vector-icons’;
touchables
Button TouchableHighlight TouchableOpacity TouchableNativeFeedback TouchableWithoutFeedback
Lists
ScrollView
FlatView
SectionList
ActivityIndicator
Is a loading spinner
props:
Button
A basic button component that should render nicely on any platform. Supports a minimal level of customization.
Props:
FlatList
A performant interface for rendering basic, flat lists, supporting the handiest features:
item.id}
/>
Main Props:
The major difference between ScrollView and FlatList?
FlatList is more performant
ScrollView will load the entire data set, whereas FlatList will only load the data displayed in the view (recycles views)
Form Elements
Switch
TextInput
KeyboardAvoidingView
Difference between onChange and onChangeText in the TextInput component
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.
difference between loading an image from an external server vs loading an image within the app.
In App:
from external source
What is AsyncStorage?
AsyncStorage is an unencrypted, asynchronous, persistent, key-value storage system that is global to the app. It should be used instead of LocalStorage.
How is data stored with AsyncStorage?
AsyncStorage will use either RocksDB or SQLite based on what is available.
How to add data to AsyncStorage?
function submitEntry({entry,key}){
return AsyncStorage.mergeItem(CALENDAR_STORAGE_KEY, JSON.stringify({
[key]:entry,
}))
}How to remove data with AsyncStorage?
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 to style components in REACT Native?
const styles = {
image: {
borderRadius: 5,
margin: 10,
width: 48,
height: 48
}
};
function Avatar ({ src }) {
return ();
}
How to style components in REACT Native?
const styles = StyleSheet.create({
greenLarge: {
color: 'green',
fontWeight: 'bold',
fontSize: 40
},
red: {
color: 'red',
padding: 30
},
});
function Avatar ({ src }) {
return ();
}
Adding more than one style to an element
This will be red, then greenLarge
What is the defualt flex-direction in React Native Apps?
column
difference between CSS flexbox and Native flexbox?
difference between CSS flexbox and Native flexbox?
How to render platform-specific elements?
Use the Platform API to check devices platform