An open API service indexing awesome lists of open source software.

https://github.com/anmolsukki/react-native-basics


https://github.com/anmolsukki/react-native-basics

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

### React Native Basics

#### KeyboardAvoidingView

```jsx
import { View, KeyboardAvoidingView } from 'react-native';

...
;
```

#### Detect Update Orientation

```jsx
import React, { useState, useEffect } from 'react';
import { View, Dimensions } from 'react-native';

const [buttonWidth, setButtonWidth] = useState(Dimensions.get('window').width / 4);

useEffect(() => {
const updateLayout = () => {
setButtonWidth(Dimensions.get('window').width / 4)
}

Dimensions.addEventListener("change", updateLayout)
return () => {
Dimensions.removeEventListener("change", updateLayout)
}
})

...
```

#### Platform

```jsx
import { View, Platform } from 'react-native';

{Platform.OS === 'ios' ? 'IOS' : 'Android'}
;
```